:root {
  --bg-primary: #1e1e1e;
  --bg-secondary: #252528;
  --bg-tertiary: #2c2c30;
  --bg-input: #232326;
  --border-color: #38383e;
  --border-light: #484852;
  --coral-accent: #e06c4b;
  --coral-hover: #eb7a59;
  --coral-active: #cc5e3f;
  --text-main: #f0f0f2;
  --text-muted: #9e9ea6;
  --text-sub: #787882;
  --online-green: #10b981;
  --claude-purple: #9061f9;
  --codex-green: #10b981;
  --agy-blue: #3b82f6;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --tab-height: 44px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ---------------- TOP TAB BAR ---------------- */
.top-tab-bar {
  display: flex;
  align-items: center;
  height: var(--tab-height);
  background-color: #171719;
  border-bottom: 1px solid var(--border-color);
  padding: 0 8px;
  user-select: none;
  z-index: 50;
  gap: 6px;
  flex-shrink: 0;
}

.tabs-scroll-container {
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
  gap: 4px;
  flex: 1;
}

.tabs-scroll-container::-webkit-scrollbar {
  height: 2px;
}

.tabs-scroll-container::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: #222225;
  color: var(--text-muted);
  border-radius: 6px 6px 0 0;
  font-size: 13px;
  height: 36px;
  max-width: 230px;
  min-width: 110px;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s ease;
  position: relative;
}

.tab-item:hover {
  background-color: #29292d;
  color: var(--text-main);
}

.tab-item.active {
  background-color: var(--bg-primary);
  color: #ffffff;
  border-color: var(--border-color);
  border-top: 2px solid var(--coral-accent);
}

.tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.6;
}

.tab-close:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.add-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-tab-btn:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
}

.top-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
}

.logout-btn {
  background-color: #232326;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.logout-btn:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
}

/* ---------------- MAIN VIEWS (FIXED OVERLAP BUG) ---------------- */
.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.view-panel {
  display: none !important;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.view-panel.active {
  display: flex !important;
  flex-direction: column;
}

/* ---------------- HOME DASHBOARD VIEW ---------------- */
.home-view {
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: var(--bg-primary);
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  width: 90%;
  text-align: center;
  animation: fadeIn 0.25s ease;
}

.brand-title {
  font-size: 56px;
  font-weight: 800;
  color: var(--coral-accent);
  margin-bottom: 24px;
  letter-spacing: -1px;
}

/* Engine Selector Pills */
.engine-selector-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  width: 100%;
}

.engine-pills-row {
  display: flex;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 4px;
  gap: 4px;
}

.engine-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.engine-pill:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}

.engine-pill.active {
  background-color: var(--bg-tertiary);
  color: #fff;
  border-color: var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.engine-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.claude-dot { background-color: var(--coral-accent); }
.codex-dot { background-color: var(--codex-green); }
.agy-dot { background-color: var(--agy-blue); }

.model-sub-select {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown {
  position: relative;
}

.model-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.model-pill:hover {
  background-color: #35353a;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 290px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 100;
  overflow: hidden;
  padding: 6px;
}

.dropdown-menu.up-direction {
  top: auto;
  bottom: calc(100% + 6px);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-tertiary);
}

.dropdown-item.active {
  background-color: rgba(224, 108, 75, 0.18);
}

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.item-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.item-badge {
  font-size: 11px;
  background-color: var(--coral-accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
}

.item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Home Action Buttons */
.action-buttons-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 14px;
}

.primary-action-btn {
  background-color: var(--coral-accent);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(224, 108, 75, 0.35);
  transition: all 0.15s ease;
}

.primary-action-btn:hover {
  background-color: var(--coral-hover);
  transform: translateY(-1px);
}

.primary-action-btn:active {
  background-color: var(--coral-active);
  transform: translateY(0);
}

.btn-main-text {
  font-size: 18px;
  font-weight: 700;
}

.btn-sub-text {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 2px;
}

.secondary-action-btn {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.secondary-action-btn:hover {
  background-color: #35353c;
  border-color: var(--border-light);
  transform: translateY(-1px);
}

/* ---------------- DRAWERS (RESUME & MEMORY) ---------------- */
.sessions-drawer {
  position: absolute;
  top: 0;
  right: -460px;
  width: 440px;
  height: 100%;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sessions-drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.close-drawer-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.drawer-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-search input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-card {
  padding: 12px 14px;
  background-color: #212124;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.session-card:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
}

.session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.session-card-title {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.session-card-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background-color: rgba(224, 108, 75, 0.2);
  color: var(--coral-accent);
}

.session-card-meta {
  font-size: 11px;
  color: var(--text-sub);
}

/* Memory Drawer */
.memory-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background-color: #17171a;
  font-size: 13px;
  line-height: 1.6;
}

.memory-content-area pre {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------- ACTIVE CHAT VIEW ---------------- */
.chat-view {
  background-color: var(--bg-primary);
  flex-direction: column;
  height: 100%;
}

.chat-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  flex-shrink: 0;
}

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

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--online-green);
  box-shadow: 0 0 8px var(--online-green);
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--coral-accent);
}

