:root,
.app-shell[data-theme="carbon"] {
  --bg-body: #050505;
  --bg-panel: #0d0d0d;
  --bg-panel-subtle: #141414;
  --bg-hover: #1f1f1f;
  --bg-active: #2b2b2b;
  --border-color: #242424;
  --border-focus: #52525b;
  
  --text-primary: #f4f4f5;
  --text-secondary: #8e8e93;
  --text-muted: #636366;
  
  --btn-primary-bg: #ffffff;
  --btn-primary-text: #000000;
  
  --accent: #ffffff;
  --accent-hover: #e5e5ea;
  --accent-light: #242424;
  --accent-badge: rgba(255, 255, 255, 0.12);
  --accent-text: #ffffff;
  --accent-grad: linear-gradient(135deg, #27272a 0%, #141414 100%);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.6);
}

.app-shell[data-theme="purple"] {
  --bg-body: #07050a;
  --bg-panel: #0d0a14;
  --bg-panel-subtle: #120e1b;
  --bg-hover: #1c152a;
  --bg-active: #281e3d;
  --border-color: #241b36;
  --border-focus: #a855f7;
  
  --text-primary: #f3f0fa;
  --text-secondary: #a89ec2;
  --text-muted: #6e6488;
  
  --btn-primary-bg: #9333ea;
  --btn-primary-text: #ffffff;
  
  --accent: #9333ea;
  --accent-hover: #7e22ce;
  --accent-light: rgba(147, 51, 234, 0.16);
  --accent-badge: rgba(147, 51, 234, 0.22);
  --accent-text: #c084fc;
  --accent-grad: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
}

.app-shell[data-theme="amber"] {
  --bg-body: #090806;
  --bg-panel: #110f0a;
  --bg-panel-subtle: #17140e;
  --bg-hover: #221d14;
  --bg-active: #31291b;
  --border-color: #2b2315;
  --border-focus: #f59e0b;
  
  --text-primary: #fbf7ee;
  --text-secondary: #c2b69d;
  --text-muted: #80755f;
  
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-light: rgba(217, 119, 6, 0.16);
  --accent-badge: rgba(217, 119, 6, 0.22);
  --accent-text: #fbbf24;
  --accent-grad: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.app-shell[data-theme="emerald"] {
  --bg-body: #040806;
  --bg-panel: #08120d;
  --bg-panel-subtle: #0d1a13;
  --bg-hover: #13261b;
  --bg-active: #1c3827;
  --border-color: #163022;
  --border-focus: #10b981;
  
  --text-primary: #ecfdf5;
  --text-secondary: #a7cfb9;
  --text-muted: #648a74;
  
  --accent: #059669;
  --accent-hover: #047857;
  --accent-light: rgba(5, 150, 105, 0.16);
  --accent-badge: rgba(5, 150, 105, 0.22);
  --accent-text: #34d399;
  --accent-grad: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.app-shell[data-theme="blue"] {
  --bg-body: #06090f;
  --bg-panel: #0a111c;
  --bg-panel-subtle: #0f1826;
  --bg-hover: #162236;
  --bg-active: #1e304d;
  --border-color: #1a2a42;
  --border-focus: #3b82f6;
  
  --text-primary: #f0f6fc;
  --text-secondary: #9bb2d1;
  --text-muted: #5e779b;
  
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.16);
  --accent-badge: rgba(37, 99, 235, 0.22);
  --accent-text: #60a5fa;
  --accent-grad: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.app-shell[data-theme="crimson"] {
  --bg-body: #0a0406;
  --bg-panel: #12070c;
  --bg-panel-subtle: #1a0c12;
  --bg-hover: #26111b;
  --bg-active: #381827;
  --border-color: #311421;
  --border-focus: #f43f5e;
  
  --text-primary: #fff1f2;
  --text-secondary: #cca0a8;
  --text-muted: #8c6069;
  
  --accent: #e11d48;
  --accent-hover: #be123c;
  --accent-light: rgba(225, 29, 72, 0.16);
  --accent-badge: rgba(225, 29, 72, 0.22);
  --accent-text: #fb7185;
  --accent-grad: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Top Navbar */
.topbar {
  height: 48px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 2;
  min-width: 0;
  text-align: center;
}

.topbar-chat-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.topbar-chat-title.editable {
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s ease, border-color 0.12s ease;
  user-select: none;
  border: 1px solid transparent;
  display: inline-block;
}

.topbar-chat-title.editable:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.topbar-title-edit-input {
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-focus);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
  outline: none;
  width: 220px;
  max-width: 380px;
  box-sizing: border-box;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1;
}

.topbar-user-status {
  display: flex;
  align-items: center;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-hover);
  border: none;
  padding: 3px 8px 3px 4px;
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-primary);
}

.user-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #000000);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
}

.user-name {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-topbar-login {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--btn-primary-text, #000000);
  background: var(--btn-primary-bg, var(--accent));
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.btn-topbar-login:hover {
  opacity: 0.9;
}

.brand {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-active);
  border: none;
  font-weight: 500;
}

/* Page Frame */
.page-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  max-width: none;
  width: 100%;
  height: calc(100vh - 48px);
  overflow: hidden;
}

/* 3-Pane Workspace Glass Architecture */
.workspace-panes {
  flex: 1;
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-panel);
  position: relative;
}

