/* ============================================================
   Allmode.ai — Theme-aligned styles
   Colors matched to /frontend/styles/brands/allmode/theme.css
   ============================================================ */

:root {
  /* Light mode palette (default) — clean white theme */
  --bg-000: #ffffff;
  --bg-100: #ffffff;
  --bg-200: #f5f5f5;
  --bg-300: #fafafa;
  --bg-400: #ebebeb;
  --text-000: #1a1a1a;
  --text-100: #1a1a1a;
  --text-200: #333333;
  --text-300: #333333;
  --text-400: #888888;
  --border-100: #e5e5e5;
  --border-200: #d9d9d9;
  --border-300: #cccccc;
  --accent-main: #171513;
  --accent-bg: #171513;
}

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

html, body, #root {
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-000);
  background: var(--bg-200);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Loading ---- */
.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
  background: var(--bg-200);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-200);
  border-top-color: var(--text-000);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.app-loading p {
  color: var(--text-400);
  font-size: 13px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- App Layout ---- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: var(--bg-100);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-100);
  background: var(--bg-100);
  flex-shrink: 0;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  width: 28px;
  flex-shrink: 0;
  position: relative;
}

/* ── Hamburger button (left) ── */
.header-logo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.header-logo-btn:hover {
  background: var(--bg-200);
}

/* ── Sidebar overlay + panel ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 200;
  animation: sidebar-fade-in 0.2s ease;
}

@keyframes sidebar-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-000);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.sidebar.sidebar-open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-100);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-000);
  letter-spacing: -0.02em;
}

.sidebar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-400);
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-close-btn:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-section {
  padding: 4px 8px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-100);
  margin: 4px 16px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 13px;
  color: var(--text-300);
  user-select: none;
}

.sidebar-item:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.sidebar-item:hover svg:first-child {
  color: var(--text-200);
}

.sidebar-item > span {
  flex: 1;
  min-width: 0;
}

.sidebar-item svg:first-child {
  flex-shrink: 0;
  color: var(--text-400);
}

.sidebar-item-arrow {
  flex-shrink: 0;
  color: var(--text-400);
  margin-left: auto;
}

.sidebar-item-hint {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-400);
  white-space: nowrap;
  margin-left: auto;
}

/* Referral item gradient highlight */
.sidebar-item-referral {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(6, 182, 212, 0.06));
}

.sidebar-item-referral:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(6, 182, 212, 0.12));
}

/* Language floating dropdown — positioned via fixed in JSX */
.sidebar-lang-dropdown {
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  padding: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.sidebar-lang-dropdown::-webkit-scrollbar {
  width: 4px;
}

.sidebar-lang-dropdown::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.sidebar-lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-300);
  transition: background 0.15s, color 0.15s;
}

.sidebar-lang-item:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.sidebar-lang-item-active {
  color: var(--text-000);
  font-weight: 500;
  background: var(--bg-200);
}

.sidebar-lang-item-active svg {
  color: var(--accent-main);
}

/* Sign-out danger item */
.sidebar-item-danger {
  color: var(--text-400);
}

.sidebar-item-danger:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.06);
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border-100);
  padding: 8px;
  flex-shrink: 0;
}

/* ── Title dropdown ── */
.header-title-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.header-title-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  max-width: 200px;
  transition: background 0.15s;
}

.header-title-btn:hover {
  background: var(--bg-200);
}

.header-title-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-000);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-title-chevron {
  flex-shrink: 0;
  color: var(--text-400);
  transition: transform 0.2s;
}

.header-title-chevron-open {
  transform: rotate(180deg);
}

.header-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  max-height: 420px;
  background: var(--bg-000);
  border: 1px solid var(--border-200);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.header-dropdown-list {
  overflow-y: auto;
  max-height: 280px;
}

.header-dropdown-list::-webkit-scrollbar {
  width: 4px;
}

.header-dropdown-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.header-menu-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-400);
  text-align: center;
}

.header-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--text-100);
}

.header-menu-item:hover {
  background: var(--bg-200);
}

.header-menu-item-active {
  background: var(--bg-200);
}

.header-menu-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-menu-item-delete {
  display: none;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-400);
  border-radius: 4px;
  flex-shrink: 0;
}

.header-menu-item:hover .header-menu-item-delete {
  display: flex;
}

.header-menu-item-delete:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

.header-menu-divider {
  height: 1px;
  background: var(--border-100);
  margin: 4px 0;
}

.header-menu-item-danger {
  color: var(--text-400);
}

.header-menu-item-danger:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.06);
}

.panel-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-100);
}

