:root {
  --bg-deep: #07090e;
  --bg-primary: #0b0f17;
  --bg-secondary: #111726;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(26, 36, 56, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.25);
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-google-blue: #4285f4;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.35);
  --accent-violet: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

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

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(66, 133, 244, 0.25);
  --shadow-emerald: 0 0 25px rgba(16, 185, 129, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(66, 133, 244, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.06) 0%, transparent 45%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
  gap: 16px;
}

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

.logo-badge {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 50%, #8b5cf6 100%);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.logo-badge:hover {
  transform: rotate(6deg) scale(1.05);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-pill {
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(6, 182, 212, 0.35);
  letter-spacing: 0.05em;
}

.author-pill {
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  text-decoration: none;
  transition: all 0.2s;
}
.author-pill:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--accent-emerald);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 1px;
}

/* Header Controls & Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.interactive-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.interactive-pill:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  transform: translateY(-1px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
  animation: pulse-beacon 2s infinite;
}
.interactive-pill.ready .status-dot {
  background: var(--accent-emerald);
  box-shadow: 0 0 12px var(--accent-emerald);
}
.interactive-pill.simulation .status-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

@keyframes pulse-beacon {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-action:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  color: #fff;
}

.btn-bench {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.15), rgba(6, 182, 212, 0.15));
  border-color: rgba(66, 133, 244, 0.4);
  color: #60a5fa;
}
.btn-bench:hover {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.25), rgba(6, 182, 212, 0.25));
  border-color: var(--accent-google-blue);
  color: #fff;
  box-shadow: 0 0 15px rgba(66, 133, 244, 0.3);
}

.btn-github {
  background: #1e293b;
  border-color: #334155;
}
.btn-github:hover {
  background: #334155;
  border-color: #475569;
}

/* ==========================================================================
   MOBILE SEGMENTED NAVIGATION TABS (Visible < 900px)
   ========================================================================== */
.mobile-nav-tabs {
  display: none;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
  z-index: 40;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   MAIN WORKSPACE GRID
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   SIDEBAR: WebMCP TOOLS & TELEMETRY
   ========================================================================== */
.sidebar-panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.panel-header-sticky {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(17, 23, 38, 0.95);
  backdrop-filter: blur(8px);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.panel-title-row h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.tool-count-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.panel-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.tools-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Tool Cards */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: visible;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
  background: var(--border-subtle);
  transition: background 0.25s;
}
.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.tool-card:hover::before {
  background: var(--accent-cyan);
}

.tool-card.hardware::before { background: var(--accent-cyan); }
.tool-card.vault::before { background: var(--accent-emerald); }
.tool-card.math::before { background: var(--accent-violet); }
.tool-card.dom::before { background: var(--accent-amber); }

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.tool-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.tool-card-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.tool-badge-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
  letter-spacing: 0.04em;
}

.tool-card-desc {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.tool-action-row {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 38px;
  gap: 6px;
  margin-top: 4px;
}

.tool-btn {
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.tool-btn:hover {
  transform: translateY(-1px);
}

.tool-btn.btn-run {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}
.tool-btn.btn-run:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.tool-btn.btn-prompt {
  background: rgba(66, 133, 244, 0.18);
  border-color: rgba(66, 133, 244, 0.45);
  color: #93c5fd;
}
.tool-btn.btn-prompt:hover {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.tool-btn.btn-schema {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.38);
  color: #67e8f9;
  font-family: var(--font-mono);
}
.tool-btn.btn-schema:hover {
  background: #06b6d4;
  color: #ffffff;
  border-color: #06b6d4;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}

/* Sidebar Footer Telemetry */
.sidebar-footer {
  padding: 14px 18px;
  background: rgba(10, 14, 23, 0.9);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.telemetry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.telemetry-label {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.telemetry-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-emerald);
}

/* ==========================================================================
   AGENT CHAT & TELEMETRY PANEL
   ========================================================================== */
.agent-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
  position: relative;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-container > * {
  flex-shrink: 0;
}

/* Welcome Hero Box */
.welcome-hero {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.8) 0%, rgba(30, 41, 59, 0.4) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.welcome-hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(66, 133, 244, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.hero-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.hero-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

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

.hero-chips-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.quick-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.chip:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--accent-google-blue);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(66, 133, 244, 0.25);
}

/* Chat Messages */
.message {
  display: flex;
  gap: 14px;
  max-width: 900px;
  width: 100%;
  flex-shrink: 0;
  animation: fadeIn 0.3s ease;
}

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

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.user-msg .msg-avatar {
  background: #334155;
  color: #f8fafc;
}
.assistant-msg .msg-avatar {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
}

.msg-bubble {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  word-break: break-word;
  overflow-wrap: break-word;
}

.user-msg .msg-bubble {
  background: rgba(30, 41, 59, 0.55);
  border-color: rgba(255, 255, 255, 0.1);
}

.msg-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 4px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-list-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  line-height: 1.5;
}

.list-bullet {
  color: var(--accent-cyan);
  font-weight: bold;
}

.msg-gap {
  height: 10px;
}

.msg-bubble code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #38bdf8;
}

.msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-msg-copy {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: all 0.2s;
}
.btn-msg-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* Tool Execution Card in Chat */
.tool-call-banner {
  background: rgba(13, 23, 36, 0.95);
  border: 1px solid #1e3a5f;
  border-radius: var(--radius-sm);
  margin: 6px 0;
  width: 100%;
  max-width: 900px;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.2s ease;
}

.tool-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  min-height: 42px;
  background: rgba(20, 35, 55, 0.7);
  font-size: 0.82rem;
  gap: 10px;
  box-sizing: border-box;
}

.tool-banner-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  color: #38bdf8;
  font-size: 0.82rem;
  line-height: 1.2;
}

.tool-latency-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 7px;
  border-radius: 4px;
}

.tool-banner-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-toggle-json {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.btn-toggle-json:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.btn-toggle-json svg {
  transition: transform 0.2s;
}
.btn-toggle-json.open svg {
  transform: rotate(180deg);
}

.tool-banner-content {
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #cbd5e1;
  background: rgba(7, 12, 20, 0.98);
  border-top: 1px solid rgba(30, 58, 95, 0.5);
  overflow-x: auto;
  max-height: 200px;
}

/* Activity Indicator */
.agent-activity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  font-size: 0.82rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.07);
  border-top: 1px solid rgba(56, 189, 248, 0.15);
  animation: fadeIn 0.2s ease;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(56, 189, 248, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

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

/* Prompt Form Container */
.prompt-bar-container {
  padding: 14px 24px max(18px, env(safe-area-inset-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  position: relative;
  z-index: 20;
}

.prompt-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-deep);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 6px 8px 6px 18px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.prompt-form:focus-within {
  border-color: var(--accent-google-blue);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2), inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.prompt-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  min-width: 0;
}
.prompt-form input::placeholder {
  color: var(--text-dim);
}

.send-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.send-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: var(--shadow-emerald);
}
.send-btn:active {
  transform: scale(0.98);
}
.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.prompt-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.73rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 6px;
}

/* ==========================================================================
   MODALS (Diagnostics, Schema, Tool Tester)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(17, 24, 39, 0.6);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: flex;
  transition: all 0.2s;
}
.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-box {
  background: #090d14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
  overflow-x: auto;
  margin-bottom: 12px;
}

.engine-toggle-group {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}

.engine-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.2s;
}
.engine-btn.active {
  background: rgba(66, 133, 244, 0.2);
  border-color: var(--accent-google-blue);
  color: #fff;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (FLAWLESS MOBILE & TABLET LAYOUT)
   ========================================================================== */
@media (max-width: 900px) {
  .app-header {
    padding: 10px 16px;
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .mobile-nav-tabs {
    display: flex;
  }

  .workspace-grid {
    display: block;
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);
    overflow: hidden;
  }

  /* In mobile, tab controls which panel is active */
  .sidebar-panel {
    display: none;
    height: 100%;
    border-right: none;
  }
  .sidebar-panel.active-tab {
    display: flex;
  }

  .agent-panel {
    display: none;
    height: 100%;
  }
  .agent-panel.active-tab {
    display: flex;
  }

  .chat-container {
    padding: 16px;
  }

  .welcome-hero {
    padding: 18px 20px;
  }

  .hero-title {
    font-size: 1.15rem;
  }

  .prompt-bar-container {
    padding: 10px 16px max(14px, env(safe-area-inset-bottom));
  }

  .prompt-hints {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 1.05rem;
  }

  .brand-subtitle {
    display: none;
  }

  .logo-badge {
    width: 36px;
    height: 36px;
  }

  .btn-action span {
    display: none;
  }

  .btn-action {
    padding: 6px 10px;
  }

  .chip {
    font-size: 0.74rem;
    padding: 6px 10px;
  }
}