.pane {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Left Pane (Chats) */
.pane-left {
  width: 0;
  min-width: 0;
  opacity: 0;
  border-right: none;
  background: var(--bg-panel-subtle);
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
  will-change: width, opacity;
}

.pane-left.open {
  width: 260px;
  min-width: 260px;
  opacity: 1;
  border-right: 1px solid var(--border-color);
}

.pane-left .pane-content {
  width: 260px;
  min-width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  overflow: hidden;
}

.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.rail-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.btn-new-chat {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #000000);
  border: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 10px;
  transition: opacity 0.15s ease;
}

.btn-new-chat:hover {
  opacity: 0.9;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  text-align: left;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.conversation-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.conversation-item.active {
  background: var(--bg-active);
  color: var(--text-primary);
  font-weight: 500;
}

/* Center Main Pane (Chat) */
.pane-center {
  flex: 1;
  min-width: 0;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: flex 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Right Pane (Reusable Multi-Purpose Sidecar) */
.pane-right {
  width: 0;
  min-width: 0;
  opacity: 0;
  border-left: none;
  background: var(--bg-panel);
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
  will-change: width, opacity;
}

.pane-right.open {
  width: 440px;
  min-width: 440px;
  opacity: 1;
  border-left: 1px solid var(--border-color);
}

.pane-right .pane-content {
  width: 440px;
  min-width: 440px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Sidecar Navigation Tabs Header */
.sidecar-header-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: var(--bg-panel-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.sidecar-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.14s ease;
}

.sidecar-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidecar-tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-active);
  font-weight: 600;
}

/* Artifact Inspector & Preview */
.artifact-viewer {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  gap: 10px;
}

.artifact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.artifact-code-pre {
  margin: 0;
  padding: 12px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  overflow: auto;
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}

.artifact-live-preview {
  flex: 1;
  padding: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: auto;
}

/* Git Diff Inspector Styles */
.diff-viewer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.diff-file-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-panel-subtle);
  overflow: hidden;
}

.diff-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
}

.diff-lines-container {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  line-height: 1.4;
  overflow-x: auto;
}

.diff-line {
  display: flex;
  align-items: center;
  padding: 2px 8px;
  white-space: pre;
}

.diff-line.add {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.diff-line.delete {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.diff-line.header {
  background: var(--bg-hover);
  color: var(--text-muted);
  font-style: italic;
}

.diff-line-num {
  width: 32px;
  flex-shrink: 0;
  color: var(--text-muted);
  user-select: none;
  font-size: 10px;
}

.diff-line-content {
  flex: 1;
}

/* Pane Toggle Button */
.btn-pane-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
  padding: 0;
  transform: translateZ(0);
}

.btn-pane-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-pane-toggle.active {
  color: var(--text-primary);
  background: var(--bg-active);
}

.conv-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.conv-title {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.conv-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  opacity: 0.75;
}

.conversation-item:hover .conv-time {
  display: none;
}

.conv-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.conversation-item:hover .conv-delete {
  opacity: 0.7;
}

.conv-delete:hover {
  color: var(--danger);
  opacity: 1;
}

.rail-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* Chat Main Panel */
.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  min-width: 0;
  height: 100%;
}

.chat-header {
  height: 48px;
  border-bottom: none;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
}

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

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-header h1 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-new-chat-topbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-new-chat-topbar:hover {
  background: var(--bg-active);
  border-color: var(--border-focus);
}

.btn-subtle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-subtle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Animated Model Switcher Dropdown */
.model-dropdown-wrapper {
  position: relative;
  display: inline-flex;
}

