:root {
  --bg: #000000;
  --card: #121214;
  --card-elevated: #1a1a1d;
  --border: #2e2e33;
  --text: #ffffff;
  --text-muted: #d4d4d8;
  --accent: #10b981;
  --accent-muted: rgba(16, 185, 129, 0.15);
  --link: #38bdf8;
  --danger: #f87171;
  --code-bg: #0c0c0e;
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

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

body {
  background: var(--bg); color: var(--text); font-family: var(--font-sans);
  font-size: 17px; line-height: 1.65; height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
}

/* Header Navigation (Clean 3-Item Layout) */
.top-nav {
  height: 56px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; z-index: 10;
}
.brand-section { display: flex; align-items: center; gap: 8px; }
.brand-logo { height: 26px; width: auto; max-width: 150px; object-fit: contain; vertical-align: middle; }
.icon-btn {
  background: transparent; border: none; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 6px;
}
.icon-btn:hover { background: var(--card); }
.stat-pill {
  padding: 6px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; color: var(--text); font-size: 14px; font-weight: 600;
}

/* Side Drawer Navigation */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease; z-index: 100;
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }

.side-drawer {
  position: fixed; top: 0; left: 0; width: min(320px, 84vw); height: 100dvh;
  background: #09090b; border-right: 1.5px solid var(--border); z-index: 101;
  transform: translateX(-100%); transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column; padding: 18px 16px; gap: 14px;
}
.side-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.drawer-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.drawer-card-title { font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); font-weight: 700; letter-spacing: 0.5px; }
.drawer-stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.action-btn-outline {
  width: 100%; padding: 8px; background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.drawer-section-title {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); font-weight: 700; margin-top: 6px;
}
.text-btn { background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; }
.drawer-session-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 4px;
}
.session-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; background: var(--card);
}
.session-item.active { border-color: var(--accent); background: var(--accent-muted); }

/* Chat Container */
.chat-container {
  flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth;
}
.msg { display: flex; flex-direction: column; max-width: 96%; animation: fadeIn 0.15s ease-out; }
.msg.user { align-self: flex-end; }
.msg.agent { align-self: flex-start; width: 100%; }

.bubble { padding: 12px 16px; border-radius: 8px; font-size: 17px; line-height: 1.65; word-break: break-word; color: var(--text); }
.msg.user .bubble { background: var(--card); border: 1.5px solid var(--border); color: #ffffff; }
.msg.agent .bubble { background: transparent; border-left: 3px solid var(--accent); padding-left: 14px; border-radius: 0; }
.agent-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; display: flex; gap: 10px; font-weight: 500; }

.bubble h1, .bubble h2, .bubble h3 { color: #ffffff; margin: 12px 0 6px 0; font-weight: 700; }
.bubble h1 { font-size: 20px; } .bubble h2 { font-size: 18px; } .bubble h3 { font-size: 17px; }
.bubble p { margin-bottom: 10px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 8px 0 10px 22px; } .bubble li { margin-bottom: 6px; }
.bubble strong { color: #ffffff; font-weight: 700; }
.bubble a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px;
  margin: 10px 0; overflow-x: auto; font-family: var(--font-mono); font-size: 15px; line-height: 1.5; position: relative;
}
code { font-family: var(--font-mono); font-size: 15px; background: var(--card); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); color: #f4f4f5; }
pre code { background: none; padding: 0; border: none; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; background: var(--card-elevated); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; padding: 4px 8px; border-radius: 4px; cursor: pointer;
}

/* Activity Status Bar */
.activity-bar {
  align-items: center; gap: 10px; padding: 10px 14px; background: var(--card);
  border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px;
  font-family: var(--font-mono); color: var(--text-muted);
}
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }

/* Bottom Composer Bar */
.bottom-bar {
  padding: 10px 14px; background: var(--bg); border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; flex-shrink: 0;
}
.quick-actions { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-btn {
  padding: 6px 12px; background: var(--card); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
  flex: 1; background: var(--card); border: 1px solid var(--border); color: #ffffff;
  padding: 12px 14px; border-radius: 8px; font-size: 17px; font-family: inherit;
  resize: none; max-height: 140px; min-height: 50px; line-height: 1.5;
}
.chat-input:focus { outline: none; border-color: var(--text-muted); }
.send-btn {
  height: 50px; padding: 0 20px; background: #ffffff; color: #000000;
  border: none; border-radius: 8px; font-weight: 700; font-size: 16px; cursor: pointer;
}
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
  display: none; align-items: center; justify-content: center; z-index: 150; padding: 16px;
}
.modal-content {
  background: var(--card); border: 1.5px solid var(--border); border-radius: 10px;
  width: 100%; max-width: 400px; padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.account-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.account-item.active { border-color: var(--accent); background: var(--accent-muted); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { opacity: 0.4; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0.4; transform: scale(0.9); } }
