/* ═══════════════════════════════════════════
   BOB'S LAWYER — MULTI-AGENT STYLE SYSTEM
   Theme: Black, Blue Flame, Red, Icy Silver
   ═══════════════════════════════════════════ */

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

:root {
  --bg-primary: #000000;
  --bg-secondary: #080c14;
  --bg-chat: #050810;
  --surface: #0d1525;
  --surface-hover: #121d30;
  --border: #1a2a44;
  --border-light: #1e3a5f;

  --flame-bright: #4fc3f7;
  --flame-mid: #0288d1;
  --flame-deep: #01579b;
  --flame-glow: rgba(79, 195, 247, 0.18);
  --flame-glow-strong: rgba(79, 195, 247, 0.35);

  --red: #c0392b;
  --red-bright: #e74c3c;
  --red-glow: rgba(192, 57, 43, 0.25);

  --silver: #b0bec5;
  --silver-bright: #cfd8dc;
  --silver-dim: #78909c;

  --text-primary: #e8f4fd;
  --text-secondary: #90caf9;
  --text-muted: #4a6fa5;

  --user-bubble: #0d1f3c;
  --user-bubble-border: #1565c0;
  --ai-bubble: #080e1c;
  --ai-bubble-border: #1a2a44;

  --danger: #ef4444;
  --success: #4fc3f7;
  --warning: #f59e0b;

  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title: 'Cinzel', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  font-family: var(--font-main);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ══════════════════════════════════════
   SCREEN MANAGEMENT
══════════════════════════════════════ */
.screen { display: none; flex-direction: column; height: 100vh; }
.screen.active { display: flex; }

/* ══════════════════════════════════════
   SELECTION SCREEN
══════════════════════════════════════ */
.selection-screen {
  background: var(--bg-primary);
  overflow-y: auto;
}

.selection-header {
  text-align: center;
  padding: 32px 24px 20px;
  background: linear-gradient(180deg, #000 0%, #05080f 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
}

.selection-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--flame-mid), transparent);
}

.selection-logo {
  width: 130px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
  filter: drop-shadow(0 0 20px rgba(79,195,247,0.5)) drop-shadow(0 0 40px rgba(1,87,155,0.5));
  animation: logoPulse 4s ease-in-out infinite;
}

.selection-header h1 {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.selection-header p {
  color: var(--flame-bright);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.selection-header .tagline {
  color: var(--silver-dim);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  font-style: italic;
  text-transform: none;
}

.selection-body {
  padding: 28px 24px 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.selection-body h2 {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--flame-bright);
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--agent-color-a, #0288d1), var(--agent-color-b, #4fc3f7));
  opacity: 0;
  transition: var(--transition);
}

.agent-card:hover {
  background: var(--surface-hover);
  border-color: var(--flame-mid);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(79,195,247,0.15);
}

.agent-card:hover::before { opacity: 1; }

.agent-emoji {
  font-size: 2.2rem;
  margin-bottom: 10px;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.agent-name {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  letter-spacing: 0.03em;
}

.agent-title {
  font-size: 0.72rem;
  color: var(--flame-bright);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.agent-desc {
  font-size: 0.8rem;
  color: var(--silver-dim);
  line-height: 1.55;
}

.agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 3px 8px;
  background: rgba(79,195,247,0.08);
  border: 1px solid rgba(79,195,247,0.2);
  border-radius: 20px;
  font-size: 0.65rem;
  color: var(--flame-bright);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bob-approved {
  background: rgba(192,57,43,0.1);
  border-color: rgba(192,57,43,0.3);
  color: var(--red-bright);
}

/* ══════════════════════════════════════
   CHAT SCREEN
══════════════════════════════════════ */
.chat-screen {
  background: var(--bg-primary);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #000000;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--flame-mid), transparent);
}

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

.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--flame-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--surface-hover);
  border-color: var(--flame-mid);
}

.header-agent-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--flame-mid);
  box-shadow: 0 0 10px rgba(79,195,247,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.header-agent-info h1 {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 900;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.header-agent-info p {
  font-size: 0.65rem;
  color: var(--flame-bright);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-actions { display: flex; gap: 8px; }

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--surface-hover);
  border-color: var(--flame-mid);
  color: var(--flame-bright);
}

/* ─── CHAT AREA ─── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg-chat);
  scroll-behavior: smooth;
}

/* ─── WELCOME BUBBLE ─── */
.agent-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 20px 16px 28px;
  animation: fadeIn 0.5s ease;
}

.agent-welcome-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.agent-welcome h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 900;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.agent-welcome .agent-sub {
  font-size: 0.72rem;
  color: var(--flame-bright);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.agent-welcome > p {
  color: var(--silver);
  font-size: 0.88rem;
  max-width: 460px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: 100%;
  max-width: 560px;
}

.suggestion {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--silver);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  line-height: 1.45;
}

.suggestion:hover {
  background: var(--surface-hover);
  border-color: var(--flame-mid);
  color: var(--text-primary);
  box-shadow: 0 0 10px var(--flame-glow);
}

.suggestion strong {
  display: block;
  color: var(--flame-bright);
  font-size: 0.76rem;
  margin-bottom: 3px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ─── MESSAGES ─── */
.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: slideUp 0.3s ease;
}

.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.ai { align-self: flex-start; }

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1px solid var(--border);
}