.model-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.model-dropdown-trigger:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.model-dropdown-trigger.open {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.model-trigger-name {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.model-dropdown-chevron {
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.model-dropdown-chevron.open {
  transform: rotate(180deg);
  color: var(--text-primary);
}

.model-dropdown-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: transparent;
}

@keyframes modelDropdownEntrance {
  0% {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.model-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 250px;
  max-width: 320px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 5px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: modelDropdownEntrance 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.model-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  text-align: left;
  width: 100%;
}

.model-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.model-dropdown-item.active {
  background: var(--bg-active);
  color: var(--text-primary);
  font-weight: 600;
}

.model-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.model-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.model-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.model-item-vendor {
  font-size: 10px;
  color: var(--text-muted);
}

.model-item-favorite {
  color: #f59e0b;
  font-size: 12px;
  flex-shrink: 0;
}

.model-item-check {
  color: var(--accent);
  flex-shrink: 0;
}

/* Message Thread */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* Empty State */
.harness-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto;
  text-align: center;
  max-width: 440px;
  padding: 32px 16px;
  animation: emptyStateEntrance 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes emptyStateEntrance {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Message Entries Entrance Animation */
@keyframes messageEntrance {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.harness-empty-state h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--text-primary);
}

.harness-empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Message Entries */
.message-entry {
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  animation: messageEntrance 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.message-entry.user {
  align-items: flex-end;
  width: 100%;
}

.user-message-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  max-width: 65%;
  margin-left: auto;
}

.user-avatar-wrap {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message-entry.assistant {
  align-items: stretch;
  width: 100%;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.message-body {
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  box-sizing: border-box;
}

/* User Message: Crisp Accent Bubble with Compact Vertical Padding */
.user-body,
.message-entry.user .message-body {
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #000000);
  border: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  padding: 5.5px 13px;
  border-radius: var(--radius-md);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
  width: fit-content;
  max-width: 100%;
}

/* Assistant Message: Open, Clean Frameless Flow */
.message-entry.assistant .message-body {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 2px 0 4px 0;
  color: var(--text-primary);
  width: 100%;
  max-width: 100%;
  border-radius: 0;
}

/* Assistant Message Action Toolbar (Copy & Retry) */
.message-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.message-entry.assistant:hover .message-actions {
  opacity: 1;
}

.btn-msg-action {
  display: inline-flex;
  align-items: center;
  gap: 4.5px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-msg-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-msg-action:active {
  transform: scale(0.95);
}

.btn-msg-action.copied {
  color: #10b981;
}

/* Assistant Message Error Box with Expandable Diagnostics */
.message-error-box {
  margin-top: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.error-header {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ef4444;
  font-size: 12.5px;
  font-weight: 500;
}

.error-details-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: flex-start;
  transition: color 0.12s ease;
}

.error-details-toggle:hover {
  color: var(--text-primary);
}

.error-details-pre {
  margin: 4px 0 0 0;
  padding: 8px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #f87171;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

/* Markdown Rendering Styles */
.markdown-body-wrapper {
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.6;
}

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

.markdown-body-wrapper p:last-child {
  margin-bottom: 0;
}

.markdown-body-wrapper h1,
.markdown-body-wrapper h2,
.markdown-body-wrapper h3,
.markdown-body-wrapper h4 {
  color: var(--text-primary);
  font-weight: 600;
  margin: 14px 0 6px 0;
  line-height: 1.35;
}

.markdown-body-wrapper h1 { font-size: 16px; border-bottom: 1px solid var(--border-color); padding-bottom: 4px; }
.markdown-body-wrapper h2 { font-size: 15px; }
.markdown-body-wrapper h3 { font-size: 14px; }
.markdown-body-wrapper h4 { font-size: 13.5px; }

.markdown-body-wrapper ul,
.markdown-body-wrapper ol {
  margin: 4px 0 10px 0;
  padding-left: 22px;
}

.markdown-body-wrapper li {
  margin-bottom: 4px;
}

.markdown-body-wrapper blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--accent);
  background: var(--bg-panel);
  color: var(--text-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown-body-wrapper code:not(pre code) {
  background: var(--bg-hover);
  color: var(--accent-text);
  padding: 1.5px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  border: 1px solid var(--border-color);
}

.markdown-body-wrapper a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body-wrapper a:hover {
  opacity: 0.85;
}

.markdown-body-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12.5px;
}

.markdown-body-wrapper th,
.markdown-body-wrapper td {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
}

.markdown-body-wrapper th {
  background: var(--bg-hover);
  font-weight: 600;
}

/* Code Block Wrapper with Copy Button */
.code-block-wrapper {
  margin: 10px 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
}

.code-lang {
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 500;
  text-transform: lowercase;
}

.btn-copy-code {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}

.btn-copy-code:hover {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.btn-copy-code.copied {
  color: var(--success);
}

.code-block-wrapper pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  background: transparent;
}

.code-block-wrapper code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: var(--text-primary);
  font-family: inherit;
  font-size: inherit;
}

/* Attachment Tray */
.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 1000px;
  margin: 0 auto 8px auto;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.attachment-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-remove-attachment {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 11px;
  line-height: 1;
}

.btn-remove-attachment:hover {
  color: var(--danger);
}

.voice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: 0 auto 10px auto;
  min-height: 84px;
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--accent) 7%, var(--bg-panel-subtle)) 0%, var(--bg-panel-subtle) 56%, var(--bg-panel) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border-color));
  border-radius: 14px;
  padding: 10px 14px 10px 12px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--bg-body) 60%, transparent), inset 0 1px 0 color-mix(in srgb, var(--accent) 10%, transparent);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.voice-banner.user-voice {
  --voice-glow: var(--accent-text);
  border-color: color-mix(in srgb, var(--border-focus) 80%, var(--accent-text));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--bg-body) 62%, transparent), 0 0 24px color-mix(in srgb, var(--accent-text) 8%, transparent), inset 0 1px 0 color-mix(in srgb, var(--accent-text) 18%, transparent);
}

.voice-banner.assistant-voice {
  --voice-glow: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border-color));
  background: linear-gradient(105deg, color-mix(in srgb, var(--accent) 13%, var(--bg-panel-subtle)), var(--accent-light));
}

.voice-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.voice-visualizer {
  --audio-level: 0;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--voice-glow, var(--accent-text));
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--voice-glow, var(--accent-text)) 14%, transparent) 0%, transparent 64%);
}

.voice-visualizer::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-panel) 86%, transparent);
  box-shadow: 0 0 calc(12px + (var(--audio-level) * 18px)) color-mix(in srgb, var(--voice-glow, var(--accent-text)) 22%, transparent), inset 0 0 12px color-mix(in srgb, var(--voice-glow, var(--accent-text)) 12%, transparent);
  transform: scale(calc(0.96 + (var(--audio-level) * 0.08)));
  transition: transform 80ms ease-out, box-shadow 100ms ease-out;
}

.visualizer-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.ring-outer {
  inset: 1px;
  border: 1px solid color-mix(in srgb, var(--voice-glow, var(--accent-text)) 40%, transparent);
  border-right-color: transparent;
  border-bottom-color: color-mix(in srgb, var(--voice-glow, var(--accent-text)) 12%, transparent);
  animation: voiceOrbit 7s linear infinite;
}

.ring-inner {
  inset: 7px;
  border: 1px dashed color-mix(in srgb, var(--voice-glow, var(--accent-text)) 28%, transparent);
  animation: voiceOrbitReverse 11s linear infinite;
}

.visualizer-scan {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  overflow: hidden;
  opacity: 0.5;
}

.visualizer-scan::after {
  content: "";
  position: absolute;
  top: -10%;
  left: 20%;
  width: 1px;
  height: 120%;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--voice-glow, var(--accent-text)) 75%, transparent), transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--voice-glow, var(--accent-text)) 70%, transparent);
  transform-origin: 50% 50%;
  animation: voiceScan 3.2s ease-in-out infinite;
}

