/* ==========================================================================
   Spac2 AI – Minimalist Pure Dark & #282828 Monochrome Design
   No colored glows, no rainbow gradients, pure SVG icon controls
   ========================================================================== */

:root {
  /* Core Minimalist Dark Palette */
  --bg-app: #181818;
  --bg-sidebar: #1e1e1e;
  --bg-surface: #282828;
  --bg-surface-elevated: #303030;
  --bg-surface-hover: #383838;
  --bg-input: #282828;
  --bg-bubble-user: #2d2d2d;
  --bg-bubble-ai: #212121;
  --bg-code: #171717;

  /* Crisp Neutral Borders */
  --border-subtle: #333333;
  --border-card: #383838;
  --border-strong: #484848;
  --border-focus: #707070;

  /* Typography Colors */
  --text-main: #f5f5f5;
  --text-secondary: #c4c4c4;
  --text-muted: #8e8e8e;
  --text-dim: #606060;
  --text-inverse: #121212;

  /* Geometry & Layout */
  --sidebar-w: 260px;
  --header-h: 56px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  --transition-fast: 0.15s ease;
  --transition-smooth: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-app);
  display: flex;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Minimalist Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #383838;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #4a4a4a;
}

/* Shell Layout */
.app-shell {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* -------------------------------------------------------------
   1. SIDEBAR - Minimalist Navigation
   ------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-smooth);
  z-index: 30;
  user-select: none;
}

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

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.brand-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.btn-icon-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon-ghost:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

/* Action: New Chat (SVG Only / Minimal) */
.sidebar-actions {
  padding: 12px 14px;
  display: flex;
  gap: 8px;
}

.btn-new-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-new-chat:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}

.btn-new-chat svg {
  width: 16px;
  height: 16px;
}

/* Search Input */
.sidebar-search-box {
  padding: 0 14px 10px;
  position: relative;
}

.sidebar-search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px 7px 30px;
  color: var(--text-main);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.sidebar-search-input:focus {
  border-color: var(--border-focus);
}

.sidebar-search-icon {
  position: absolute;
  left: 23px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  width: 13px;
  height: 13px;
}

/* History List */
.sidebar-history {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.84rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.history-item.active {
  background: var(--bg-surface);
  color: #ffffff;
  border: 1px solid var(--border-card);
  font-weight: 500;
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
}

.history-item-icon {
  color: var(--text-dim);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.history-item.active .history-item-icon {
  color: #ffffff;
}

.history-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-actions {
  display: none;
  align-items: center;
  gap: 2px;
}

.history-item:hover .history-item-actions {
  display: flex;
}

.history-action-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.history-action-btn:hover {
  color: #ffffff;
}

.empty-history-text {
  padding: 24px 10px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Sidebar Footer (SVG Only Buttons) */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
}

.footer-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.footer-icon-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-card);
  color: var(--text-main);
}

/* -------------------------------------------------------------
   2. MAIN CHAT WORKSPACE (#282828 Minimalist)
   ------------------------------------------------------------- */
.chat-workspace {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg-app);
}

/* Workspace Header */
.chat-header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 20;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-trigger {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
}

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

.model-pill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.model-pill-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}

.model-pill-btn svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.model-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 250px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}

.model-dropdown-menu.show {
  display: flex;
}

.model-option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  color: var(--text-main);
  text-decoration: none;
}

.model-option-item:hover {
  background: var(--bg-surface-hover);
}

.model-option-item.active {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-strong);
}

.model-opt-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  flex-shrink: 0;
}

.model-opt-name {
  font-size: 0.82rem;
  font-weight: 500;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.header-icon-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-card);
  color: var(--text-main);
}

.header-icon-btn svg {
  width: 16px;
  height: 16px;
}

/* -------------------------------------------------------------
   3. MESSAGES SCROLL CONTAINER
   ------------------------------------------------------------- */
.chat-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-container-inner {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Empty State / Welcome (#282828 Pure Minimalist) */
.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 48px;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: #ffffff;
}

.hero-avatar svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
}

.hero-title {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 6px;
}

.hero-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.5;
  margin-bottom: 30px;
}

/* Starter Prompts Grid (Clean #282828 Cards) */
.starter-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 720px;
}

.prompt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.prompt-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}

.prompt-card-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.prompt-card-icon svg {
  width: 14px;
  height: 14px;
}

.prompt-card-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prompt-card-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Message Rows */
.message-row {
  display: flex;
  gap: 14px;
  width: 100%;
}

.message-row.user {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-card);
}

.msg-avatar.ai {
  background: var(--bg-surface);
  color: #ffffff;
}

.msg-avatar.ai svg {
  width: 15px;
  height: 15px;
}

.msg-avatar.user {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
}

.msg-avatar.user svg {
  width: 15px;
  height: 15px;
}

.msg-content-wrapper {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-row.user .msg-content-wrapper {
  align-items: flex-end;
}

.msg-bubble {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: break-word;
}

.message-row.user .msg-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: #ffffff;
  border-top-right-radius: 2px;
}

.message-row.ai .msg-bubble {
  background: var(--bg-bubble-ai);
  border: 1px solid var(--border-subtle);
  color: #e6e6e6;
  border-top-left-radius: 2px;
}

/* Attachments */
.msg-attachments-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.msg-attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xs);
  padding: 3px 8px;
  font-size: 0.72rem;
}