/* ---- Login Panel ---- */
.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 24px;
  background: var(--bg-200);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--text-000);
  letter-spacing: -0.02em;
}

.login-header p {
  color: var(--text-400);
  font-size: 14px;
}

.login-card {
  width: 100%;
  max-width: 320px;
  background: var(--bg-000);
  border: 0.5px solid var(--border-100);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow:
    0 4px 24px rgba(0,0,0,0.06),
    0 2px 64px rgba(0,0,0,0.03);
}

.login-form {
  width: 100%;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-200);
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: var(--bg-000);
  border: 1px solid var(--border-100);
  border-radius: 10px;
  color: var(--text-000);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:hover {
  border-color: var(--border-200);
}

.form-input:focus {
  border-color: var(--border-300);
}

.form-input::placeholder {
  color: var(--text-400);
  font-size: 13px;
}

.password-field {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  padding: 0 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-400);
  display: flex;
  align-items: center;
}

.password-toggle:hover {
  color: var(--text-000);
}

.login-error {
  color: #ef4444;
  font-size: 12px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
}

.login-button {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  background: var(--accent-bg);
  color: var(--bg-000);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.165,0.85,0.45,1), opacity 0.15s;
  position: relative;
  overflow: hidden;
}

.login-button:hover {
  transform: scaleY(1.015) scaleX(1.005);
}

.login-button:active {
  transform: scale(0.985);
}

.login-button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.login-button-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-400);
}

.login-footer a {
  color: var(--text-200);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-footer a:hover {
  color: var(--text-000);
}

/* ---- Chat Panel ---- */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-100);
}

.chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 24px;
}

.chat-empty-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-000);
  letter-spacing: -0.01em;
}

.chat-empty-desc {
  font-size: 13px;
  color: var(--text-400);
  line-height: 1.6;
}

/* ---- Message Bubbles ---- */
.message-row {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* User message — right-aligned like web /chat */
.message-row.message-user {
  align-items: flex-end;
}

.message-user-bubble {
  display: inline-block;
  background: var(--bg-200);
  border-radius: 12px;
  padding: 10px 16px;
  max-width: 95%;
}

.message-user-text {
  font-size: 0.9375rem;
  line-height: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--text-000);
  word-break: break-word;
  white-space: pre-wrap;
}

/* Assistant message — matches ai-conversation.tsx */
.message-row.message-assistant {
  align-items: flex-start;
}

.message-assistant-content {
  position: relative;
  letter-spacing: -0.015em;
  padding-bottom: 4px;
  padding-left: 2px;
  padding-right: 2px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.message-assistant-content .message-content {
  font-size: 0.9375rem;
  line-height: 1.65rem;
  color: var(--text-000);
}

/* ---- Markdown content ---- */
.message-content {
  overflow-x: auto;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.message-content p {
  margin: 0 0 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content pre {
  background: var(--bg-200);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  margin: 8px 0;
  border: 1px solid var(--border-100);
  max-width: 100%;
  box-sizing: border-box;
}

.message-content code {
  background: var(--bg-200);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  color: var(--text-200);
}

.message-content pre code {
  background: none;
  padding: 0;
  color: var(--text-100);
  white-space: pre-wrap;
  word-break: break-all;
}

.message-content table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
  width: 100%;
  display: block;
  overflow-x: auto;
}

.message-content th,
.message-content td {
  border: 1px solid var(--border-200);
  padding: 6px 10px;
  text-align: left;
}

.message-content th {
  background: var(--bg-300);
  font-weight: 600;
  color: var(--text-200);
}

.message-content ul,
.message-content ol {
  padding-left: 20px;
  margin: 6px 0;
}

.message-content li {
  margin-bottom: 4px;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
  color: var(--text-000);
  margin: 12px 0 6px;
  font-weight: 600;
}

.message-content h1 { font-size: 1.25rem; }
.message-content h2 { font-size: 1.125rem; }
.message-content h3 { font-size: 1rem; }

.message-content blockquote {
  border-left: 3px solid var(--border-200);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-300);
}

.message-content strong {
  color: var(--text-000);
  font-weight: 600;
}

.message-content a {
  color: var(--text-200);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  color: var(--text-000);
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border-100);
  margin: 12px 0;
}

/* Images in user message */
.message-images {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.message-image-preview {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-100);
}

/* Attachment in user message */
.message-attachment {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  border: 1px solid var(--border-100);
}

.attachment-label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-400);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.attachment-preview {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 11px;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
  color: var(--text-300);
}