.visualizer-core {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid color-mix(in srgb, var(--voice-glow, var(--accent-text)) 42%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-panel) 70%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--voice-glow, var(--accent-text)) 20%, transparent);
}

.visualizer-core svg {
  width: 15px;
  height: 15px;
}

.visualizer-bars {
  position: absolute;
  z-index: 4;
  left: 13px;
  right: 13px;
  bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 15px;
  pointer-events: none;
}

.visualizer-bars .v-bar {
  width: 2px;
  height: 4px;
  background: var(--voice-glow, var(--accent-text));
  border-radius: 2px;
  opacity: 0.38;
  box-shadow: 0 0 5px color-mix(in srgb, var(--voice-glow, var(--accent-text)) 60%, transparent);
  transition: height 70ms ease-out, opacity 100ms ease-out;
}

.voice-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.voice-eyebrow {
  color: color-mix(in srgb, var(--voice-glow, var(--accent-text)) 75%, var(--text-muted));
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.14em;
  line-height: 1.3;
}

.voice-label {
  font-size: 13px;
  font-weight: 560;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-signal {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.3;
}

.voice-signal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--voice-glow, var(--accent-text));
  box-shadow: 0 0 7px color-mix(in srgb, var(--voice-glow, var(--accent-text)) 75%, transparent);
  animation: voiceSignal 1.6s ease-in-out infinite;
}

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

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

@keyframes voiceScan {
  0%, 100% { transform: rotate(-35deg); opacity: 0.15; }
  50% { transform: rotate(35deg); opacity: 0.8; }
}

@keyframes voiceSignal {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

.voice-banner.assistant-voice .voice-visualizer {
  animation: assistantCore 1.8s ease-in-out infinite;
}

@keyframes assistantCore {
  0%, 100% { filter: brightness(0.9); }
  50% { filter: brightness(1.2); }
}

.btn-stop-voice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--bg-panel) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-color) 85%, var(--voice-glow, var(--accent-text)));
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 550;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn-stop-voice svg {
  width: 13px;
  height: 13px;
}

.btn-stop-voice:hover {
  background: color-mix(in srgb, var(--voice-glow, var(--accent-text)) 12%, var(--bg-hover));
  border-color: color-mix(in srgb, var(--voice-glow, var(--accent-text)) 42%, var(--border-color));
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-stop-voice:active {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .ring-outer,
  .ring-inner,
  .visualizer-scan::after,
  .voice-signal-dot,
  .voice-banner.assistant-voice .voice-visualizer {
    animation: none;
  }
}

/* Focused voice mode: the visualizer owns the center of the conversation area. */
.voice-mode {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  overflow: hidden;
}

.voice-stage {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.voice-mode .voice-visualizer {
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  color: var(--accent-text);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-text) 9%, transparent) 0%, transparent 66%);
}

.voice-mode .voice-visualizer::before {
  inset: 27px;
  background: var(--bg-panel);
  box-shadow: 0 0 calc(14px + (var(--audio-level) * 22px)) color-mix(in srgb, var(--accent-text) 28%, transparent), inset 0 0 14px color-mix(in srgb, var(--accent-text) 11%, transparent);
  transform: scale(calc(0.96 + (var(--audio-level) * 0.1)));
}

.voice-mode .voice-visualizer::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid color-mix(in srgb, var(--accent-text) 16%, transparent);
  border-radius: 50%;
  animation: voicePulse 2.8s ease-in-out infinite;
}

.voice-mode .ring-outer {
  inset: 1px;
  border-color: color-mix(in srgb, var(--accent-text) 42%, transparent);
  border-right-color: transparent;
  border-bottom-color: color-mix(in srgb, var(--accent-text) 12%, transparent);
  animation: voiceOrbit 12s linear infinite;
}

.voice-mode .ring-inner {
  inset: 10px;
  border: 1px solid color-mix(in srgb, var(--accent-text) 18%, transparent);
  animation: none;
}

.voice-mode .visualizer-core {
  width: 42px;
  height: 42px;
  border-color: color-mix(in srgb, var(--accent-text) 34%, transparent);
  background: color-mix(in srgb, var(--bg-panel) 88%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent-text) 15%, transparent);
}

.voice-mode .visualizer-core svg {
  width: 19px;
  height: 19px;
}

.voice-mode .visualizer-bars {
  left: 25px;
  right: 25px;
  bottom: 21px;
  gap: 3px;
  height: 18px;
}

.voice-mode .visualizer-bars .v-bar {
  width: 2px;
  height: 4px;
  background: var(--accent-text);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent-text) 58%, transparent);
}

