/* ═══════════════════════════════════
   style.css — Desktop layout & components
   ═══════════════════════════════════ */

/* ─── APP LAYOUT ─── */
body { display: flex; height: 100vh; }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ─── SIDEBAR ─── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#new-chat-btn {
  background: var(--accent-dim);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--accent);
  border-radius: var(--radius-sm);
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
#new-chat-btn:hover { background: rgba(56, 189, 248, 0.22); box-shadow: var(--accent-glow); }

/* Active profile bar */
.sidebar-profile-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
  min-height: 38px;
}
.active-profile-info {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
.profile-active-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
}
.profile-active-text {
  display: flex; flex-direction: column; min-width: 0;
}
#sidebar-profile-name {
  font-size: 12px; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-active-model {
  font-size: 10px; color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-switch-btn {
  background: transparent; border: 1px solid var(--border-mid);
  color: var(--text-3); border-radius: var(--radius-sm);
  padding: 3px 8px; cursor: pointer; font-size: 14px;
  transition: all 0.15s; flex-shrink: 0;
}
.profile-switch-btn:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-bright); }

/* Conversation list */
#conversation-list {
  flex: 1; overflow-y: auto; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}

.conv-item {
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
  display: flex; align-items: center; gap: 8px;
  position: relative; border: 1px solid transparent;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active {
  background: var(--bg-3); border-color: var(--border-mid);
}
.conv-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; height: 60%;
  width: 2px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.conv-icon { font-size: 14px; opacity: 0.5; flex-shrink: 0; }
.conv-item.active .conv-icon { opacity: 1; }
.conv-info { flex: 1; min-width: 0; }
.conv-title {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-2);
}
.conv-item.active .conv-title { color: var(--text-1); }
.conv-meta { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.conv-delete {
  opacity: 0; background: none; border: none; color: var(--text-3);
  cursor: pointer; padding: 3px 5px; border-radius: 4px; font-size: 11px;
  transition: all 0.15s; flex-shrink: 0;
}
.conv-item:hover .conv-delete { opacity: 1; }
.conv-delete:hover { background: var(--danger-dim); color: var(--danger); }

.sidebar-footer {
  padding: 8px; border-top: 1px solid var(--border);
  display: flex; gap: 6px;
}
.sidebar-footer-btn {
  flex: 1; background: transparent; border: 1px solid var(--border-mid);
  color: var(--text-2); border-radius: var(--radius-sm);
  padding: 7px 8px; cursor: pointer;
  font-family: var(--font-ui); font-size: 12px;
  transition: all 0.15s; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.sidebar-footer-btn:hover { background: var(--bg-hover); border-color: var(--border-bright); color: var(--text-1); }

/* ─── MAIN AREA ─── */
#main {
  flex: 1; display: flex; flex-direction: column;
  height: 100vh; overflow: hidden; background: var(--bg-0);
  min-width: 0;
}

/* ─── CHAT HEADER ─── */
#chat-header {
  height: var(--header-h); min-height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 14px; gap: 10px;
  background: var(--bg-1); flex-shrink: 0;
}

#menu-btn {
  display: none; /* hidden on desktop */
  background: none; border: none; color: var(--text-2);
  font-size: 18px; cursor: pointer; padding: 6px;
  border-radius: var(--radius-sm); transition: all 0.15s;
}
#menu-btn:hover { background: var(--bg-hover); color: var(--text-1); }

#chat-title {
  flex: 1; font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-1);
}

/* Version selector */
#version-selector-wrap { position: relative; }
#version-btn {
  background: var(--bg-3); border: 1px solid var(--border-mid);
  color: var(--text-2); border-radius: var(--radius-sm);
  padding: 4px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
#version-btn:hover { border-color: var(--border-bright); color: var(--text-1); }
.ver-prefix { font-size: 9px; color: var(--text-3); }
#ver-label-text { color: var(--accent); font-weight: 500; }
.ver-arrow { font-size: 9px; color: var(--text-3); }