.active-engine-badge {
  font-size: 11px;
  font-weight: 600;
  background-color: rgba(224, 108, 75, 0.15);
  color: var(--coral-accent);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(224, 108, 75, 0.3);
}

.active-model-tag {
  font-size: 11px;
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

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

.sub-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-btn:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
}

/* Messages area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Clean Empty Chat State */
.empty-chat-state {
  margin: auto;
  text-align: center;
  max-width: 500px;
  animation: fadeIn 0.25s ease;
}

.empty-brand-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--coral-accent);
  background-color: rgba(224, 108, 75, 0.15);
  border: 1px solid rgba(224, 108, 75, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.empty-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
}

.message-bubble {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: fadeIn 0.2s ease;
}

.message-bubble.user {
  align-self: flex-end;
  font-size: 17px;
  line-height: 1.6;
  background-color: #2b2b30;
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: 16px 16px 4px 16px;
  color: #fff;
}

.message-bubble.assistant {
  align-self: flex-start;
  width: 100%;
  background-color: transparent;
  color: var(--text-main);
  line-height: 1.6;
  font-size: 17px;
}

.message-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--coral-accent);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tool Execution & Bash Cards (Matching User Reference) */
.tool-calls-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
}

/* Show only the latest step; earlier steps hidden until expanded */
.tool-calls-container:not(.show-all) .tool-call-card:not(:last-of-type) {
  display: none;
}

.tool-history-toggle {
  order: -1;
  align-self: flex-start;
  background: transparent;
  border: none;
  color: #71717a;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.tool-history-toggle:hover {
  color: #d4d4d8;
}

.tool-call-card {
  background-color: #1a1a20;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'JetBrains Mono', Consolas, Menlo, Monaco, monospace;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease;
}

.tool-call-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.tool-call-header {
  color: #d1d5db;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  cursor: pointer;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-call-header.expanded {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.tool-name {
  color: #ea580c; /* Deep Amber / Orange */
  font-weight: 700;
}

.tool-sep {
  color: #6b7280;
  margin: 0 4px;
}

.tool-prop {
  color: #71717a;
}

.tool-command {
  color: #fdba74;
  margin: 0 2px;
  background: rgba(253, 186, 116, 0.08);
  padding: 1px 4px;
  border-radius: 4px;
}

.tool-desc {
  color: #9ca3af;
}

.tool-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.tool-toggle-btn:hover {
  color: #ffffff;
}

.toggle-arrow {
  font-size: 10px;
  transition: transform 0.15s ease;
}

.tool-result-body {
  margin-top: 8px;
  background-color: #0f1013;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 12px;
  max-height: 180px;
  overflow-y: auto;
}

.tool-result-body pre {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
}

.tool-result-body code {
  color: #a1a1aa !important;
  font-size: 12px !important;
  white-space: pre-wrap !important;
  word-break: break-all !important;
  font-family: 'JetBrains Mono', Consolas, monospace !important;
}

/* Thinking Indicator (Matching User Reference) */
.thinking-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 8px 0;
  color: #9ca3af;
  font-size: 15px;
  font-style: italic;
  font-family: inherit;
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-dots .dot {
  width: 6px;
  height: 6px;
  background-color: #f97316;
  border-radius: 50%;
  animation: thinkingDotPulse 1.4s infinite ease-in-out both;
}

.thinking-dots .dot:nth-child(1) {
  animation-delay: -0.32s;
}

.thinking-dots .dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes thinkingDotPulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.35;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Markdown typography (rich preview, Claude-style) */
.markdown-body {
  font-size: 17px;
  line-height: 1.75;
  color: #e4e4e7;
  word-wrap: break-word;
}

.markdown-body > *:first-child { margin-top: 0 !important; }
.markdown-body > *:last-child { margin-bottom: 0 !important; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: #ffffff;
  font-weight: 700;
  line-height: 1.35;
  margin: 22px 0 10px 0;
}
.markdown-body h1 { font-size: 28px; }
.markdown-body h2 { font-size: 24px; }
.markdown-body h3 { font-size: 20px; }
.markdown-body h4 { font-size: 18px; }

.markdown-body p {
  margin: 0 0 12px 0;
}

.markdown-body strong {
  color: #ffffff;
  font-weight: 700;
}

.markdown-body em { font-style: italic; }

.markdown-body a {
  color: #f0936f;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 6px 0 14px 0;
  padding-left: 28px;
}
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body ul ul { list-style: circle; margin: 4px 0; }
.markdown-body ol ol, .markdown-body ol ul, .markdown-body ul ol { margin: 4px 0; }

