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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f0f5;
  color: #1a1a1a;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: 260px;
  background: #16162a;
  color: #cdd6f4;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #1e1e38;
}
#sidebar-header {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#sidebar-header h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}
#new-chat-btn {
  background: #6c63ff;
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s;
}
#new-chat-btn:hover { background: #5a52d5; }

#sidebar-search-wrap {
  padding: 0 10px 8px;
}
#sidebar-search {
  width: 100%; box-sizing: border-box;
  background: #1e1e38; border: 1px solid #313255; border-radius: 8px;
  color: #cdd6f4; font-size: 12px; padding: 6px 10px;
  outline: none; transition: border-color 0.15s;
}
#sidebar-search::placeholder { color: #444466; }
#sidebar-search:focus { border-color: #6c63ff; }

#conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}
#conversations-list::-webkit-scrollbar { width: 4px; }
#conversations-list::-webkit-scrollbar-thumb { background: #313244; border-radius: 2px; }

.conv-item {
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s;
  cursor: pointer;
}
.conv-item:hover { background: #1e1e38; }
.conv-item.active { background: #252540; }
.conv-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #a0a8c0;
  line-height: 1.4;
  font-size: 13px;
}
.conv-item.active .conv-label { color: #cdd6f4; }
.conv-delete, .conv-rename {
  flex-shrink: 0;
  appearance: none; -webkit-appearance: none;
  background: none; border: none; outline: none; box-shadow: none;
  color: #45475a;
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 4px;
  cursor: pointer; padding: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.conv-item:hover .conv-delete,
.conv-item:hover .conv-rename { opacity: 1; }
.conv-delete:hover { color: #f38ba8; background: #3a1a2a; }
.conv-rename:hover { color: #a78bfa; background: #1e1838; }

.conv-rename-input {
  flex: 1; min-width: 0;
  background: #252540;
  border: 1px solid #6c63ff;
  border-radius: 4px;
  color: #cdd6f4;
  font-size: 13px;
  padding: 2px 6px;
  outline: none;
}

#sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1e1e38;
  display: flex;
  align-items: center;
}
#logout-btn {
  width: 100%;
  height: 44px;
  background: transparent;
  border: 1px solid #252540;
  color: #6c7086;
  padding: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
#logout-btn:hover { background: #1e1e38; color: #cdd6f4; }

/* ── Main ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f7f7fb;
}

#chat-header {
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid #e8e8f0;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
#chat-header h2 {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}
#header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}


/* ── Messages ── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#messages::-webkit-scrollbar { width: 4px; }
#messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.message {
  display: flex;
  gap: 12px;
  padding: 6px 24px;
  max-width: 100%;
}
.message.user {
  justify-content: flex-end;
}
.message-content { display: flex; flex-direction: column; gap: 4px; }
.user .message-content { align-items: flex-end; }
.agent .message-content { align-items: flex-start; }
.message-time { font-size: 11px; color: #9ca3af; padding: 0 4px; }
.copy-btn {
  display: inline-flex; align-items: center;
  background: none; border: 1px solid #e2e2f0; padding: 3px 7px;
  color: #888; cursor: pointer; border-radius: 6px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  line-height: 1; font-size: 11px;
}
.copy-btn:hover { border-color: #6c63ff; color: #6c63ff; background: #f5f4ff; }
.copy-btn.copied { color: #22c55e; border-color: #22c55e; }
.message.agent {
  justify-content: flex-start;
  align-items: flex-start;
}

/* Praew avatar */
.agent-avatar {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
}

.bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.65;
  max-width: 720px;
}
.agent .bubble p,
.agent .bubble li {
  word-break: break-word;
  overflow-wrap: break-word;
}
.user .bubble {
  background: #6c63ff;
  color: #fff;
  border-bottom-right-radius: 4px;
  max-width: 560px;
  word-break: break-word;
  overflow-wrap: break-word;
}
.agent .bubble {
  background: #fff;
  border: 1px solid #ebebf5;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  white-space: normal;
}
.thinking { color: #999; font-style: italic; }
.error-bubble {
  background: #fff5f5;
  border-color: #fed7d7;
  color: #e53e3e;
}

/* ── Markdown in agent bubbles ── */
.agent .bubble p { margin-bottom: 8px; }
.agent .bubble p:last-child { margin-bottom: 0; }
.agent .bubble ul, .agent .bubble ol { padding-left: 20px; margin: 6px 0; }
.agent .bubble li { margin-bottom: 3px; }
.agent .bubble code {
  background: #f0f0f8; padding: 2px 6px; border-radius: 4px;
  font-family: monospace; font-size: 13px; color: #6c63ff;
}
.agent .bubble pre {
  background: #16162a; color: #cdd6f4; padding: 12px 14px;
  border-radius: 10px; margin: 10px 0; overflow-x: auto;
}
.agent .bubble pre code { background: none; color: inherit; padding: 0; font-size: 13px; }
.agent .bubble strong { font-weight: 600; }
.agent .bubble em { font-style: italic; }
.agent .bubble h1, .agent .bubble h2, .agent .bubble h3,
.agent .bubble h4, .agent .bubble h5, .agent .bubble h6 {
  font-weight: 600; margin: 12px 0 4px; color: #1a1a2e;
}
.agent .bubble h1 { font-size: 17px; }
.agent .bubble h2 { font-size: 16px; }
.agent .bubble h3 { font-size: 15px; }
.agent .bubble h4, .agent .bubble h5, .agent .bubble h6 { font-size: 14px; }
.agent .bubble:has(.md-table-wrap) {
  max-width: min(100%, 920px);
}
.agent .bubble .md-table-wrap {
  overflow-x: auto;
  margin: 10px 0;
  -webkit-overflow-scrolling: touch;
  word-break: normal;
}
.agent .bubble table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 13px;
  table-layout: fixed;
  word-break: normal;
}
.agent .bubble col.col-project-id { width: 118px; }
.agent .bubble col.col-flex { width: auto; }
.agent .bubble th, .agent .bubble td {
  border: 1px solid #e8e8f4;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  word-break: normal;
  overflow-wrap: break-word;
}
/* Project ID column — single line, fixed width */
.agent .bubble th.col-project-id,
.agent .bubble td.col-project-id {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  width: 118px;
  min-width: 118px;
  max-width: 118px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.agent .bubble th { background: #f4f4fc; font-weight: 600; color: #333; }
.agent .bubble tr:nth-child(even) td { background: #fafafe; }

/* ── Welcome screen ── */
#welcome-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 48px 32px 32px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
#welcome-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
#welcome-name {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
}
#welcome-sub {
  font-size: 13px;
  color: #999;
  margin-top: 2px;
}
#welcome-msg {
  font-size: 15px;
  line-height: 1.7;
  color: #444;
  background: #fff;
  border: 1px solid #ebebf5;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
#quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #ebebf5;
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  text-align: left;
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.qa-btn:hover {
  border-color: #6c63ff;
  background: #f5f4ff;
  color: #6c63ff;
  box-shadow: 0 4px 12px rgba(108,99,255,0.1);
  transform: translateY(-1px);
}
.qa-btn svg { flex-shrink: 0; }
.qa-purple { border-color: #e9e7ff; background: #f5f4ff; color: #6c63ff; }
.qa-purple:hover { border-color: #6c63ff; background: #ede9ff; color: #5a52d5; box-shadow: 0 4px 12px rgba(108,99,255,0.15); }
.qa-blue   { border-color: #dbeafe; background: #eff6ff; color: #2563eb; }
.qa-blue:hover   { border-color: #2563eb; background: #dbeafe; color: #1d4ed8; box-shadow: 0 4px 12px rgba(37,99,235,0.15); }
.qa-green  { border-color: #dcfce7; background: #f0fdf4; color: #16a34a; }
.qa-green:hover  { border-color: #16a34a; background: #dcfce7; color: #15803d; box-shadow: 0 4px 12px rgba(22,163,74,0.15); }
.qa-amber  { border-color: #fef3c7; background: #fffbeb; color: #d97706; }
.qa-amber:hover  { border-color: #d97706; background: #fef3c7; color: #b45309; box-shadow: 0 4px 12px rgba(217,119,6,0.15); }

/* ── Streaming cursor ── */
.cursor {
  display: inline-block;
  color: #6c63ff;
  animation: blink 0.8s step-end infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Inline footnote citations ── */
sup.cite {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1px 4px;
  background: #ede9ff; color: #6c63ff;
  border-radius: 4px; font-size: 11px; font-weight: 600;
  cursor: pointer; vertical-align: super; line-height: 1;
  margin: 0 1px; transition: background 0.15s;
  user-select: none; font-family: monospace;
  text-decoration: underline; text-underline-offset: 1px;
}
sup.cite:hover { background: #d8d1ff; }

/* ── Input ── */
#input-area {
  padding: 12px 24px 20px;
  background: #f7f7fb;
  flex-shrink: 0;
}
#input-box {
  background: #fff;
  border: 1px solid #e0e0f0;
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(108,99,255,0.06);
  display: flex;
  flex-direction: column;
  max-width: 800px;
  margin: 0 auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#input-box:focus-within {
  border-color: #6c63ff;
  box-shadow: 0 4px 20px rgba(108,99,255,0.14);
}
#question-input {
  flex: 1;
  border: none;
  border-radius: 18px 18px 0 0;
  padding: 16px 18px 8px;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 52px;
  max-height: 140px;
  overflow-y: auto;
  font-family: inherit;
  background: transparent;
  color: #1a1a1a;
}
#question-input::placeholder { color: #b0b0c0; }
#input-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 10px 10px;
  gap: 6px;
}
#send-btn {
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 12px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
#send-btn:hover { background: #5a52d5; transform: scale(1.05); }
#send-btn:disabled { background: #c8c4f0; cursor: not-allowed; transform: none; }

/* ── Model picker ── */
#model-picker {
  position: relative;
  flex-shrink: 0;
  user-select: none;
  margin-right: 4px;
}
#model-picker-display {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #e8e8f4;
  border-radius: 20px;
  background: #f7f7fb;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  transition: all 0.15s;
  white-space: nowrap;
}
#model-picker-display:hover,
#model-picker.open #model-picker-display {
  border-color: #6c63ff;
  background: #f0eeff;
  color: #6c63ff;
}
#model-picker-caret {
  color: #bbb;
  transition: transform 0.2s;
  flex-shrink: 0;
}
#model-picker.open #model-picker-caret { transform: rotate(180deg); color: #6c63ff; }

#model-picker-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 290px;
  background: #fff;
  border: 1px solid #ebebf5;
  border-radius: 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 8px 6px;
}
#model-picker.open #model-picker-dropdown { display: block; }

.model-group-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #bbb; padding: 8px 10px 4px;
}
.model-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  transition: background 0.1s;
}
.model-option:hover { background: #f5f4ff; }
.model-option.active { background: #ede9ff; }

.model-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.tier-fast     { background: #22c55e; }
.tier-balanced { background: #6c63ff; }
.tier-powerful { background: #f59e0b; }

.model-option-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.model-option-name {
  font-size: 13px; font-weight: 500; color: #1a1a1a;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.model-option-desc { font-size: 11px; color: #999; }
.model-badge {
  font-size: 10px; font-weight: 600; padding: 1px 6px;
  border-radius: 4px; background: #ede9ff; color: #6c63ff;
}
.model-badge-recommended { background: #ede9ff; color: #6c63ff; }
.model-badge-powerful    { background: #fff7ed; color: #d97706; }

/* ── Sources panel (collapsible under agent bubble) ── */
.sources-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 6px;
  max-width: 720px;
}
.sources-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid #e0e0f0;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sources-toggle svg {
  transition: transform 0.2s;
  flex-shrink: 0;
  color: #bbb;
}
.sources-toggle:hover { border-color: #6c63ff; color: #6c63ff; background: #f5f4ff; }
.sources-toggle:hover svg { color: #6c63ff; }
.sources-panel {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding: 6px;
  background: #fafafe;
  border: 1px solid #ebebf5;
  border-radius: 12px;
}
.sources-wrap.open .sources-panel { display: flex; }
.source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  width: 100%;
}
.source-item:hover { background: #ede9ff; }
.source-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #ede9ff;
  color: #6c63ff;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.source-name {
  font-size: 12px;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* dark mode */
body.dark .sources-toggle { border-color: #252545; color: #555577; }
body.dark .sources-toggle:hover { border-color: #6c63ff; color: #a78bfa; background: #1e1838; }
body.dark .sources-panel { background: #16162a; border-color: #252545; }
body.dark .source-item:hover { background: #1e1838; }
body.dark .source-num { background: #252545; color: #a78bfa; }
body.dark .source-name { color: #7070a0; }

/* ── Source modal ── */
#source-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.source-modal-box {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 520px; max-height: 70vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  overflow: hidden;
}
.source-modal-box--pdf {
  max-width: min(960px, 95vw);
  max-height: 88vh;
}
.source-modal-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f0f0f8;
  display: flex; flex-direction: column; gap: 3px;
  position: relative;
}
.source-modal-title { font-size: 14px; font-weight: 600; color: #1a1a1a; padding-right: 28px; }
.source-modal-sub   { font-size: 12px; color: #999; }
.source-modal-link  {
  display: inline-block; font-size: 12px; color: #6c63ff;
  text-decoration: none; margin-top: 4px;
}
.source-modal-link:hover { text-decoration: underline; }
.source-modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 20px; color: #bbb;
  cursor: pointer; line-height: 1; padding: 0;
}
.source-modal-close:hover { color: #555; }
.source-modal-body {
  padding: 16px 20px; font-size: 13px; line-height: 1.7;
  color: #444; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.source-modal-body.source-modal-pdf-wrap {
  flex: 1; min-height: 0; padding: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.source-modal-pdf {
  flex: 1; width: 100%; min-height: 480px;
  border: none; background: #f4f4f8;
}
.source-modal-loading {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 200px; color: #999; font-size: 13px;
}
.source-modal-fallback {
  padding: 16px 20px; font-size: 13px; line-height: 1.7;
  color: #444; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
body.dark .source-modal-box { background: #1e1e38; border: 1px solid #252545; }
body.dark .source-modal-title { color: #e8e8f0; }
body.dark .source-modal-sub { color: #7070a0; }
body.dark .source-modal-header { border-bottom-color: #252545; }
body.dark .source-modal-close { color: #7070a0; }
body.dark .source-modal-close:hover { color: #e8e8f0; }
body.dark .source-modal-body { color: #c0c0d8; }
body.dark .source-modal-fallback { color: #c0c0d8; }
body.dark .source-modal-pdf { background: #16162a; }

/* ── Auth pages ── */
.auth-page {
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: #16162a;
}
.auth-card {
  background: #1e1e38;
  border-radius: 20px; padding: 48px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  width: 320px;
  border: 1px solid #252545;
}
.auth-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(108,99,255,0.4);
}
.auth-card h1 { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.auth-card p  { color: #6c7086; font-size: 13px; margin-bottom: 28px; }
.auth-hint { display: block; color: #45475a; font-size: 12px; margin-top: 16px; }
.spinner {
  border: 3px solid #252545;
  border-top-color: #6c63ff;
  border-radius: 50%;
  width: 32px; height: 32px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Theme button ── */
#theme-btn, #export-btn {
  background: none; border: none;
  border-radius: 8px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #bbb; transition: color 0.2s, transform 0.2s; flex-shrink: 0;
}
#theme-btn:hover { color: #6c63ff; transform: rotate(15deg); }
#export-btn:hover { color: #6c63ff; transform: translateY(-1px); }

/* ── Dark mode ── */
body.dark { background: #0f0f1a; color: #cdd6f4; }
body.dark #main { background: #13131f; }
body.dark #chat-header { background: #1a1a2e; border-color: #252545; }
body.dark #chat-header h2 { color: #cdd6f4; }
body.dark #theme-btn, body.dark #export-btn { color: #555577; }
body.dark #theme-btn:hover, body.dark #export-btn:hover { color: #a78bfa; }

body.dark #messages { background: #13131f; }
body.dark .agent .bubble { background: #1a1a2e; border-color: #252545; color: #cdd6f4; }
body.dark .error-bubble { background: #2d1515; border-color: #6b2121; color: #fc8181; }
body.dark .copy-btn { color: #555577; border-color: #252545; }
body.dark .copy-btn:hover { color: #a78bfa; border-color: #6c63ff; background: #1e1838; }
body.dark .copy-btn.copied { color: #22c55e; border-color: #22c55e; }
body.dark .agent .bubble code { background: #252545; color: #a78bfa; }
body.dark .agent .bubble th { background: #1e1e38; color: #cdd6f4; }
body.dark .agent .bubble th, body.dark .agent .bubble td { border-color: #252545; }
body.dark .agent .bubble tr:nth-child(even) td { background: #16162a; }
body.dark .agent .bubble th.col-project-id,
body.dark .agent .bubble td.col-project-id { color: #a78bfa; }
body.dark .agent .bubble h1, body.dark .agent .bubble h2,
body.dark .agent .bubble h3, body.dark .agent .bubble h4 { color: #e0e0f4; }

body.dark #welcome-msg { background: #1a1a2e; border-color: #252545; color: #a0a8c0; }
body.dark #welcome-name { color: #e0e0f4; }
body.dark .qa-purple { background: #1e1838; border-color: #3d3470; color: #a78bfa; }
body.dark .qa-blue   { background: #0f1e38; border-color: #1e3a70; color: #60a5fa; }
body.dark .qa-green  { background: #0f2818; border-color: #1a4a28; color: #4ade80; }
body.dark .qa-amber  { background: #281e08; border-color: #4a3510; color: #fbbf24; }

body.dark #input-area { background: #13131f; }
body.dark #input-box { background: #1a1a2e; border-color: #252545; }
body.dark #input-box:focus-within { border-color: #6c63ff; }
body.dark #question-input { color: #cdd6f4; }
body.dark #question-input::placeholder { color: #444466; }
body.dark #model-picker-display { background: #252545; border-color: #313255; color: #7070a0; }
body.dark #model-picker-display:hover,
body.dark #model-picker.open #model-picker-display { background: #1e1838; border-color: #6c63ff; color: #a78bfa; }
body.dark #model-picker-dropdown { background: #1a1a2e; border-color: #252545; }
body.dark .model-option:hover { background: #1e1838; }
body.dark .model-option.active { background: #211d3a; }
body.dark .model-option-name { color: #cdd6f4; }
body.dark .model-option-desc { color: #555577; }
body.dark .model-group-label { color: #444466; }

/* ── Hamburger ── */
#hamburger {
  display: none; flex-direction: column; justify-content: space-between;
  width: 20px; height: 15px; background: none; border: none;
  cursor: pointer; padding: 0; flex-shrink: 0;
}
#hamburger span { display: block; height: 2px; background: #666; border-radius: 1px; }

/* ── Overlay ── */
#overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 99;
}
#overlay.visible { display: block; }

/* ── Mobile ── */
@media (max-width: 640px) {
  #hamburger { display: flex; }
  #sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0;
    z-index: 100; transition: left 0.25s ease;
  }
  #sidebar.open { left: 0; }
  .message { padding: 6px 14px; }
  #input-area { padding: 10px 14px 16px; }
}