#version-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-2); border: 1px solid var(--border-mid);
  border-radius: var(--radius); min-width: 240px; max-height: 300px;
  overflow-y: auto; z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); display: none;
}
#version-dropdown.open { display: block; }
.ver-item {
  padding: 8px 12px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: background 0.12s; border-bottom: 1px solid var(--border);
}
.ver-item:last-child { border-bottom: none; }
.ver-item:hover { background: var(--bg-hover); }
.ver-item.active { background: var(--accent-dim); }
.ver-label { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 500; min-width: 44px; }
.ver-info { flex: 1; }
.ver-info strong { display: block; font-size: 12px; color: var(--text-2); }
.ver-info span { font-size: 10px; color: var(--text-3); }

.header-icon-btn {
  background: transparent; border: 1px solid var(--border-mid);
  color: var(--text-2); width: 30px; height: 30px;
  border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all 0.15s; flex-shrink: 0;
}
.header-icon-btn:hover { background: var(--bg-hover); border-color: var(--border-bright); color: var(--text-1); }

/* ─── MESSAGES ─── */
#messages-container {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: var(--text-3); padding: 40px;
}
.empty-icon { font-size: 40px; opacity: 0.3; }
.empty-state p { font-size: 13px; }

.msg-wrapper { display: flex; flex-direction: column; animation: fadeUp 0.2s ease; }
.msg-wrapper:hover .msg-actions { opacity: 1; }

.msg-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 5px; padding: 0 2px;
}

.role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px;
}
.role-badge.user      { background: var(--user-bg); color: var(--user-color); border: 1px solid rgba(96,165,250,0.2); }
.role-badge.assistant { background: var(--ai-bg);   color: var(--ai-color);   border: 1px solid rgba(52,211,153,0.2); }
.role-badge.system    { background: var(--sys-bg);  color: var(--sys-color);  border: 1px solid rgba(244,114,182,0.2); }

.msg-timestamp { font-size: 10px; color: var(--text-3); flex: 1; }

.msg-actions {
  display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s;
}
.msg-action-btn {
  background: var(--bg-3); border: 1px solid var(--border-mid);
  color: var(--text-3); border-radius: 5px;
  padding: 3px 8px; cursor: pointer;
  font-size: 11px; font-family: var(--font-ui);
  transition: all 0.15s; display: flex; align-items: center; gap: 4px;
}
.msg-action-btn:hover           { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-bright); }
.msg-action-btn.regen:hover     { background: var(--ai-bg);   color: var(--ai-color); border-color: rgba(52,211,153,0.3); }
.msg-action-btn.danger:hover    { background: var(--danger-dim); color: var(--danger); border-color: rgba(248,113,113,0.3); }

.msg-body {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  color: var(--text-1); line-height: 1.75; word-break: break-word;
}
.msg-wrapper.user      .msg-body { border-left: 2px solid var(--user-color); }
.msg-wrapper.assistant .msg-body { border-left: 2px solid var(--ai-color); }
.msg-wrapper.system    .msg-body { border-left: 2px solid var(--sys-color); font-style: italic; }

.msg-body.streaming::after {
  content: '▋'; color: var(--ai-color); margin-left: 2px;
  animation: blink 0.7s step-end infinite;
}