.markdown-body li {
  margin: 4px 0;
  padding-left: 4px;
}
.markdown-body li > p { margin: 0 0 6px 0; }
.markdown-body li::marker { color: #a1a1aa; }

/* Inline code chip */
.markdown-body code {
  font-family: 'JetBrains Mono', Consolas, Menlo, Monaco, monospace;
  font-size: 15px;
  background-color: #2a2a30;
  border: 1px solid #3a3a42;
  color: #f4f4f5;
  padding: 1px 6px;
  border-radius: 5px;
}

/* Code block */
.markdown-body pre {
  background-color: #141416;
  border: 1px solid #2d2d34;
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 12px 0 16px 0;
  line-height: 1.55;
}
.markdown-body pre code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-size: 15px;
  white-space: pre;
}
.markdown-body pre::-webkit-scrollbar { height: 8px; }
.markdown-body pre::-webkit-scrollbar-thumb { background: #4a4a52; border-radius: 4px; }

.markdown-body hr {
  border: none;
  border-top: 1px solid #3f3f46;
  margin: 20px 0;
}

.markdown-body blockquote {
  border-left: 3px solid var(--coral-accent);
  padding: 4px 0 4px 14px;
  margin: 12px 0;
  color: #a1a1aa;
}

.markdown-body table {
  border-collapse: collapse;
  margin: 12px 0 16px 0;
  width: 100%;
  font-size: 16px;
  display: block;
  overflow-x: auto;
}
.markdown-body th,
.markdown-body td {
  border: 1px solid #3f3f46;
  padding: 8px 12px;
  text-align: left;
}
.markdown-body th {
  background-color: #222228;
  color: #fff;
  font-weight: 600;
}
.markdown-body tr:nth-child(even) td { background-color: #1a1a1f; }

/* Queued user messages */
.message-bubble.user.queued {
  opacity: 0.6;
  border-style: dashed;
}
.queued-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: #fdba74;
}

.attached-files-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.file-badge {
  background-color: rgba(224, 108, 75, 0.15);
  border: 1px solid var(--coral-accent);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Terminal Container */
.terminal-container {
  flex: 1;
  background-color: #101012;
  padding: 12px;
  overflow: hidden;
}

#xtermTerminal {
  height: 100%;
  width: 100%;
}

/* Attachments preview bar */
.attachments-preview-bar {
  padding: 8px 20px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.attachment-chips-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #fff;
}

.remove-chip-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

.remove-chip-btn:hover {
  color: #fff;
}

/* ---------------- BOTTOM DOCK ---------------- */
.bottom-dock {
  background-color: var(--bg-primary);
  padding: 12px 20px 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
}

.input-card {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 8px 14px;
  gap: 10px;
  transition: border-color 0.15s ease;
}

.input-card:focus-within {
  border-color: var(--coral-accent);
}

.message-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  resize: none;
  max-height: 160px;
  line-height: 1.4;
}

.message-textarea::placeholder {
  color: var(--text-sub);
}

.send-btn {
  background-color: var(--coral-accent);
  color: #fff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.send-btn:hover {
  background-color: var(--coral-hover);
  transform: scale(1.05);
}

.send-btn:active {
  background-color: var(--coral-active);
  transform: scale(0.95);
}

.bottom-action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-pill-btn:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
  border-color: var(--border-light);
}

.stop-pill-btn {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.stop-pill-btn:hover {
  background-color: #ef4444;
  color: #fff;
}

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

/* Responsive */
@media (max-width: 640px) {
  .brand-title {
    font-size: 42px;
  }
  .sessions-drawer {
    width: 100%;
    right: -100%;
  }
  .tab-item {
    max-width: 140px;
    min-width: 80px;
  }
}

/* ----------------- SECURITY PASSKEY MODAL ----------------- */
.security-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #0f0f12;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

.security-modal {
  background: #17181e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 38px 32px 30px 32px;
  width: 100%;
  max-width: 410px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(224, 108, 75, 0.15);
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.security-icon-circle {
  width: 68px;
  height: 68px;
  margin: 0 auto 20px auto;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(224, 108, 75, 0.25), rgba(224, 108, 75, 0.05));
  border: 1px solid rgba(224, 108, 75, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 0 25px rgba(224, 108, 75, 0.3);
}

.security-title {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.security-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 26px;
  line-height: 1.45;
}

.passkey-input-wrapper {
  margin-bottom: 14px;
}

.passkey-input {
  width: 100%;
  background-color: #0c0d10;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 28px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  letter-spacing: 14px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  outline: none;
  transition: all 0.2s ease;
}

.passkey-input:focus {
  border-color: var(--coral-accent);
  box-shadow: 0 0 20px rgba(224, 108, 75, 0.4);
  background-color: #121318;
}

.passkey-error {
  color: #ef4444;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  animation: passkeyShake 0.35s ease;
}

.passkey-submit-btn {
  width: 100%;
  background-color: var(--coral-accent);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(224, 108, 75, 0.35);
  transition: all 0.15s ease;
}

.passkey-submit-btn:hover {
  background-color: var(--coral-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(224, 108, 75, 0.45);
}

.passkey-submit-btn:active {
  transform: translateY(0);
}

.btn-arrow {
  font-size: 17px;
  transition: transform 0.15s ease;
}

.passkey-submit-btn:hover .btn-arrow {
  transform: translateX(3px);
}

.security-footer {
  margin-top: 24px;
  font-size: 11px;
  color: #52525b;
}

@keyframes passkeyShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@keyframes modalScaleIn {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