.voice-transcript {
  width: min(520px, 100%);
  min-height: 24px;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.voice-transcript-placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.voice-stage-stop {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.voice-stage-stop svg {
  width: 12px;
  height: 12px;
}

.voice-stage-stop:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

@keyframes voicePulse {
  0%, 100% { opacity: 0.35; transform: scale(0.96); }
  50% { opacity: 0.75; transform: scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  .voice-mode .voice-visualizer::after {
    animation: none;
  }
}

/* Composer Dock */
.composer-wrapper {
  padding: 10px 24px 18px;
  border-top: none;
  background: var(--bg-panel);
}

.composer-dock-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.composer-box {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  box-shadow: none;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.16s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.16s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.16s ease;
}

/* Context Mentions Popup */
.composer-box {
  position: relative;
}

.mention-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 10px;
  min-width: 280px;
  max-width: 380px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: modelDropdownEntrance 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.mention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background-color 0.12s ease;
}

.mention-item:hover,
.mention-item.selected {
  background: var(--bg-hover);
}

.mention-item-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mention-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.mention-title {
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-desc {
  font-size: 10.5px;
  color: var(--text-muted);
}

.mention-badge {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 9999px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Chat Telemetry Card in Settings Sheet */
.telemetry-card {
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.telemetry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.telemetry-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.telemetry-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.telemetry-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.telemetry-metric-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.telemetry-meter-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.telemetry-meter-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 9999px;
  overflow: hidden;
}

.telemetry-meter-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9999px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.telemetry-meter-legend {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
}

.composer-model-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.composer-model-dropdown {
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 0 10px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  min-width: 130px;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.14s ease, background-color 0.14s ease;
  height: 38px;
}

.composer-model-dropdown:hover {
  border-color: var(--border-focus);
  background: var(--bg-hover);
}

.composer-model-dropdown:focus {
  border-color: var(--border-focus);
}

.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 26px;
}

.composer-textarea {
  flex: 1;
  min-height: 24px;
  max-height: 160px;
  field-sizing: content;
  background: transparent;
  border: none;
  outline: none !important;
  box-shadow: none !important;
  resize: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 20px;
  padding: 2px 4px;
  margin: 0;
  display: block;
  overflow-y: auto;
}

.composer-textarea:focus,
.composer-textarea:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.composer-textarea::placeholder {
  color: var(--text-muted);
}

.composer-actions-left, .composer-actions-right {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 1px;
  flex-shrink: 0;
}

.btn-composer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
  padding: 0;
  flex-shrink: 0;
}

.btn-composer-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-composer-icon.voice-btn.active {
  background: var(--accent-light);
  color: var(--accent-text);
  border-color: var(--border-focus);
}

.audio-device-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.audio-device-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 208px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.audio-device-trigger:hover,
.audio-device-trigger.open {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.audio-device-trigger-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--accent-text);
}

.audio-device-trigger-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}

.audio-device-trigger-chevron {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  color: var(--text-muted);
  transition: transform 0.16s ease, color 0.16s ease;
}

.audio-device-trigger-chevron.open {
  transform: rotate(180deg);
  color: var(--text-primary);
}

.audio-device-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: transparent;
}

.audio-device-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 286px;
  max-height: min(420px, calc(100vh - 100px));
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.65), 0 8px 12px -8px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  animation: audioDeviceMenuEntrance 0.14s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.audio-device-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
}

.audio-device-menu-status {
  color: var(--success, #10b981);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audio-device-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0 3px;
}

.audio-device-section + .audio-device-section {
  margin-top: 4px;
  border-top: 1px solid var(--border-color);
}

.audio-device-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.audio-device-section-label svg {
  width: 13px;
  height: 13px;
  color: var(--accent-text);
}

.audio-device-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 5px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.audio-device-option:hover,
.audio-device-option.selected {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.audio-device-option.selected {
  box-shadow: inset 2px 0 0 var(--accent-text);
}

.audio-device-option-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 5px;
  background: var(--bg-panel-subtle);
  color: var(--text-muted);
}

.audio-device-option-icon svg {
  width: 13px;
  height: 13px;
}

.audio-device-option-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.audio-device-option-text > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.25;
}

.audio-device-option-text small {
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.25;
}

.audio-device-check {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: var(--accent-text);
}

.audio-device-empty {
  padding: 5px 8px 7px;
  color: var(--text-muted);
  font-size: 10px;
}

@keyframes audioDeviceMenuEntrance {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 600px) {
  .audio-device-trigger-label {
    display: none;
  }

  .audio-device-trigger {
    width: 26px;
    padding: 0;
    justify-content: center;
  }

  .audio-device-trigger-chevron {
    display: none;
  }

  .audio-device-menu {
    right: -4px;
    width: min(286px, calc(100vw - 32px));
  }
}

.btn-composer-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #000000);
  border: none;
  cursor: pointer;
  transition: opacity 0.12s ease, transform 0.08s cubic-bezier(0.2, 0, 0, 1);
  padding: 0;
  flex-shrink: 0;
}

.btn-composer-send.stop-btn {
  background: var(--danger, #ef4444);
  color: #ffffff;
}

.btn-composer-send:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-composer-send:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Settings Layout */
.settings-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  background: var(--bg-panel);
  border: none;
  border-radius: 0;
  overflow: hidden;
  height: 100%;
  width: 100%;
}

