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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #0d0f16; color: #d4d8ec; height: 100vh; overflow: hidden; display: flex; }
body.light-mode { background: #eef2f8; color: #1e2433; }

/* ── SIDEBAR ──────────────────────────────── */
#sidebar {
  width: 270px;
  min-width: 270px;
  background: #181b2a;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
  border-right: 1px solid #252840;
  z-index: 10;
}
#sidebar.collapsed { width: 64px; min-width: 64px; }

.sb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid #252840;
  flex-shrink: 0;
}
.ai-badge {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #6e66f3, #9187ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  cursor: pointer;
}
.sb-title {
  font-size: 15px; font-weight: 600; color: #eef0fa;
  white-space: nowrap; overflow: hidden;
  flex: 1;
}
.sb-collapse-btn {
  background: none; border: none; cursor: pointer;
  color: #4e5370; padding: 4px; line-height: 0;
  flex-shrink: 0;
}
.sb-collapse-btn:hover { color: #737a96; }
#sidebar.collapsed .sb-title,
#sidebar.collapsed .sb-collapse-btn { display: none; }

.sb-nav { padding: 10px 8px; flex-shrink: 0; }
.sb-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px;
  border-radius: 9px;
  cursor: pointer;
  color: #8a90ac;
  font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap; overflow: hidden;
  user-select: none;
}
.sb-nav-item:hover { background: #20233a; color: #d4d8ec; }
.sb-nav-item.active { background: #20233a; color: #eef0fa; }
.sb-nav-item svg { flex-shrink: 0; }
.sb-nav-label { overflow: hidden; }
#sidebar.collapsed .sb-nav-label { display: none; }
#sidebar.collapsed .sb-nav-item { justify-content: center; padding: 10px; }

.sb-section-label {
  font-size: 11px; font-weight: 600; color: #4e5370;
  text-transform: uppercase; letter-spacing: 0.7px;
  padding: 10px 18px 4px;
  white-space: nowrap;
}
#sidebar.collapsed .sb-section-label { display: none; }

/* Search */
.sb-search-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 10px;
  flex-shrink: 0;
  overflow: hidden;
}
#sidebar.collapsed .sb-search-row { display: none; }
.sb-search {
  flex: 1;
  min-width: 0;
  background: #20233a;
  border: 1px solid #303454;
  border-radius: 8px;
  height: 34px;
  display: flex; align-items: center;
  padding: 0 10px; gap: 6px;
}
.sb-search input {
  background: none; border: none; outline: none;
  color: #d4d8ec; font-size: 13px; flex: 1;
  font-family: inherit;
}
.sb-search input::placeholder { color: #4e5370; }
.sb-total { font-size: 12px; color: #4e5370; white-space: nowrap; }

/* Conversation list */
.sb-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.sb-list::-webkit-scrollbar { width: 4px; }
.sb-list::-webkit-scrollbar-thumb { background: #303454; border-radius: 4px; }
#sidebar.collapsed .sb-list { display: none; }

.conv-item {
  display: flex; align-items: center;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  gap: 8px;
}
.conv-item:hover { background: #20233a; }
.conv-item.active { background: #20233a; }
.conv-title {
  flex: 1; font-size: 13.5px; color: #9aa0bc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.conv-item.active .conv-title { color: #eef0fa; }
.conv-date { font-size: 11.5px; color: #4e5370; white-space: nowrap; flex-shrink: 0; }
.conv-actions {
  display: none; align-items: center; gap: 4px; flex-shrink: 0;
}
.conv-item:hover .conv-actions,
.conv-item.active .conv-actions { display: flex; }
.conv-item:hover .conv-date,
.conv-item.active .conv-date { display: none; }
.conv-act-btn {
  background: none; border: none; cursor: pointer;
  color: #4e5370; padding: 3px; line-height: 0; border-radius: 5px;
}
.conv-act-btn:hover { color: #d4d8ec; background: #303454; }
.conv-act-btn.danger:hover { color: #e08080; background: rgba(176,80,80,0.15); }

/* Bottom of sidebar */
.sb-bottom {
  padding: 10px 8px 14px;
  border-top: 1px solid #252840;
  flex-shrink: 0;
}
.sb-bottom-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px;
  border-radius: 9px;
  cursor: pointer;
  color: #737a96; font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap; overflow: hidden;
  text-decoration: none;
}
.sb-bottom-item:hover { background: #20233a; color: #d4d8ec; }
#sidebar.collapsed .sb-bottom-item { justify-content: center; padding: 10px; }
#sidebar.collapsed .sb-bottom-label { display: none; }

#recents-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

#sb-expand-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #4e5370;
  padding: 4px;
  line-height: 0;
}

/* ── MAIN AREA ──────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid #1e2132;
  flex-shrink: 0;
}
.topbar-left { width: 40px; }
.topbar-center {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600; color: #eef0fa;
  cursor: pointer; user-select: none;
}
.topbar-center svg { color: #737a96; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6e66f3, #9187ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  position: relative; cursor: pointer; flex-shrink: 0;
}
.avatar-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: #3ecf8e; border-radius: 50%;
  border: 2px solid #0d0f16;
}

/* ── HOME (no chat) ── */
#home-view {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px 100px;
  gap: 12px;
}
.home-greeting {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  color: #737a96;
  text-align: center;
}
.home-greeting span { color: #eef0fa; }
.home-sub {
  font-size: 15px; color: #4e5370; text-align: center; line-height: 1.55;
  max-width: 480px;
}
.home-input-wrap { margin-top: 24px; width: 100%; max-width: 680px; }

/* ── CHAT AREA ── */
#chat-view {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.messages-area {
  flex: 1; overflow-y: auto;
  padding: 28px 0;
  display: flex; flex-direction: column; gap: 20px;
}
.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-thumb { background: #252840; border-radius: 4px; }

.msg-row {
  display: flex; gap: 12px;
  padding: 0 clamp(16px, 5%, 80px);
  max-width: 900px; width: 100%; margin: 0 auto;
}
.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #6e66f3, #9187ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  align-self: flex-start; margin-top: 2px;
}
.msg-avatar.user-av {
  background: #20233a;
  border: 1px solid #303454;
  font-size: 12px; color: #9187ff;
}

.msg-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.msg-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.msg-name { font-weight: 600; color: #eef0fa; }
.msg-time { color: #4e5370; }
.msg-row.user .msg-meta { flex-direction: row-reverse; }

.msg-bubble {
  background: #1e2132;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px; line-height: 1.65; color: #c8cde3;
  max-width: 100%;
  word-break: break-word;
}
.msg-row.user .msg-bubble {
  background: #20233a;
  border: 1px solid #303454;
  color: #d4d8ec;
}
.msg-actions {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.msg-act-btn {
  background: none; border: none; cursor: pointer;
  color: #4e5370; padding: 5px; line-height: 0; border-radius: 6px;
}
.msg-act-btn:hover { color: #9187ff; background: rgba(110,102,243,0.1); }

/* Result table inside bubble */
.result-table-wrap { overflow-x: auto; margin-top: 10px; border-radius: 8px; }
.result-table {
  border-collapse: collapse; font-size: 12.5px; min-width: 100%;
}
.result-table th {
  background: #252840; color: #9aa0bc;
  padding: 7px 12px; text-align: left; font-weight: 600;
  border-bottom: 1px solid #303454;
  white-space: nowrap;
}
.result-table td {
  padding: 6px 12px; color: #c8cde3;
  border-bottom: 1px solid #1e2132;
  white-space: nowrap;
}
.result-table tr:last-child td { border-bottom: none; }
.result-table tr:hover td { background: rgba(110,102,243,0.05); }

.sql-block {
  background: #131520; border: 1px solid #252840;
  border-radius: 8px; padding: 12px 14px;
  font-family: 'Courier New', monospace; font-size: 12.5px;
  color: #9187ff; line-height: 1.55; margin-top: 8px;
  overflow-x: auto; white-space: pre;
}
.result-count { font-size: 12px; color: #4e5370; margin-top: 6px; }

.reasoning-block {
  margin-top: 10px;
  border: 1px solid #252840;
  border-radius: 8px;
  overflow: hidden;
}
.reasoning-toggle {
  width: 100%; background: #1a1d2e; border: none;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; color: #737a96;
  font-size: 12.5px; font-family: inherit; text-align: left;
  transition: background 0.15s;
}
.reasoning-toggle:hover { background: #20233a; color: #9aa0bc; }
.reasoning-toggle svg { flex-shrink: 0; transition: transform 0.2s; }
.reasoning-toggle.open svg { transform: rotate(180deg); }
.reasoning-body {
  display: none; padding: 10px 14px;
  font-size: 12.5px; color: #8a90ac; line-height: 1.65;
  white-space: pre-wrap; background: #131520;
}
.reasoning-body.open { display: block; }

.pdf-dl-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: #6e66f3; color: #fff;
  border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.18s;
  font-family: inherit;
}
.pdf-dl-btn:hover { background: #7c74f7; }

.thinking-dots span {
  display: inline-block;
  animation: blink 1.4s infinite;
  color: #6e66f3;
  font-size: 20px;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{opacity:0} 40%{opacity:1} }

/* ── INPUT BAR ── */
.input-area {
  padding: 0 clamp(16px, 5%, 80px) 18px;
  flex-shrink: 0;
  max-width: 900px; width: 100%; margin: 0 auto;
}
#home-view .input-area { padding: 0; }
.input-bar {
  background: #1e2132;
  border: 1px solid #2a2e48;
  border-radius: 28px;
  display: flex; align-items: center;
  padding: 8px 8px 8px 20px;
  gap: 8px;
  transition: border-color 0.18s;
}
.input-bar:focus-within { border-color: #6e66f3; box-shadow: 0 0 0 3px rgba(110,102,243,0.12); }
.input-bar textarea {
  flex: 1; background: none; border: none; outline: none;
  color: #d4d8ec; font-size: 14.5px; font-family: inherit;
  resize: none; line-height: 1.5; max-height: 160px;
  overflow-y: auto; padding: 4px 0;
}
.input-bar textarea::placeholder { color: #4e5370; }
.input-bar textarea::-webkit-scrollbar { width: 3px; }
.input-bar textarea::-webkit-scrollbar-thumb { background: #303454; border-radius: 3px; }

.mic-btn {
  background: none; border: none; cursor: pointer;
  color: #4e5370; padding: 6px; line-height: 0; border-radius: 50%;
  flex-shrink: 0;
}
.mic-btn:hover { color: #737a96; }
.send-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%;
  background: #6e66f3;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: background 0.18s, transform 0.1s;
}
.send-btn:hover { background: #7c74f7; }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { background: #252840; cursor: not-allowed; }

.input-hint {
  text-align: center; font-size: 12px; color: #35394d; margin-top: 8px;
}

/* ── RIGHT PANEL ── */
#right-panel {
  position: fixed;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 0;
  max-height: 420px;
  background: #181b2a;
  border: 1px solid #252840;
  border-right: none;
  border-radius: 12px 0 0 12px;
  transition: width 0.25s ease;
  overflow: hidden;
  display: flex; flex-direction: column;
  z-index: 40;
  box-shadow: -4px 0 24px rgba(0,0,0,0.35);
}
#right-panel.open { width: 300px; }

.rp-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  background: #6e66f3;
  flex-shrink: 0;
}
.rp-collapse-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.8); padding: 4px; line-height: 0;
}
.rp-collapse-btn:hover { color: #fff; }
.rp-title { font-size: 13px; font-weight: 600; color: #fff; flex: 1; white-space: nowrap; }

.rp-list { flex: 1; overflow-y: auto; padding: 8px; }
.rp-list::-webkit-scrollbar { width: 4px; }
.rp-list::-webkit-scrollbar-thumb { background: #303454; border-radius: 4px; }
.rp-item {
  display: flex; align-items: center;
  padding: 10px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px; color: #9aa0bc;
  transition: background 0.15s;
  gap: 8px;
}
.rp-item:hover { background: #20233a; color: #eef0fa; }
.rp-item.active { background: #20233a; color: #eef0fa; }
.rp-item-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rp-item-time { font-size: 11px; color: #4e5370; white-space: nowrap; flex-shrink: 0; }
.rp-item-actions { display: none; gap: 3px; flex-shrink: 0; }
.rp-item:hover .rp-item-actions { display: flex; }
.rp-item:hover .rp-item-time { display: none; }
.rp-act-btn {
  background: none; border: none; cursor: pointer;
  color: #4e5370; padding: 3px; line-height: 0; border-radius: 5px;
}
.rp-act-btn:hover { color: #d4d8ec; background: #303454; }

/* ── RIGHT TOGGLE BUTTON ── */
#rp-toggle-btn {
  position: fixed;
  right: 0; top: 50%;
  transform: translateY(-50%);
  background: #6e66f3;
  border: none; cursor: pointer;
  color: #fff; padding: 10px 5px;
  border-radius: 8px 0 0 8px;
  line-height: 0;
  transition: background 0.18s;
  display: none;
  z-index: 41;
}
#rp-toggle-btn.panel-open { display: none !important; }
#rp-toggle-btn:hover { background: #7c74f7; }

/* ── Settings modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #181b2a; border-radius: 16px;
  padding: 32px 28px; width: 100%; max-width: 420px;
  border: 1px solid #252840;
}
.modal-title { font-size: 17px; font-weight: 700; color: #eef0fa; margin-bottom: 20px; }
.modal-field { margin-bottom: 16px; }
.modal-label { font-size: 13px; color: #8a90ac; margin-bottom: 6px; display: block; }
.modal-input {
  width: 100%; height: 42px;
  background: #20233a; border: 1px solid #303454;
  border-radius: 9px; color: #d4d8ec; font-size: 14px;
  padding: 0 14px; outline: none; font-family: inherit;
}
.modal-input:focus { border-color: #6e66f3; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal-btn {
  height: 38px; padding: 0 20px; border-radius: 9px;
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
}
.modal-btn.primary { background: #6e66f3; color: #fff; }
.modal-btn.primary:hover { background: #7c74f7; }
.modal-btn.ghost { background: #252840; color: #8a90ac; }
.modal-btn.ghost:hover { background: #303454; color: #d4d8ec; }

.theme-options { display: grid; gap: 10px; }
.theme-option { display: block; cursor: pointer; }
.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-option-ui {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 15px;
  background: #20233a;
  border: 1px solid #303454;
  border-radius: 12px;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.theme-option-title { color: #eef0fa; font-size: 14px; font-weight: 600; }
.theme-option-copy { color: #8a90ac; font-size: 12.5px; line-height: 1.55; }
.theme-option:hover .theme-option-ui {
  background: #252840;
  border-color: #3a3f66;
}
.theme-option input:checked + .theme-option-ui {
  border-color: #6e66f3;
  box-shadow: 0 0 0 3px rgba(110,102,243,0.16);
}
.theme-option input:focus-visible + .theme-option-ui {
  border-color: #6e66f3;
  box-shadow: 0 0 0 3px rgba(110,102,243,0.2);
}

/* ── Chart ── */
.chart-wrap {
  margin-top: 12px;
  background: #131520;
  border: 1px solid #252840;
  border-radius: 10px;
  padding: 14px 14px 10px;
  position: relative;
}
.chart-title {
  font-size: 12px; color: #737a96; margin-bottom: 8px;
  font-weight: 500; text-align: center;
}
.chart-canvas-wrap { position: relative; max-height: 300px; }

/* ── Technical section ── */
.tech-section {
  margin-top: 14px;
  border: 1px solid #252840;
  border-radius: 10px;
  overflow: hidden;
}
.tech-section-label {
  display: flex; align-items: center; gap: 7px;
  background: #1a1d2e; padding: 8px 12px;
  font-size: 12px; font-weight: 600; color: #737a96;
  letter-spacing: 0.3px;
}
.tech-section .sql-block {
  border-radius: 0; border-left: none; border-right: none; border-top: none;
  margin-top: 0;
}
.tech-section .result-table-wrap { border-radius: 0; }
.tech-section .result-count { padding: 6px 12px; }

/* ── Markdown rendering inside AI bubbles ── */
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: 20px; margin: 4px 0 8px; }
.md li { margin-bottom: 3px; }
.md strong { color: #eef0fa; font-weight: 600; }
.md em { color: #b0b6d0; font-style: italic; }
.md code { background: #131520; color: #9187ff; border-radius: 4px; padding: 1px 6px; font-size: 12.5px; font-family: 'Courier New', monospace; }
.md pre { background: #131520; border: 1px solid #252840; border-radius: 8px; padding: 10px 14px; overflow-x: auto; margin: 8px 0; }
.md pre code { background: none; padding: 0; color: #9187ff; }
.md h1, .md h2, .md h3 { color: #eef0fa; font-weight: 600; margin: 10px 0 4px; }
.md h1 { font-size: 16px; }
.md h2 { font-size: 15px; }
.md h3 { font-size: 14px; }
.md hr { border: none; border-top: 1px solid #252840; margin: 10px 0; }
.md a { color: #7b72f0; }
.md blockquote { border-left: 3px solid #303454; padding-left: 12px; color: #737a96; margin: 6px 0; }
.md table { border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.md th { background: #252840; color: #9aa0bc; padding: 5px 10px; border: 1px solid #303454; }
.md td { padding: 5px 10px; border: 1px solid #252840; color: #c8cde3; }

/* ── LOGIN PAGE ──────────────────────────── */
body.login-page {
  height: auto;
  min-height: 100vh;
  overflow: visible;
  flex-direction: column;
}

.shell {
  background: #0d0f16;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 48px;
}

.card {
  background: #181b2a;
  border-radius: 16px;
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 420px;
}

.logo-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.badge {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, #6e66f3, #9187ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  letter-spacing: -0.3px;
}

.agent-name { color: #d4d8ec; font-size: 15px; font-weight: 500; }

.card-title { color: #eef0fa; font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 7px; }
.card-sub { color: #737a96; font-size: 13.5px; text-align: center; line-height: 1.55; margin-bottom: 26px; }

.error-box {
  background: rgba(176, 80, 80, 0.15);
  border: 1px solid rgba(176, 80, 80, 0.4);
  color: #e08080;
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
  text-align: center;
}

.field { margin-bottom: 12px; position: relative; }
.field input {
  width: 100%;
  height: 46px;
  background: #20233a;
  border: 1px solid #303454;
  border-radius: 9px;
  color: #d4d8ec;
  font-size: 14px;
  padding: 0 44px 0 14px;
  outline: none;
  transition: border-color 0.18s;
}
.field input::placeholder { color: #4e5370; }
.field input:focus { border-color: #6e66f3; box-shadow: 0 0 0 3px rgba(110,102,243,0.18); }

.eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #4e5370; padding: 4px; line-height: 0;
}
.eye-btn:hover { color: #737a96; }

.login-btn {
  width: 100%; height: 46px;
  background: #6e66f3;
  border: none; border-radius: 9px;
  color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
  letter-spacing: 0.2px;
}
.login-btn:hover { background: #7c74f7; }
.login-btn:active { transform: scale(0.99); background: #625bf0; }

.foot {
  text-align: center; color: #35394d; font-size: 12px;
  padding: 12px 16px 16px;
  flex-shrink: 0;
}
.foot a { color: #35394d; text-decoration: underline; }

/* ── RESPONSIVE ──────────────────────────── */
#mobile-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
}
#mobile-backdrop.open { display: block; }

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 270px !important;
    min-width: 270px !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 60;
  }
  #sidebar.mobile-open { transform: translateX(0); }

  #sidebar.collapsed .sb-title,
  #sidebar.collapsed .sb-collapse-btn,
  #sidebar.collapsed .sb-nav-label,
  #sidebar.collapsed .sb-section-label,
  #sidebar.collapsed .sb-search-row,
  #sidebar.collapsed .sb-list,
  #sidebar.collapsed .sb-bottom-label { display: unset; }
  #sidebar.collapsed .sb-nav-item { justify-content: flex-start; padding: 10px 10px; }
  #sidebar.collapsed .sb-bottom-item { justify-content: flex-start; padding: 10px 10px; }

  #sb-expand-btn { display: block !important; }

  #right-panel.open { width: 260px; }

  .msg-row { padding: 0 12px; }
  .input-area { padding: 0 12px 14px; }
  #home-view { padding: 24px 16px 80px; }

  .modal-box { margin: 0 16px; padding: 24px 18px; }
  .topbar { padding: 0 12px; }
}

@media (max-width: 480px) {
  .home-greeting { font-size: 24px; }
  .home-sub { font-size: 13.5px; }
  .msg-bubble { font-size: 13.5px; padding: 12px 14px; }
  .topbar-center { font-size: 14px; }
  #right-panel.open { width: 90vw; }
}

body.light-mode #sidebar,
body.light-mode #right-panel,
body.light-mode .modal-box {
  background: #ffffff;
  border-color: #d7dfec;
}

body.light-mode #main { background: #f6f8fc; }

body.light-mode .sb-header,
body.light-mode .sb-bottom,
body.light-mode .topbar {
  border-color: #dde4ef;
}

body.light-mode .sb-title,
body.light-mode .home-greeting span,
body.light-mode .msg-name,
body.light-mode .modal-title,
body.light-mode .theme-option-title,
body.light-mode .rp-title {
  color: #1f2937;
}

body.light-mode .sb-nav-item,
body.light-mode .sb-bottom-item,
body.light-mode .home-greeting,
body.light-mode .msg-bubble,
body.light-mode .result-table td,
body.light-mode .modal-input,
body.light-mode .rp-item,
body.light-mode .conv-title,
body.light-mode .theme-option-copy {
  color: #4b5567;
}

body.light-mode .sb-nav-item:hover,
body.light-mode .sb-nav-item.active,
body.light-mode .sb-bottom-item:hover,
body.light-mode .conv-item:hover,
body.light-mode .conv-item.active,
body.light-mode .rp-item:hover,
body.light-mode .rp-item.active {
  background: #edf2fb;
  color: #1f2937;
}

body.light-mode .sb-search,
body.light-mode .input-bar,
body.light-mode .msg-row.user .msg-bubble,
body.light-mode .modal-input,
body.light-mode .theme-option-ui,
body.light-mode .msg-bubble,
body.light-mode .reasoning-toggle,
body.light-mode .result-table th,
body.light-mode .sql-block,
body.light-mode .chart-wrap,
body.light-mode .reasoning-body,
body.light-mode .md code,
body.light-mode .md pre {
  background: #ffffff;
  border-color: #d7dfec;
}

body.light-mode .input-bar,
body.light-mode .msg-row.user .msg-bubble,
body.light-mode .modal-input,
body.light-mode .theme-option-ui,
body.light-mode .msg-bubble,
body.light-mode .reasoning-toggle,
body.light-mode .result-table th,
body.light-mode .sql-block,
body.light-mode .chart-wrap,
body.light-mode .reasoning-body,
body.light-mode .md pre {
  border: 1px solid #d7dfec;
}

body.light-mode .msg-avatar.user-av {
  background: #ffffff;
  border: 1px solid #cfd8e6;
  color: #6e66f3;
}

body.light-mode .result-table td,
body.light-mode .result-table th,
body.light-mode .md th,
body.light-mode .md td {
  border-bottom-color: #e7edf6;
  border-color: #d7dfec;
}

body.light-mode .reasoning-toggle,
body.light-mode .tech-section-label,
body.light-mode .chart-title,
body.light-mode .home-sub,
body.light-mode .modal-label,
body.light-mode .msg-time,
body.light-mode .result-count,
body.light-mode .sb-section-label,
body.light-mode .sb-total,
body.light-mode .conv-date,
body.light-mode .rp-item-time,
body.light-mode .input-hint,
body.light-mode .input-bar textarea::placeholder,
body.light-mode .sb-search input::placeholder,
body.light-mode .md blockquote,
body.light-mode .md em {
  color: #7b8798;
}

body.light-mode .input-bar textarea,
body.light-mode .sb-search input,
body.light-mode .modal-input,
body.light-mode .md strong,
body.light-mode .md h1,
body.light-mode .md h2,
body.light-mode .md h3 {
  color: #1f2937;
}

body.light-mode .modal-overlay { background: rgba(15, 23, 42, 0.28); }
body.light-mode .modal-btn.ghost {
  background: #eef2f8;
  color: #4b5567;
}
body.light-mode .modal-btn.ghost:hover {
  background: #e3eaf5;
  color: #1f2937;
}
body.light-mode .theme-option:hover .theme-option-ui {
  background: #edf2fb;
  border-color: #b5c0d8;
}
body.light-mode .rp-header {
  background: #eef2ff;
  border-bottom: 1px solid #d7dfec;
}
body.light-mode .rp-collapse-btn { color: #6e66f3; }
body.light-mode .rp-collapse-btn:hover { color: #5147e7; }
body.light-mode .topbar-right,
body.light-mode .topbar-left { color: #4b5567; }

/* explicit msg-bubble override — beats .msg-row.user .msg-bubble specificity */
body.light-mode .msg-row .msg-bubble,
body.light-mode .msg-row.user .msg-bubble {
  background: #ffffff;
  color: #4b5567;
  border: 1px solid #d7dfec;
}

/* avatar dot border matches main bg */
body.light-mode .avatar-dot { border-color: #f6f8fc; }

/* active conv-title in light mode */
body.light-mode .conv-item.active .conv-title { color: #1f2937; }

/* action button hovers */
body.light-mode .conv-act-btn:hover { color: #1f2937; background: #dde4ef; }
body.light-mode .rp-act-btn:hover   { color: #1f2937; background: #dde4ef; }

/* technical section */
body.light-mode .tech-section { border-color: #d7dfec; }
body.light-mode .tech-section-label {
  background: #eef2f8;
  color: #6b7280;
}

/* reasoning toggle hover */
body.light-mode .reasoning-toggle:hover { background: #edf2fb; color: #4b5567; }

/* markdown elements */
body.light-mode .md hr   { border-top-color: #d7dfec; }
body.light-mode .md th   { background: #eef2f8; color: #4b5567; }
body.light-mode .md blockquote { border-left-color: #c5cedf; }

/* disabled send button */
body.light-mode .send-btn:disabled { background: #c5cedf; }

/* scrollbar thumbs */
body.light-mode .sb-list::-webkit-scrollbar-thumb,
body.light-mode .messages-area::-webkit-scrollbar-thumb,
body.light-mode .rp-list::-webkit-scrollbar-thumb,
body.light-mode .input-bar textarea::-webkit-scrollbar-thumb { background: #c5cedf; }