/* VibingLoader — pulse dots + text + timer (during streaming, matches web) */
.vibing-loader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px 4px;
  color: var(--text-400);
}

.vibing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.vibing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-main);
  animation: vibing-pulse 1.4s ease-in-out infinite;
}

.vibing-dot:nth-child(1) { animation-delay: -0.32s; }
.vibing-dot:nth-child(2) { animation-delay: -0.16s; }
.vibing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes vibing-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.vibing-text {
  font-size: 13px;
  font-weight: 500;
}

.vibing-time {
  font-size: 11px;
  color: var(--text-400);
  opacity: 0.7;
}

/* ---- Attachment Bar ---- */
.attachment-bar {
  display: flex;
  align-items: center;
  padding: 0 14px 6px;
  flex-shrink: 0;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-100);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-200);
  position: relative;
  max-width: 100%;
}

.attachment-pill:hover .attachment-remove {
  opacity: 1;
  pointer-events: auto;
}

.attachment-pill svg {
  flex-shrink: 0;
  color: var(--text-400);
}

.attachment-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-400);
  padding: 2px;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.attachment-remove:hover {
  color: #ef4444;
}

/* ---- Chat Input Area — matches web ai-chat.tsx sidebar mode ---- */
.chat-input-area {
  flex-shrink: 0;
  padding: 0 12px 12px 12px;
}

/* Outer wrapper: shows border normally, gradient border on focus */
.chat-input-box {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border-200);
  transition: all 0.2s;
}

.chat-input-box:focus-within {
  border-color: transparent;
  padding: 2px;
  background: linear-gradient(to right, rgb(59, 130, 246) 0%, rgb(147, 197, 253) 50%, rgb(59, 130, 246) 100%);
  background-size: 200% auto;
}

/* Inner container: covers the gradient, leaving it visible as a border */
.chat-input-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--bg-100);
  border-radius: 10px;
}

.chat-input-box:not(:focus-within) .chat-input-inner {
  border-radius: 11px;
}

.chat-textarea {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-000);
  font-size: 14px;
  line-height: 1.5rem;
  letter-spacing: -0.025em;
  font-family: inherit;
  padding: 8px;
}

.chat-textarea::placeholder {
  color: var(--text-400);
  font-size: 13px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-400);
  cursor: pointer;
  transition: all 0.15s;
}

.chat-action-btn:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.chat-action-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Send button — square icon button matching web light mode (bg-black text-white) */
.chat-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: none;
  background: var(--accent-main);
  color: var(--bg-000);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.chat-send-btn:hover {
  opacity: 0.9;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Stop/loading button — same square size, with breathing animation */
.chat-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-300);
  background: transparent;
  color: var(--text-200);
  cursor: pointer;
  transition: all 0.15s;
}

.chat-stop-btn:hover {
  background: var(--bg-200);
}

/* ---- Uploaded Image Previews ---- */
.uploaded-images-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.uploaded-image-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-100);
}

.uploaded-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uploaded-image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.uploaded-image-thumb:hover .uploaded-image-remove {
  opacity: 1;
}

/* ---- Model Selector ---- */
.model-selector-wrapper {
  position: relative;
}

.model-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: contain;
}

.model-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-400);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.model-selector-btn:hover {
  color: var(--text-000);
  background: var(--bg-200);
}

.model-selector-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.model-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  min-width: 240px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-000);
  border: 1px solid var(--border-100);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  z-index: 100;
}

.model-menu::-webkit-scrollbar {
  width: 4px;
}

.model-menu::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.model-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-300);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.model-menu-item:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

.model-menu-item.active {
  color: var(--text-000);
}

.model-menu-item.active svg {
  color: var(--accent-main);
}

.model-menu-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.model-menu-item-name .model-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.model-menu-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}

.model-price-multiplier {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-400);
}

.model-recommended-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #fff;
  flex-shrink: 0;
}

/* Breathing animation — matches web ai-breathing */
@keyframes ai-breathing {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.ai-breathing {
  animation: ai-breathing 2s ease-in-out infinite;
}

/* ---- Quick Actions (empty state) ---- */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.chat-quick-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-200);
  background: transparent;
  color: var(--text-200);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.chat-quick-btn:hover {
  background: var(--bg-200);
  border-color: var(--border-300);
  color: var(--text-000);
}

/* ---- Content Blocks (interleaved text + tools) ---- */
.content-blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---- Tool Call Display ---- */
.tool-call-block {
  margin: 4px 0;
}

.tool-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 20px;
  background: var(--bg-100);
  border: 1px solid var(--border-100);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  transition: background 0.15s;
}