.settings-sidebar {
  background: var(--bg-panel-subtle);
  border-right: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-nav-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.settings-search-box {
  position: relative;
}

.settings-search-input {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

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

.settings-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.settings-nav-item:focus,
.settings-nav-item:focus-visible,
.settings-nav-item.active {
  background: var(--bg-active);
  color: var(--text-primary);
  border: none;
  outline: none;
  box-shadow: none;
  font-weight: 500;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  line-height: 1;
}

.nav-chevron.expanded {
  transform: rotate(90deg);
}

.settings-nav-sublist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  padding-left: 8px;
  border-left: 1px solid var(--border-color);
  margin-top: 2px;
  margin-bottom: 4px;
}

.settings-nav-subitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-nav-subitem:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.settings-nav-subitem:focus,
.settings-nav-subitem:focus-visible,
.settings-nav-subitem.active {
  background: var(--bg-active);
  color: var(--text-primary);
  border: none;
  outline: none;
  box-shadow: none;
  font-weight: 500;
}

.settings-sidebar {
  background: var(--bg-panel-subtle);
  border-right: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.settings-sidebar-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.settings-sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.btn-sidebar-save {
  width: 100%;
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #000000);
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sidebar-save:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-sidebar-save:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-sidebar-save.saved {
  background: var(--success);
  color: #ffffff;
}

.settings-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13.5px;
  white-space: nowrap;
}

.breadcrumb-part {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 11px;
  user-select: none;
  opacity: 0.5;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
}

.settings-content-area {
  flex: 1;
  padding: 28px 36px 48px;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
}

.settings-header {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: #ffffff;
}

/* Clean Settings List / Rows */
.settings-group {
  display: flex;
  flex-direction: column;
  border-top: none;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  gap: 24px;
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.setting-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

.setting-control {
  min-width: 200px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.setting-input {
  width: 220px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

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

.setting-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  outline: none;
  resize: vertical;
  min-height: 200px;
  transition: border-color 0.15s ease;
}

.setting-textarea:focus {
  border-color: var(--border-focus);
}

.setting-select {
  width: 220px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.setting-select:focus {
  border-color: var(--border-focus);
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.setting-checkbox {
  accent-color: var(--btn-primary-bg, var(--accent));
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.setting-value {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hover);
  border: none;
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-active);
}

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-text);
  text-decoration: none;
  font-size: 12.5px;
}

.link-action:hover {
  text-decoration: underline;
}

/* Theme List in Settings */
/* Unboxed Theme List in Settings */
.theme-section-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.theme-subtitle {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.theme-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
  border-bottom: 1px solid var(--border-color);
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.theme-row:last-child {
  border-bottom: none;
}

.theme-row:hover {
  background: var(--bg-hover);
}

.theme-row.selected {
  background: var(--bg-active);
}

.theme-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-radio-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border-focus);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-row.selected .theme-radio-dot {
  border-color: var(--btn-primary-bg, var(--accent));
  background: var(--btn-primary-bg, var(--accent));
}

.theme-row.selected .theme-radio-dot::after {
  content: "";
  width: 4px;
  height: 4px;
  background: #000000;
  border-radius: 50%;
}

.theme-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-row-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.theme-row-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Subtle Confirm Modal */
.modal-dialog-confirm {
  width: 420px;
  max-width: 90vw;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

.confirm-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.confirm-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.btn-danger-subtle {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-subtle:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
  .workspace, .settings-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 100px);
  }
  .conversation-rail {
    display: none;
  }
  .settings-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .page-frame {
    padding: 8px;
  }
  .settings-content-area {
    padding: 16px;
  }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-panel);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* Theme Selector Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.theme-card {
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.theme-card:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.theme-card.active {
  border-color: var(--accent);
  background: var(--bg-active);
  box-shadow: 0 0 0 1px var(--accent);
}

.theme-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.theme-active-tag {
  font-size: 11px;
  color: var(--accent-text);
  font-weight: 600;
}

.theme-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.theme-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.swatch-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

/* Sub-Navigation Tabs */
.subnav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.subnav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.subnav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.subnav-tab.active {
  color: var(--text-primary);
  background: var(--bg-active);
  font-weight: 600;
}

/* Models List */
.models-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.models-search {
  flex: 1;
  max-width: 320px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
}

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

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #ffffff);
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

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

.models-list {
  display: flex;
  flex-direction: column;
  border-top: none;
}

.model-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.model-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.star-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
}

.star-btn:hover {
  color: #fbbf24;
}

.star-btn.active {
  color: #fbbf24;
}

.model-info-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

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

.model-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.model-id-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.model-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.model-provider-badge {
  color: var(--text-secondary);
  font-weight: 500;
}

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

.btn-remove-model {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.btn-remove-model:hover {
  color: var(--danger);
}

.provider-status {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: inline-block;
}

.provider-status.connected {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.provider-status.disconnected {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--bg-panel-subtle);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: all 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateZ(0);
}

.btn-icon-action:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.spin {
  animation: spin 1s linear infinite;
}

.provider-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.provider-input {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

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

.provider-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalBackdropFadeIn 0.15s ease-out forwards;
}

@keyframes modalBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalEntrance {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(6px) translateZ(0);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0) translateZ(0);
  }
}

.modal-dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 680px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalEntrance 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.provider-modal-dialog {
  max-width: 520px;
}

.modal-dialog-confirm {
  width: 420px;
  max-width: 90vw;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
  animation: modalEntrance 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
  transform: translateZ(0);
}

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

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
  transform: translateZ(0);
}

.btn-close-modal:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-close-modal:active {
  transform: scale(0.92) translateZ(0);
}

.discovery-modal-dialog {
  max-width: 720px;
  height: 80vh;
  max-height: 640px;
  display: flex;
  flex-direction: column;
}

.modal-search-bar {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.modal-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.modal-search-clear-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color 0.12s ease;
}

.modal-search-clear-btn:hover {
  color: var(--text-primary);
}

.modal-search-input {
  width: 100%;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 34px 9px 36px;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.14s ease;
}

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

.filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 2px 0;
  margin: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6.5px;
  background: var(--bg-panel-subtle);
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateZ(0);
  will-change: transform;
}

.filter-chip:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-chip:active {
  transform: scale(0.95) translateZ(0);
}

.filter-chip.active {
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #ffffff);
  border: none;
  font-weight: 500;
}

.filter-chip-count {
  font-size: 10.5px;
  opacity: 0.85;
  margin-left: 5px;
  font-weight: 600;
}

.modal-body,
.discovery-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-focus) transparent;
}

.modal-body::-webkit-scrollbar,
.discovery-modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track,
.discovery-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb,
.discovery-modal-body::-webkit-scrollbar-thumb {
  background: var(--border-focus, rgba(255, 255, 255, 0.18));
  border-radius: 9999px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.discovery-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted, rgba(255, 255, 255, 0.35));
}