.message.user .message-avatar {
  background: var(--flame-deep);
  border-color: var(--flame-mid);
  color: #fff;
  font-size: 13px;
}

.message.ai .message-avatar {
  background: var(--surface);
  border-color: var(--flame-mid);
  box-shadow: 0 0 6px rgba(79,195,247,0.2);
}

.message-content {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.91rem;
  line-height: 1.7;
}

.message.user .message-content {
  background: var(--user-bubble);
  border: 1px solid var(--user-bubble-border);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

.message.ai .message-content {
  background: var(--ai-bubble);
  border: 1px solid var(--ai-bubble-border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

/* Markdown */
.message.ai .message-content h1,
.message.ai .message-content h2,
.message.ai .message-content h3 {
  font-family: var(--font-title);
  color: var(--flame-bright);
  margin: 14px 0 7px;
  line-height: 1.3;
}
.message.ai .message-content h1 { font-size: 1.1rem; }
.message.ai .message-content h2 { font-size: 1rem; }
.message.ai .message-content h3 { font-size: 0.93rem; }
.message.ai .message-content h1:first-child,
.message.ai .message-content h2:first-child,
.message.ai .message-content h3:first-child { margin-top: 0; }
.message.ai .message-content p { margin-bottom: 9px; }
.message.ai .message-content p:last-child { margin-bottom: 0; }
.message.ai .message-content ul,
.message.ai .message-content ol { padding-left: 18px; margin: 7px 0; }
.message.ai .message-content li { margin-bottom: 3px; }
.message.ai .message-content strong { color: var(--flame-bright); font-weight: 600; }
.message.ai .message-content code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: rgba(79,195,247,0.08);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--flame-bright);
}
.message.ai .message-content pre {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  margin: 9px 0;
  overflow-x: auto;
  font-size: 0.84rem;
}
.message.ai .message-content pre code { background: none; padding: 0; color: var(--text-primary); }
.message.ai .message-content blockquote {
  border-left: 3px solid var(--flame-mid);
  padding-left: 12px;
  margin: 9px 0;
  color: var(--silver);
  font-style: italic;
}
.message.ai .message-content table { width: 100%; border-collapse: collapse; margin: 9px 0; font-size: 0.84rem; }
.message.ai .message-content th,
.message.ai .message-content td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; }
.message.ai .message-content th { background: var(--surface); color: var(--flame-bright); font-weight: 600; }
.message.ai .message-content hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ─── TYPING ─── */
.typing {
  display: flex;
  gap: 10px;
  max-width: 85%;
  align-self: flex-start;
  animation: slideUp 0.3s ease;
}
.typing .message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--flame-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 13px 18px;
  background: var(--ai-bubble);
  border: 1px solid var(--ai-bubble-border);
  border-radius: var(--radius-lg);
  border-top-left-radius: 4px;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--flame-mid);
  animation: bounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