.tool-call-pill.tool-expandable {
  cursor: pointer;
}

.tool-call-pill.tool-expandable:hover {
  background: var(--bg-200);
}

.tool-call-block.tool-success .tool-call-icon {
  color: #22c55e;
}

.tool-call-block.tool-error .tool-call-icon {
  color: #ef4444;
}

.tool-call-block.tool-pending .tool-call-icon {
  color: var(--text-400);
}

.tool-call-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.tool-call-label {
  font-weight: 600;
  color: var(--text-200);
  white-space: nowrap;
}

.tool-call-summary {
  color: var(--text-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.tool-call-chevron {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-400);
  margin-left: auto;
}

/* ---- Tool Expanded Details ---- */
.tool-call-details {
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-100);
  background: var(--bg-100);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-detail-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-detail-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tool-detail-code {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-300);
  background: var(--bg-100);
  border-radius: 8px;
  padding: 8px;
  margin: 0;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---- Search Results in Expanded Tool ---- */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-200);
}

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-200);
  line-height: 1.3;
  margin-bottom: 2px;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-400);
  margin-bottom: 2px;
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-300);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-link {
  font-size: 11px;
  color: var(--text-400);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Web Fetch Preview ---- */
.web-fetch-preview {
  padding: 10px 12px;
}

.web-fetch-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-100);
  margin-bottom: 4px;
}

.web-fetch-url {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.web-fetch-url:hover {
  text-decoration: underline;
}

.web-fetch-meta {
  font-size: 11px;
  color: var(--text-400);
  margin-bottom: 8px;
}

.web-fetch-content {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-200);
  background: var(--bg-200);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

/* ---- Message Actions (hover) ---- */
.message-actions-bar {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  justify-content: flex-end;
  height: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.message-actions-bar.message-actions-visible {
  opacity: 1;
  pointer-events: auto;
}

.message-actions-bar.message-actions-left {
  justify-content: flex-start;
}

.message-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 0.5px solid var(--border-100);
  background: var(--bg-000);
  color: var(--text-300);
  cursor: pointer;
  transition: all 0.15s;
}

.message-action-btn:hover {
  background: var(--bg-200);
  color: var(--text-000);
}

/* AI disclaimer */
.message-disclaimer {
  margin-top: 4px;
  font-size: 0.6875rem;
  line-height: 0.875rem;
  color: var(--text-400);
  text-align: right;
  letter-spacing: -0.01em;
  user-select: none;
}

/* User message edit */
.message-edit-area {
  width: 100%;
  max-width: 95%;
}

.message-edit-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-200);
  background: var(--bg-200);
  color: var(--text-000);
  font-size: 0.9375rem;
  line-height: 1.5rem;
  resize: none;
  font-family: inherit;
}

.message-edit-textarea:focus {
  outline: none;
  border-color: var(--border-300);
}

.message-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.message-edit-cancel,
.message-edit-save {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.message-edit-cancel {
  background: var(--bg-200);
  color: var(--text-200);
  border: 1px solid var(--border-200);
}

.message-edit-cancel:hover {
  background: var(--bg-300);
}

.message-edit-save {
  background: var(--accent-main);
  color: #fff;
}

.message-edit-save:hover {
  opacity: 0.9;
}

/* ---- Messages inner container ---- */
.chat-messages-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  padding: 0 4px;
  min-width: 0;
  flex: 1;
}

/* ---- Scrollbar — light theme ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ---- Fluent UI overrides for light theme ---- */
.fui-FluentProvider {
  background: transparent !important;
}

.fui-Input {
  background: var(--bg-000) !important;
  border-color: var(--border-100) !important;
  color: var(--text-000) !important;
}

.fui-Textarea {
  background: transparent !important;
  border: none !important;
  color: var(--text-000) !important;
}

.fui-Textarea::after {
  display: none !important;
}

.fui-Tab {
  color: var(--text-400) !important;
}

.fui-Tab:hover {
  color: var(--text-200) !important;
}

.fui-Tab[aria-selected="true"] {
  color: var(--text-000) !important;
}

.fui-Button--primary {
  background: var(--accent-main) !important;
  color: var(--bg-300) !important;
  border: none !important;
}

.fui-Button--subtle {
  color: var(--text-300) !important;
}

.fui-Button--subtle:hover {
  background: var(--bg-200) !important;
  color: var(--text-200) !important;
}

.fui-Card {
  background: var(--bg-200) !important;
  border-color: var(--border-100) !important;
}

.fui-Label {
  color: var(--text-200) !important;
}

.fui-Badge {
  color: var(--text-200) !important;
}