.msg-attachment-thumb {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  object-fit: cover;
}

/* Deep Thinking Minimal Block */
.thinking-block {
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border-card);
  overflow: hidden;
}

.thinking-header {
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.thinking-header:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.thinking-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thinking-header-left svg {
  width: 13px;
  height: 13px;
}

.thinking-body {
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--border-subtle);
}

/* Citations */
.web-search-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 0.7rem;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.citation-chip:hover {
  background: var(--bg-surface-elevated);
  color: #ffffff;
}

.citation-chip svg {
  width: 11px;
  height: 11px;
}

/* Markdown typography */
.msg-bubble p {
  margin-bottom: 10px;
}
.msg-bubble p:last-child {
  margin-bottom: 0;
}
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  color: #ffffff;
  margin: 14px 0 6px;
  font-weight: 600;
  line-height: 1.3;
}
.msg-bubble h1 { font-size: 1.2rem; }
.msg-bubble h2 { font-size: 1.05rem; }
.msg-bubble h3 { font-size: 0.95rem; }

.msg-bubble ul, .msg-bubble ol {
  margin: 6px 0 10px 18px;
}
.msg-bubble li {
  margin-bottom: 3px;
}
.msg-bubble blockquote {
  border-left: 2px solid var(--border-strong);
  padding: 4px 10px;
  margin: 8px 0;
  color: var(--text-muted);
}
.msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.82rem;
}
.msg-bubble th, .msg-bubble td {
  padding: 6px 10px;
  border: 1px solid var(--border-card);
  text-align: left;
}
.msg-bubble th {
  background: var(--bg-surface);
  color: #ffffff;
}

/* Code Block Minimalist */
.code-block-wrapper {
  margin: 10px 0;
  border-radius: var(--radius-sm);
  background: var(--bg-code);
  border: 1px solid var(--border-card);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.code-block-lang {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
}

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

.code-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.code-icon-btn:hover {
  color: #ffffff;
  background: var(--bg-surface-elevated);
}

.code-icon-btn svg {
  width: 14px;
  height: 14px;
}

.code-block-wrapper pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.5;
  color: #d6d6d6;
}

/* Message Actions Toolbar (SVG Only) */
.msg-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
}

.msg-icon-action-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.msg-icon-action-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.msg-icon-action-btn.active {
  color: #ffffff;
}

.msg-icon-action-btn svg {
  width: 14px;
  height: 14px;
}

/* -------------------------------------------------------------
   4. FLOATING CHAT INPUT BAR (#282828 Minimalist)
   ------------------------------------------------------------- */
.chat-input-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 16px;
  background: linear-gradient(to top, var(--bg-app) 70%, transparent 100%);
  z-index: 25;
  pointer-events: none;
}

.chat-input-container {
  width: 100%;
  max-width: 800px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  transition: border-color var(--transition-fast);
}

.chat-input-container:focus-within {
  border-color: var(--border-focus);
}

/* Tray */
.input-attachment-tray {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.input-attachment-tray.has-items {
  display: flex;
}

.input-preview-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-hover);
  border-radius: var(--radius-xs);
  padding: 3px 6px;
  font-size: 0.72rem;
  color: var(--text-main);
}

.input-preview-thumb {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  object-fit: cover;
}

.input-preview-remove {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-preview-remove:hover {
  color: #ffffff;
}

/* Textarea */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  min-height: 24px;
  padding: 3px 0;
  user-select: text;
  -webkit-user-select: text;
}

.chat-textarea::placeholder {
  color: var(--text-dim);
}

/* Bottom Controls Toolbar (Pure SVG Icons) */
.input-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
}

.input-icons-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-icons-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Pure SVG Icon Button in Input */
.input-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.input-icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.input-icon-btn.active {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  color: #ffffff;
}

.input-icon-btn svg {
  width: 16px;
  height: 16px;
}

.input-icon-btn.listening {
  color: #ffffff;
  background: #3e3e3e;
}

/* Send Button (Pure SVG Arrow Up) */
.btn-send-message {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: none;
  color: #000000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-send-message:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-send-message:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.btn-send-message svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.input-footer-note {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 6px;
  pointer-events: auto;
}

/* -------------------------------------------------------------
   5. MODALS & TOAST (#282828 Minimalist)
   ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-app);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
}

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

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-surface);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-primary {
  background: #ffffff;
  border: none;
  color: #000000;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
  }

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

  .mobile-menu-trigger {
    display: flex;
  }

  .chat-scroll-container {
    padding: 14px 12px 150px;
  }

  .chat-input-wrapper {
    padding: 0 10px 10px;
  }

  .starter-prompts-grid {
    grid-template-columns: 1fr;
  }

  .msg-content-wrapper {
    max-width: 90%;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 25;
    display: none;
  }

  .sidebar-backdrop.active {
    display: block;
  }
}

/* Embedded Mode (inside Spac2 Web OS parent iframe) */
body.embedded-mode .chat-input-wrapper {
  padding-bottom: 78px;
  transition: padding-bottom 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

body.embedded-mode.keyboard-open .chat-input-wrapper {
  padding-bottom: 12px;
}

body.embedded-mode .chat-scroll-container {
  padding-bottom: 230px;
}

body.embedded-mode.keyboard-open .chat-scroll-container {
  padding-bottom: 160px;
}