/* ─── THINKING / REASONING BLOCK ─── */
.thinking-block {
  margin-bottom: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.thinking-block[open] {
  background: var(--bg-0);
}
.thinking-summary {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  user-select: none;
  transition: color 0.15s;
  list-style: none;
}
.thinking-summary::-webkit-details-marker {
  display: none;
}
.thinking-summary:hover {
  color: var(--violet);
}
.thinking-icon {
  font-size: 13px;
}
.thinking-indicator::after {
  content: '';
  font-size: 10px;
  color: var(--text-3);
}
.thinking-block:not([open]) .thinking-indicator::after {
  content: '(已折叠)';
}
.thinking-content {
  padding: 0 12px 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin: 0 12px;
}
.thinking-content p {
  margin: 4px 0;
}
.thinking-content code.inline-code {
  font-size: 11px;
}

/* ─── MARKDOWN CONTENT ─── */
.msg-body h1, .msg-body h2, .msg-body h3 { margin: 12px 0 6px; font-weight: 600; }
.msg-body h1 { font-size: 17px; }
.msg-body h2 { font-size: 15px; }
.msg-body h3 { font-size: 14px; color: var(--text-2); }
.msg-body p  { margin: 6px 0; }
.msg-body p:first-child { margin-top: 0; }
.msg-body p:last-child  { margin-bottom: 0; }
.msg-body ul, .msg-body ol { padding-left: 20px; margin: 6px 0; }
.msg-body li  { margin: 2px 0; }
.msg-body blockquote { border-left: 3px solid var(--border-bright); padding-left: 12px; color: var(--text-2); margin: 8px 0; font-style: italic; }
.msg-body a   { color: var(--accent); text-decoration: none; }
.msg-body a:hover { text-decoration: underline; }
.msg-body strong { color: var(--text-1); font-weight: 600; }
.msg-body em { color: var(--text-2); }
.msg-body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.msg-body th, .msg-body td { border: 1px solid var(--border-mid); padding: 5px 10px; text-align: left; }
.msg-body th { background: var(--bg-3); font-weight: 600; color: var(--text-2); }
.msg-body tr:hover td { background: var(--bg-hover); }

.inline-code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--bg-3); border: 1px solid var(--border-mid);
  border-radius: 4px; padding: 1px 5px; color: var(--accent);
}
.code-block {
  background: var(--bg-0); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); margin: 8px 0; overflow: hidden;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 12px; border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.code-lang { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); text-transform: uppercase; }
.code-copy-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 11px; padding: 2px 6px;
  border-radius: 4px; transition: all 0.15s; font-family: var(--font-ui);
}
.code-copy-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.code-block code {
  display: block; padding: 12px 14px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65;
  color: var(--text-1); overflow-x: auto; white-space: pre;
}
/* Syntax tokens */
.tok-kw  { color: #c084fc; }
.tok-str { color: #86efac; }
.tok-num { color: #fbbf24; }
.tok-cmt { color: var(--text-3); font-style: italic; }
.tok-fn  { color: #67e8f9; }

/* ─── INPUT AREA ─── */
#input-area {
  border-top: 1px solid var(--border);
  background: var(--bg-1); padding: 12px 14px;
  flex-shrink: 0;
}
.input-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--border-mid);
  border-radius: var(--radius); padding: 10px 12px;
  transition: border-color 0.2s;
}
.input-box:focus-within { border-color: var(--accent); }
#message-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-1); font-family: var(--font-ui); font-size: 14px;
  resize: none; line-height: 1.6; max-height: 200px; min-height: 22px;
}
#message-input::placeholder { color: var(--text-3); }
.input-btns { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-end; }
#send-btn {
  background: var(--accent); border: none;
  border-radius: var(--radius-sm); width: 34px; height: 34px;
  cursor: pointer; color: var(--bg-0);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; font-size: 14px;
}
#send-btn:hover { background: #7dd3fc; box-shadow: var(--accent-glow); }
#send-btn:disabled { background: var(--bg-3); color: var(--text-3); cursor: not-allowed; box-shadow: none; }
#stop-btn {
  display: none; background: var(--danger-dim);
  border: 1px solid rgba(248,113,113,0.3); border-radius: var(--radius-sm);
  padding: 0 12px; height: 34px; cursor: pointer; color: var(--danger);
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  align-items: center; gap: 5px; transition: all 0.15s;
}
#stop-btn.visible { display: flex; }
#stop-btn:hover { background: rgba(248,113,113,0.2); }
.input-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 7px; padding: 0 2px;
}
.input-hint { font-size: 11px; color: var(--text-3); }
.api-status-indicator { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.status-dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--text-3);
}
.status-dot.ok  { background: var(--success); }
.status-dot.err { background: var(--danger); }
.status-dot.loading { background: var(--warning); animation: blink 0.8s infinite; }
#api-status-label { font-family: var(--font-mono); font-size: 11px; }