/* ─── INPUT ─── */
.input-area {
  padding: 12px 20px 16px;
  background: #000;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.input-area::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--flame-mid), transparent);
}
.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 5px 5px 5px 16px;
  transition: var(--transition);
}
.input-wrapper:focus-within {
  border-color: var(--flame-mid);
  box-shadow: 0 0 0 3px var(--flame-glow);
}
.input-wrapper textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.91rem;
  line-height: 1.5;
  resize: none;
  max-height: 140px;
  padding: 9px 0;
}
.input-wrapper textarea::placeholder { color: var(--text-muted); }
.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: none;
  background: linear-gradient(135deg, var(--flame-deep), var(--flame-mid));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-send:hover { transform: scale(1.05); box-shadow: 0 4px 14px var(--flame-glow-strong); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.input-hint { text-align: center; margin-top: 7px; font-size: 0.68rem; color: var(--text-muted); }

/* ─── STATUS BAR ─── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 16px;
  background: #000;
  border-top: 1px solid var(--border);
  font-size: 0.67rem;
  color: var(--text-muted);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--flame-bright);
  animation: pulse 2s ease-in-out infinite;
}
.status-dot.disconnected { background: var(--danger); animation: none; }
.status-dot.warning { background: var(--warning); animation: none; }
.branding {
  color: var(--red-bright);
  font-weight: 600;
  margin-left: auto;
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
@keyframes logoPulse {
  0%,100% { filter: drop-shadow(0 0 20px rgba(79,195,247,0.5)) drop-shadow(0 0 40px rgba(1,87,155,0.4)); }
  50% { filter: drop-shadow(0 0 32px rgba(79,195,247,0.8)) drop-shadow(0 0 60px rgba(1,87,155,0.7)); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .selection-header h1 { font-size: 1.5rem; }
  .selection-logo { width: 100px; }
  .agents-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .agent-card { padding: 14px 12px; }
  .agent-emoji { font-size: 1.8rem; }
  .agent-name { font-size: 0.85rem; }
  .agent-desc { display: none; }
  .header { padding: 10px 12px; }
  .chat-area { padding: 12px 10px; }
  .message { max-width: 93%; }
  .suggestions { grid-template-columns: 1fr; }
  .input-area { padding: 10px 12px 13px; }
  .status-bar { flex-direction: column; gap: 3px; }
  .branding { margin-left: 0; }
}

@media (max-width: 380px) {
  .agents-grid { grid-template-columns: 1fr; }
}
/* ═══════════════════════════════════════════════════════════════
   MULTI-AGENT ADDITIONS — new class names used by app.js
═══════════════════════════════════════════════════════════════ */

/* ─── Chat header extras ─── */
.chat-header-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-header-logo img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--flame-mid);
  box-shadow: 0 0 8px var(--flame-glow);
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.chat-agent-emoji {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}
.chat-agent-name {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--red-bright);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-agent-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.new-chat-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--silver-dim);
  font-size: 0.72rem;
  font-family: var(--font-title);
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.new-chat-btn:hover {
  border-color: var(--flame-mid);
  color: var(--flame-bright);
  box-shadow: 0 0 8px var(--flame-glow);
}

/* ─── Message wrappers (new structure) ─── */
.message-wrapper {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: slideUp 0.3s ease;
}
.ai-wrapper {
  align-self: flex-start;
  flex-direction: row;
}
.user-wrapper {
  align-self: flex-end;
  flex-direction: row-reverse;
}

/* ─── Message avatars (new structure) ─── */
.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.ai-avatar {
  background: var(--surface);
  border-color: var(--flame-mid);
  box-shadow: 0 0 8px rgba(79,195,247,0.2);
}
.ai-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-avatar {
  background: var(--flame-deep);
  border-color: var(--flame-mid);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-title);
  letter-spacing: 0.04em;
}