.discovery-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.12s ease;
  transform: translateZ(0);
  gap: 12px;
}

.discovery-row:last-child {
  border-bottom: none;
}

.discovery-row:hover {
  background: var(--bg-hover);
}

.discovery-row.selected {
  background: var(--bg-active);
}

.discovery-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.discovery-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.custom-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--bg-panel-subtle);
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--btn-primary-text, #ffffff);
  transition: all 0.12s ease;
}

.custom-checkbox.checked {
  background: var(--btn-primary-bg, var(--accent));
  border-color: var(--btn-primary-bg, var(--accent));
}

.model-vendor-pill {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1.5px 7px;
  border-radius: 9999px;
  background: var(--bg-panel-subtle);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.model-vendor-pill.vendor-anthropic {
  background: rgba(249, 115, 22, 0.12);
  color: #fb923c;
}

.model-vendor-pill.vendor-openai {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.model-vendor-pill.vendor-deepseek {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}

.model-vendor-pill.vendor-google {
  background: rgba(236, 72, 153, 0.12);
  color: #f472b6;
}

.model-vendor-pill.vendor-meta {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
}

.model-vendor-pill.vendor-xai {
  background: rgba(234, 179, 8, 0.12);
  color: #facc15;
}

.model-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 2px;
  transition: transform 0.12s ease;
}

.model-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.model-added-pill {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--success-bg, rgba(16, 185, 129, 0.12));
  color: var(--success, #10b981);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.model-ctx-badge {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-subtle);
  color: var(--text-secondary);
}

.discovery-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discovery-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.selection-pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.selection-pill.has-selected {
  color: var(--accent-text, var(--accent));
  font-weight: 600;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel-subtle);
}

.modal-footer-stats {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.btn-subtle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-danger-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.btn-danger-subtle:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #ffffff;
}

/* Themed Primary Action Button */
.btn-primary-action,
.shadcn-btn-default {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, #ffffff);
  border: 1px solid transparent;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-primary-action:hover:not(:disabled),
.shadcn-btn-default:hover:not(:disabled) {
  opacity: 0.92;
  filter: brightness(1.08);
}

.btn-primary-action:disabled,
.shadcn-btn-default:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Themed ShadCN Button System */
.shadcn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.14s ease;
}

.shadcn-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shadcn-btn-size-default {
  padding: 6px 14px;
  font-size: 12.5px;
}

.shadcn-btn-size-sm {
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
}

.shadcn-btn-size-lg {
  padding: 9px 18px;
  font-size: 13.5px;
}

.shadcn-btn-size-icon {
  width: 28px;
  height: 28px;
  padding: 0;
}

/* Themed Outline Variant */
.shadcn-btn-outline {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.shadcn-btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent-text, var(--text-primary));
}

/* Themed Destructive Variant */
.shadcn-btn-destructive {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.shadcn-btn-destructive:hover:not(:disabled) {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Themed Secondary / Ghost Variant */
.shadcn-btn-secondary {
  background: var(--bg-hover);
  border: 1px solid transparent;
  color: var(--text-primary);
}

.shadcn-btn-secondary:hover:not(:disabled) {
  background: var(--bg-active);
}

.shadcn-btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.shadcn-btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Global Hardware Accelerated Micro-Interactions */
button, input, select, textarea {
  -webkit-font-smoothing: antialiased;
}

button:focus,
button:focus-visible,
a:focus,
a:focus-visible {
  outline: none;
  box-shadow: none;
}

button:not(:disabled),
.btn-primary-action:not(:disabled),
.btn-composer-send:not(:disabled),
.btn-new-chat:not(:disabled),
.btn-secondary:not(:disabled),
.btn-sidebar-save:not(:disabled),
.btn-pane-toggle:not(:disabled),
.btn-composer-icon:not(:disabled),
.btn-subtle:not(:disabled),
.btn-danger-subtle:not(:disabled),
.shadcn-btn:not(:disabled) {
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.14s ease,
              border-color 0.14s ease,
              color 0.14s ease,
              box-shadow 0.14s ease;
}

button:active:not(:disabled),
.btn-primary-action:active:not(:disabled),
.btn-composer-send:active:not(:disabled),
.btn-new-chat:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.btn-sidebar-save:active:not(:disabled),
.btn-pane-toggle:active:not(:disabled),
.btn-composer-icon:active:not(:disabled),
.btn-subtle:active:not(:disabled),
.btn-danger-subtle:active:not(:disabled),
.shadcn-btn:active:not(:disabled) {
  transform: scale(0.965) translateZ(0);
}

.nav-chevron {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  transform: translateZ(0);
}

.nav-chevron.expanded {
  transform: rotate(90deg) translateZ(0);
}

.settings-nav-item, .settings-nav-subitem, .conversation-item, .theme-row {
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform, background-color;
  transition: background-color 0.12s cubic-bezier(0.16, 1, 0.3, 1), color 0.12s ease;
}

/* Chat Settings Toggle Button in Chat Header */
.btn-chat-settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  transform: translateZ(0);
}

.btn-chat-settings-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-chat-settings-toggle.active {
  background: var(--bg-active);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.sheet-header {
  height: 48px;
  padding: 0 16px;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  flex-shrink: 0;
}

.sheet-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close-sheet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
  padding: 0;
}

.btn-close-sheet:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-danger-zone {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-danger-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-danger-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.sheet-danger-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.sheet-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sheet-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.sheet-input {
  width: 100%;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.14s ease;
}

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

.sheet-select {
  width: 100%;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color 0.14s ease;
}

.sheet-select:focus {
  border-color: var(--border-focus);
}

.sheet-textarea {
  width: 100%;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.5;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.14s ease;
}

.sheet-textarea:focus {
  border-color: var(--border-focus);
}

/* About Page */
.about-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 680px;
}

.about-hero-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.about-logo-wrapper {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px;
}

.about-2helix-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.about-hero-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.about-app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.about-version-badge {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.02em;
}

.about-tagline {
  margin: 4px 0 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Tool Call Cards */
.tool-call-card {
  margin: 6px 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.15s ease;
}

.tool-call-card.running {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb, 99, 102, 241), 0.15);
}