/* ─── MODAL SYSTEM ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-2); border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg); box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  width: 560px; max-width: 95vw; max-height: 88vh;
  display: flex; flex-direction: column;
  transform: translateY(14px); transition: transform 0.22s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { width: 680px; }
.modal-header {
  display: flex; align-items: center;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border); gap: 10px;
}
.modal-title { font-size: 15px; font-weight: 600; flex: 1; }
.modal-close {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 16px; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-1); }
.modal-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ─── TABS ─── */
.tabs {
  display: flex; gap: 2px; margin-bottom: 18px;
  background: var(--bg-1); padding: 4px; border-radius: var(--radius-sm);
}
.tab-btn {
  flex: 1; background: none; border: none; color: var(--text-2);
  cursor: pointer; padding: 7px 10px; border-radius: 5px;
  font-size: 12px; font-weight: 500; font-family: var(--font-ui);
  transition: all 0.15s;
}
.tab-btn.active { background: var(--bg-3); color: var(--text-1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-hint { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.form-label-hint { font-size: 10px; font-weight: 400; color: var(--text-3); text-transform: none; letter-spacing: 0; }
.form-input {
  width: 100%; background: var(--bg-1); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 9px 11px;
  color: var(--text-1); font-family: var(--font-ui); font-size: 13px;
  outline: none; transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--accent); }
.form-input.mono { font-family: var(--font-mono); font-size: 12px; }
.form-textarea { min-height: 80px; resize: vertical; }
.field-hint { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.form-check-label { font-size: 13px; color: var(--text-2); }

/* Slider */
.slider-row { display: flex; align-items: center; gap: 10px; }
.form-slider {
  flex: 1; -webkit-appearance: none; height: 4px;
  border-radius: 2px; background: var(--bg-3); outline: none; cursor: pointer;
}
.form-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); cursor: pointer; transition: box-shadow 0.15s;
}
.form-slider::-webkit-slider-thumb:hover { box-shadow: 0 0 0 4px var(--accent-dim); }
.slider-value {
  width: 46px; background: var(--bg-1); border: 1px solid var(--border-mid);
  border-radius: 5px; padding: 4px 6px; text-align: center;
  font-size: 12px; font-family: var(--font-mono); color: var(--text-2); outline: none;
}

/* Combobox */
.combobox-wrap { position: relative; }
.suggestions-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-2); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); z-index: 50; max-height: 220px;
  overflow-y: auto; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.suggestions-list.open { display: block; }
.suggestion-item {
  padding: 7px 12px; cursor: pointer; font-size: 12px;
  font-family: var(--font-mono); color: var(--text-2);
  transition: background 0.1s; display: flex; align-items: center; gap: 10px;
}
.suggestion-item:hover { background: var(--bg-hover); color: var(--text-1); }
.suggestion-provider {
  font-size: 9px; color: var(--text-3); background: var(--bg-3);
  padding: 2px 5px; border-radius: 3px; font-family: var(--font-ui); flex-shrink: 0;
}

/* ─── BUTTONS ─── */
.btn {
  background: none; border: 1px solid var(--border-mid); color: var(--text-2);
  border-radius: var(--radius-sm); padding: 8px 16px; cursor: pointer;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-bright); color: var(--text-1); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg-0); }