/* ─── Message bubbles (new structure) ─── */
.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.91rem;
  line-height: 1.7;
  max-width: 100%;
  word-break: break-word;
}
.ai-bubble {
  background: var(--ai-bubble);
  border: 1px solid var(--ai-bubble-border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}
.user-bubble {
  background: var(--user-bubble);
  border: 1px solid var(--user-bubble-border);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

/* ─── Streaming / typing cursor ─── */
.message-bubble.streaming {
  min-width: 60px;
}
.typing-cursor {
  display: inline-block;
  color: var(--flame-bright);
  font-weight: bold;
  animation: blink 0.75s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ─── Markdown inside ai-bubble ─── */
.ai-bubble h1,
.ai-bubble h2,
.ai-bubble h3 {
  font-family: var(--font-title);
  color: var(--flame-bright);
  margin: 14px 0 7px;
  line-height: 1.3;
}
.ai-bubble h1 { font-size: 1.1rem; }
.ai-bubble h2 { font-size: 1rem; }
.ai-bubble h3 { font-size: 0.93rem; }
.ai-bubble h1:first-child,
.ai-bubble h2:first-child,
.ai-bubble h3:first-child { margin-top: 0; }
.ai-bubble p { margin-bottom: 9px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble ul, .ai-bubble ol { padding-left: 18px; margin: 7px 0; }
.ai-bubble li { margin-bottom: 3px; }
.ai-bubble strong { color: var(--flame-bright); font-weight: 600; }
.ai-bubble em { color: var(--silver); font-style: italic; }
.ai-bubble code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: rgba(79,195,247,0.08);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--flame-bright);
}
.ai-bubble pre {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  margin: 9px 0;
  overflow-x: auto;
  font-size: 0.84rem;
}
.ai-bubble pre code { background: none; padding: 0; color: var(--text-primary); }
.ai-bubble blockquote {
  border-left: 3px solid var(--flame-mid);
  padding-left: 12px;
  margin: 9px 0;
  color: var(--silver);
  font-style: italic;
}
.ai-bubble table { width: 100%; border-collapse: collapse; margin: 9px 0; font-size: 0.84rem; }
.ai-bubble th,
.ai-bubble td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; }
.ai-bubble th { background: var(--surface); color: var(--flame-bright); font-weight: 600; }
.ai-bubble hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ─── Error message ─── */
.error-msg {
  color: var(--red-bright);
  font-size: 0.88rem;
  padding: 8px 0;
  line-height: 1.6;
}
.error-msg strong { color: var(--danger); }

/* ─── Send button (new id: sendBtn) ─── */
.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: none;
  background: linear-gradient(135deg, var(--flame-deep), var(--flame-mid));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.send-btn svg {
  width: 18px;
  height: 18px;
}
.send-btn:hover { transform: scale(1.06); box-shadow: 0 4px 14px var(--flame-glow-strong); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── Char count ─── */
.char-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  padding: 0 4px;
}

/* ─── Suggested questions (new class .suggestion-btn) ─── */
.suggested-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px;
  background: var(--bg-chat);
  border-bottom: 1px solid var(--border);
}
.suggestion-btn {
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--silver);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  line-height: 1.4;
  font-family: var(--font-main);
}
.suggestion-btn:hover {
  background: var(--surface-hover);
  border-color: var(--flame-mid);
  color: var(--text-primary);
  box-shadow: 0 0 10px var(--flame-glow);
}

/* ─── Selection footer ─── */
.selection-footer {
  text-align: center;
  padding: 20px 20px 32px;
  color: var(--text-muted);
  font-size: 0.75rem;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── Messages container (chat area) ─── */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-chat);
  scroll-behavior: smooth;
}
.messages-container::-webkit-scrollbar { width: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Responsive updates for new classes ─── */
@media (max-width: 640px) {
  .message-wrapper { max-width: 93%; }
  .new-chat-btn { display: none; }
  .chat-agent-name { font-size: 0.82rem; }
  .suggested-questions { padding: 8px 10px; gap: 6px; }
  .suggestion-btn { font-size: 0.75rem; padding: 6px 10px; }
  .messages-container { padding: 14px 10px; gap: 12px; }
}

/* ─── Chat screen layout fix ─── */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
  overflow: hidden;
}

/* ─── Chat header ─── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #000000;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.chat-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--flame-mid), transparent);
}

/* Override back-btn sizing to show text */
.back-btn {
  width: auto !important;
  height: 32px !important;
  padding: 0 12px !important;
  font-size: 0.8rem !important;
  font-family: var(--font-main) !important;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   METHOD HUB RETURN BAR
═══════════════════════════════════════════════════════════════ */
.hub-return-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: linear-gradient(90deg, #050810, #0d1525, #050810);
  border-bottom: 1px solid var(--flame-deep);
  color: var(--flame-bright);
  text-decoration: none;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: var(--transition);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.hub-return-bar:hover {
  background: linear-gradient(90deg, #0d1525, #122033, #0d1525);
  color: #fff;
}
.hub-return-arrow {
  font-size: 1rem;
  line-height: 1;
  color: var(--flame-bright);
}
.hub-return-label {
  flex: 0 0 auto;
}
.hub-return-brand {
  margin-left: auto;
  color: var(--red-bright);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

/* Push screens down so they clear the fixed bar */
.screen {
  padding-top: 34px;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .hub-return-bar { font-size: 0.72rem; padding: 6px 12px; }
  .hub-return-brand { font-size: 0.62rem; }
}