.tool-call-card.error {
  border-color: var(--danger, #ef4444);
}

.tool-call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  background: var(--bg-panel-subtle);
  user-select: none;
}

.tool-call-header:hover {
  background: var(--bg-hover);
}

.tool-call-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tool-call-icon {
  font-size: 14px;
}

.tool-call-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.tool-call-args-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.tool-call-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-status-badge {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-status-badge.running {
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.15);
  color: var(--accent);
}

.tool-status-badge.success {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.tool-status-badge.error {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.spinner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1s infinite alternate ease-in-out;
}

@keyframes pulseDot {
  0% { transform: scale(0.6); opacity: 0.4; }
  100% { transform: scale(1.1); opacity: 1; }
}

.tool-chevron {
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.tool-chevron.expanded {
  transform: rotate(180deg);
}

.tool-call-body {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.tool-code-block {
  margin: 0;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-primary);
  max-height: 240px;
}

.tool-code-block.error-output {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

/* Topbar Tabs & Divider */
.topbar-tabs-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
}

.topbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 4px;
}

.topbar-tabs-list {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 650px;
  overflow-x: auto;
}

.topbar-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 12px;
  min-width: 110px;
  max-width: 200px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
  user-select: none;
  white-space: nowrap;
}

.topbar-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-tab.active {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

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

.topbar-tab-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 9px;
  padding: 1px 3px;
  border-radius: 2px;
  cursor: pointer;
  opacity: 0.5;
  margin-left: 2px;
}

.topbar-tab-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: var(--danger);
}

.btn-new-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-new-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-toolbox-pin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--border-color);
  transition: all 0.12s ease;
}

.btn-toolbox-pin:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn-toolbox-pin.active {
  color: var(--text-primary);
  background: var(--bg-panel);
  border-color: var(--border-focus);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Full-Screen Dark Minimalist Sign In Page (Purple Theme & Crisp Unsplash)
   ========================================================================== */
.page-frame.login-frame {
  padding: 0;
  max-width: 100%;
  height: 100vh;
  overflow: hidden;
}

.gram-auth-page-purple {
  display: flex;
  width: 100vw;
  height: 100vh;
  background: var(--bg-body, #07050a);
  color: var(--text-primary, #f3f0fa);
  overflow: hidden;
}

.gram-auth-form-column {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--bg-body, #07050a);
  overflow-y: auto;
  z-index: 2;
}

.gram-auth-form-box {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gram-auth-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-panel-subtle, #120e1b);
  border: 1px solid var(--border-color, #241b36);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.gram-auth-headings {
  margin-bottom: 28px;
}

.gram-auth-heading-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary, #f3f0fa);
  margin: 0 0 8px 0;
}

.gram-auth-heading-sub {
  font-size: 13px;
  color: var(--text-secondary, #a89ec2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.gram-auth-text-link {
  background: transparent;
  border: none;
  color: #c084fc;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color 0.12s ease;
}

.gram-auth-text-link:hover {
  color: #e9d5ff;
  text-decoration: underline;
}

.gram-auth-text-link.sm {
  font-size: 12px;
  font-weight: 500;
}

.gram-auth-alert-error {
  width: 100%;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  border-radius: var(--radius-sm, 4px);
  font-size: 12px;
  text-align: left;
  margin-bottom: 16px;
}

.gram-auth-form-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gram-auth-field {
  position: relative;
  width: 100%;
}

.gram-auth-dark-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-primary, #f3f0fa);
  background: var(--bg-panel, #0d0a14);
  border: 1px solid var(--border-color, #241b36);
  border-radius: var(--radius-sm, 6px);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.gram-auth-dark-input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25);
}

.gram-auth-dark-input::placeholder {
  color: var(--text-muted, #6e6488);
}

.gram-auth-field.has-toggle .gram-auth-dark-input {
  padding-right: 40px;
}

.gram-auth-eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted, #6e6488);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease;
}

.gram-auth-eye-btn:hover {
  color: var(--text-secondary, #a89ec2);
}

.gram-auth-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 6px 0;
  width: 100%;
}

.gram-auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary, #a89ec2);
  cursor: pointer;
  user-select: none;
}

.gram-auth-check {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1.5px solid var(--border-color, #241b36);
  background: var(--bg-panel, #0d0a14);
  accent-color: #9333ea;
  cursor: pointer;
}

.gram-auth-submit-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 6px);
  background: #9333ea;
  color: #ffffff;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

.gram-auth-submit-btn:hover:not(:disabled) {
  background: #7e22ce;
}

.gram-auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Right Unsplash Image Column - Crisp, Sharp with subtle border separation */
.gram-auth-image-column {
  flex: 1.25;
  position: relative;
  overflow: hidden;
  background: #000000;
  display: flex;
  border-left: 1px solid var(--border-color, #241b36);
}

.gram-auth-unsplash-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 860px) {
  .gram-auth-image-column {
    display: none;
  }
}