.btn-primary:hover { background: #7dd3fc; border-color: #7dd3fc; color: var(--bg-0); box-shadow: var(--accent-glow); }
.btn-danger { color: var(--danger); border-color: rgba(248,113,113,0.3); }
.btn-danger:hover { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); color: var(--bg-0); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ─── PROFILE LIST ─── */
.profile-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 6px;
  transition: all 0.15s; cursor: default;
  background: var(--bg-1);
}
.profile-item.active-profile {
  border-color: rgba(56,189,248,0.35); background: var(--accent-dim);
}
.profile-active-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--border-bright); flex-shrink: 0; }
.profile-item.active-profile .profile-active-indicator { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.profile-details { flex: 1; min-width: 0; }
.profile-item-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.profile-item-meta { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-actions { display: flex; gap: 6px; flex-shrink: 0; }
.profile-action-btn {
  background: none; border: 1px solid var(--border-mid); color: var(--text-3);
  border-radius: var(--radius-sm); padding: 4px 10px; cursor: pointer;
  font-size: 11px; font-family: var(--font-ui); transition: all 0.15s;
}
.profile-action-btn:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-bright); }
.profile-action-btn.switch-btn:hover { color: var(--accent); border-color: rgba(56,189,248,0.4); background: var(--accent-dim); }
.profile-action-btn.danger-btn:hover { color: var(--danger); border-color: rgba(248,113,113,0.3); background: var(--danger-dim); }

/* ─── ROLE SELECTOR ─── */
.role-selector { display: flex; gap: 8px; }
.role-option { flex: 1; }
.role-option input { display: none; }
.role-option label {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px; border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; font-weight: 500; transition: all 0.15s; color: var(--text-2);
}
.role-option input:checked + label.user-lbl { background: var(--user-bg); color: var(--user-color); border-color: rgba(96,165,250,0.3); }
.role-option input:checked + label.ai-lbl   { background: var(--ai-bg);   color: var(--ai-color);   border-color: rgba(52,211,153,0.3); }
.role-option input:checked + label.sys-lbl  { background: var(--sys-bg);  color: var(--sys-color);  border-color: rgba(244,114,182,0.3); }

/* ─── MISC COMPONENTS ─── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.section-title { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 10px; }
.info-grid { display: flex; flex-direction: column; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-key { font-size: 12px; color: var(--text-2); }
.info-val { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); }
.danger-zone { border: 1px solid rgba(248,113,113,0.2); border-radius: var(--radius); padding: 14px; background: rgba(248,113,113,0.04); margin-top: 4px; }
.danger-zone-title { font-size: 12px; font-weight: 600; color: var(--danger); margin-bottom: 10px; }

/* Edit mode hints */
.edit-mode-hint { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.hint-item { font-size: 12px; color: var(--text-2); display: flex; align-items: flex-start; gap: 8px; }
.hint-tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.hint-tag.accent  { background: var(--accent-dim); color: var(--accent); }
.hint-tag.success { background: var(--ai-bg); color: var(--ai-color); }

/* Toast */
#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-3); border: 1px solid var(--border-bright);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: 13px; color: var(--text-1); z-index: 1000;
  display: none; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); animation: slideIn 0.2s ease;
  max-width: 320px;
}
#toast.show { display: flex; }
#toast.success { border-left: 3px solid var(--success); }
#toast.error   { border-left: 3px solid var(--danger); }
#toast.info    { border-left: 3px solid var(--accent); }

/* ─── THEME TOGGLE ─── */
.theme-toggle-btn {
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.theme-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
  color: var(--text-1);
}

/* ─── Light theme overrides ─── */
[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .modal {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.10);
}
[data-theme="light"] #version-dropdown {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] #toast {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .suggestions-list {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] #sidebar-overlay {
  background: rgba(0, 0, 0, 0.2);
}
[data-theme="light"] .btn-primary {
  color: #fff;
}
[data-theme="light"] .btn-primary:hover {
  color: #fff;
}
[data-theme="light"] #send-btn {
  color: #fff;
}
[data-theme="light"] #send-btn:hover {
  background: #0284c7;
  color: #fff;
}
[data-theme="light"] .btn-success {
  color: #fff;
}
[data-theme="light"] .logo {
  -webkit-text-fill-color: var(--accent);
  background: none;
}
[data-theme="light"] .empty-icon {
  opacity: 0.5;
}
[data-theme="light"] .msg-body.streaming::after {
  color: var(--accent);
}
