* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --purple: #bc8cff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Noto Sans, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

#app { display: flex; height: 100vh; }

.hidden { display: none !important; }

/* ============================================================ */
/* Buttons                                                       */
/* ============================================================ */
.btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--red); border-color: rgba(248,81,73,0.3); }
.btn-danger:hover { background: rgba(248,81,73,0.15); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 4px 8px; font-size: 16px; border: none; background: none; }
.btn-block { display: block; width: 100%; }

.input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.input:focus { border-color: var(--accent); }

/* ============================================================ */
/* Auth Page                                                     */
/* ============================================================ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-primary);
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 360px;
}

.auth-title {
  text-align: center;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 24px;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .input { padding: 10px 12px; }

.auth-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider-text {
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-wx {
  background: #07c160;
  color: #fff;
  border-color: #07c160;
}
.btn-wx:hover { background: #06ad56; }

/* ============================================================ */
/* Main App                                                      */
/* ============================================================ */
#main-app {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================ */
/* Index View (account list)                                     */
/* ============================================================ */
.index-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-primary);
}

.index-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.index-toolbar-left, .index-toolbar-right { display: flex; align-items: center; gap: 8px; }

.conn-status {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 10px;
}
.conn-status.online { background: rgba(63,185,80,0.15); color: var(--green); }
.conn-status.offline { background: rgba(248,81,73,0.15); color: var(--red); }

.index-empty {
  text-align: center;
  padding: 60px 24px;
}
.index-empty-text { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.index-empty-sub { font-size: 13px; color: var(--text-muted); }

.account-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.account-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
}
.account-header:hover { background: rgba(255,255,255,0.02); }

.account-info { flex: 1; min-width: 0; }
.account-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.account-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-id {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.account-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.status-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
}
.status-tag.online { background: rgba(63,185,80,0.15); color: var(--green); }
.status-tag.offline { background: rgba(248,81,73,0.15); color: var(--red); }

.type-tag {
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.type-tag.opencode { background: rgba(56,139,253,0.15); color: var(--accent); }
.type-tag.claude { background: rgba(210,153,34,0.15); color: var(--yellow); }

.btn-unbind {
  font-size: 11px;
  color: var(--red);
  padding: 2px 10px;
  background: rgba(248,81,73,0.1);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.btn-unbind:hover { background: rgba(248,81,73,0.2); }

.terminal-list {
  border-top: 1px solid var(--bg-tertiary);
  padding: 4px 0;
}

.terminal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 12px 28px;
  cursor: pointer;
}
.terminal-item:hover { background: rgba(88,166,255,0.05); }

.terminal-info { flex: 1; min-width: 0; }
.terminal-title {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.terminal-dir {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-arrow {
  font-size: 18px;
  color: var(--bg-hover);
  margin-left: 8px;
  flex-shrink: 0;
}

.terminal-empty {
  padding: 12px 28px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================ */
/* Chat View                                                     */
/* ============================================================ */
.chat-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-status {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  flex-shrink: 0;
}
.chat-status.idle { background: rgba(63,185,80,0.15); color: var(--green); }
.chat-status.busy { background: rgba(210,153,34,0.15); color: var(--yellow); }
.chat-status.error { background: rgba(248,81,73,0.15); color: var(--red); }

.chat-header-right {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Permission / Question bars */
.permission-bar, .question-bar {
  padding: 10px 16px;
  flex-shrink: 0;
}
.permission-bar { background: rgba(210,153,34,0.1); border-bottom: 1px solid rgba(210,153,34,0.3); }
.question-bar { background: rgba(88,166,255,0.1); border-bottom: 1px solid rgba(88,166,255,0.3); }

#permission-text { color: var(--yellow); font-size: 13px; }
.question-header { display: block; color: var(--text); font-size: 14px; font-weight: 600; margin-bottom: 2px; }
#question-text { display: block; color: var(--text-secondary); font-size: 13px; margin-bottom: 10px; line-height: 1.5; }
.question-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.question-item { padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.question-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.question-option { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-primary); cursor: pointer; }
.question-option:hover { border-color: var(--accent); }
.question-option.selected { border-color: var(--accent); background: rgba(88,166,255,0.15); }
.question-option .opt-label { display: block; color: var(--text); font-size: 13px; font-weight: 500; }
.question-option .opt-desc { display: block; color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

.permission-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.permission-btns { display: flex; gap: 8px; flex-shrink: 0; }

.question-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.question-actions .input { flex: 1; padding: 6px 10px; font-size: 13px; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.history-indicator {
  text-align: center;
  padding: 8px 0 4px;
}

.history-loading-text {
  font-size: 13px;
  color: #6e7681;
}

.history-hint-text {
  font-size: 12px;
  color: #484f58;
}

.tool-detail-card {
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 8px 0;
  overflow: hidden;
}

.tool-detail-top {
  display: flex;
  align-items: center;
  padding: 10px 12px 0;
  gap: 12px;
}

.tool-detail-name {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

.tool-detail-toggle {
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  margin-left: auto;
}

.tool-detail-cmd {
  background: #2d2d2d;
  border-radius: 4px;
  margin: 8px 12px;
  padding: 8px 12px;
  overflow-x: auto;
}

.tool-detail-cmd code {
  font-family: Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: #ccc;
  white-space: nowrap;
}

.tool-detail-output {
  border-top: 1px solid #21262d;
  padding: 10px 12px;
}

.tool-detail-output .md-content pre {
  max-height: 400px;
  overflow-y: auto;
}

.msg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 100%;
}

.msg-row.user { justify-content: flex-end; }

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.msg-row.user .msg-avatar { background: rgba(88,166,255,0.2); color: var(--accent); order: 1; }
.msg-row.assistant .msg-avatar { background: rgba(188,140,255,0.2); color: var(--purple); }

.msg-body { flex: 1; min-width: 0; }
.msg-row.user .msg-body { flex: 0 1 auto; max-width: 80%; order: 0; }

.msg-role-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.msg-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  overflow: hidden;
}

.msg-row.user .msg-content {
  background: rgba(88,166,255,0.1);
  border-color: rgba(88,166,255,0.2);
}

.msg-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  word-break: break-word;
}

/* Markdown content */
.md-content {
  overflow-wrap: break-word;
}

.md-content p {
  margin: 0 0 8px;
}
.md-content p:last-child {
  margin-bottom: 0;
}

.md-content h1, .md-content h2, .md-content h3,
.md-content h4, .md-content h5, .md-content h6 {
  margin: 12px 0 6px;
  font-weight: 600;
  color: var(--text-primary);
}
.md-content h1 { font-size: 20px; }
.md-content h2 { font-size: 17px; }
.md-content h3 { font-size: 15px; }
.md-content h4, .md-content h5, .md-content h6 { font-size: 14px; }
.md-content h1:first-child, .md-content h2:first-child, .md-content h3:first-child {
  margin-top: 0;
}

.md-content pre {
  background: #272822;
  border: none;
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

.md-content pre code {
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 13px;
  background: none;
  padding: 0;
  color: inherit;
}

.md-content .code-lang {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 11px;
  color: #75715e;
  font-family: inherit;
  text-transform: uppercase;
  pointer-events: none;
}

.md-content :not(pre) > code {
  background: #272822;
  padding: 2px 6px;
  border-radius: 4px;
  color: #a6e22e;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 13px;
}

.md-content ul, .md-content ol {
  margin: 6px 0;
  padding-left: 20px;
}

.md-content li {
  margin: 2px 0;
}

.md-content blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  background: rgba(88,166,255,0.05);
}

.md-content a {
  color: var(--accent);
  text-decoration: none;
}
.md-content a:hover {
  text-decoration: underline;
}

.md-content .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0;
}

.md-content .table-wrapper table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}

.md-content th, .md-content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.md-content th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

.md-content img {
  max-width: 100%;
  border-radius: 6px;
}

.md-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

.md-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.md-content em {
  font-style: italic;
}

.msg-thinking-block {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(110, 118, 129, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(48, 54, 61, 0.6);
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
}

.thinking-icon { font-size: 10px; color: var(--text-muted); }
.thinking-icon::after { content: "▾"; }
.msg-thinking-block.collapsed .thinking-icon::after { content: "▸"; }

.thinking-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.msg-thinking {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-thinking.md-content {
  white-space: normal;
  font-style: normal;
}

.msg-thinking.md-content p {
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 6px;
}

.msg-thinking.md-content p:last-child {
  margin-bottom: 0;
}

.msg-thinking.md-content code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: Menlo, Monaco, Consolas, monospace;
}

.msg-thinking.md-content pre {
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  margin: 6px 0;
  font-style: normal;
}

.msg-thinking.md-content pre code {
  background: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.msg-thinking.md-content ul,
.msg-thinking.md-content ol {
  padding-left: 20px;
  margin: 4px 0;
}

.msg-thinking.md-content li {
  color: var(--text-muted);
  font-style: italic;
}

.msg-thinking.md-content strong,
.msg-thinking.md-content em {
  color: var(--text-secondary);
}

.msg-thinking-block.collapsed .msg-thinking { display: none; }
.msg-thinking-block.collapsed .thinking-header { margin-bottom: 0; }

.msg-tool {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  margin-top: 6px;
}

.msg-tool-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.msg-tool-text {
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.msg-tool-questions { margin-top: 6px; }
.tool-q-block { margin-bottom: 10px; }
.tool-q-block:last-child { margin-bottom: 0; }
.tool-q-label { font-size: 11px; color: #6e7681; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.tool-q-text { font-size: 13px; color: var(--text); margin: 3px 0 6px 0; line-height: 1.4; }
.tool-q-options { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-q-opt { font-size: 12px; color: #8b949e; background: #21262d; border: 1px solid #30363d; border-radius: 4px; padding: 3px 10px; }
.tool-q-opt.selected { color: #fff; background: rgba(88,166,255,0.2); border-color: #58a6ff; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.chat-input-area {
  padding: 12px 16px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.agent-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.agent-pill {
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.agent-pill.active {
  background: rgba(88,166,255,0.15);
  color: var(--accent);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  line-height: 1.4;
  max-height: 200px;
  min-height: 40px;
  outline: none;
}
.chat-input:focus { border-color: var(--accent); }

.btn-send {
  padding: 10px 20px;
  height: 40px;
  flex-shrink: 0;
}

/* ============================================================ */
/* File Panel                                                    */
/* ============================================================ */
.file-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.file-panel-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

.file-panel-path {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-panel-list { flex: 1; overflow-y: auto; }

.file-item {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.file-item:hover { background: var(--bg-tertiary); }
.file-item-dir { color: var(--accent); }
.file-item-file { color: var(--text-primary); }
.file-icon { font-size: 13px; flex-shrink: 0; }

.file-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================ */
/* Modals                                                        */
/* ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 15px; }

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* How-to Modal */
.howto-modal { width: 480px; }
.howto-desc { color: #8b949e; font-size: 13px; margin: 0 0 12px; }
.howto-section { margin-bottom: 4px; }
.howto-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.howto-label { color: #e6edf3; font-size: 13px; font-weight: 600; }
.howto-copy-btn {
  background: none;
  border: 1px solid #30363d;
  color: #8b949e;
  font-size: 12px;
  padding: 2px 0;
  border-radius: 4px;
  cursor: pointer;
  width: 48px;
  text-align: center;
}
.howto-copy-btn.copied {
  color: #3fb950;
  border-color: #3fb950;
}
.howto-token-box {
  background: #161b22;
  border: 1px solid #3fb950;
  border-radius: 6px;
  padding: 10px 12px;
  color: #79c0ff;
  font-size: 13px;
  font-family: monospace;
  word-break: break-all;
  line-height: 1.5;
  user-select: all;
}
.howto-config-label {
  color: #e6edf3;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.howto-code {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px 12px;
  color: #79c0ff;
  font-size: 12px;
  font-family: monospace;
  word-break: break-all;
  line-height: 1.6;
}

.file-preview-modal {
  width: 800px;
  max-width: 90vw;
  max-height: 85vh;
}

.file-preview-body { padding: 0; flex: 1; overflow: hidden; }

.file-preview-content {
  margin: 0;
  padding: 16px;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  max-height: 70vh;
  color: var(--text-primary);
  background: var(--bg-primary);
  user-select: text;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================ */
/* Command Panel                                                 */
/* ============================================================ */
.btn-icon-cmd {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  align-self: flex-end;
}
.btn-icon-cmd:hover { background: var(--bg-hover); }

.cmd-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  z-index: 200;
}
.cmd-overlay.hidden { display: none !important; }

.cmd-panel {
  width: 100%;
  background: var(--bg-secondary);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 24px 16px 32px;
}
.cmd-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.cmd-list { margin-bottom: 16px; }
.cmd-item {
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  border-bottom: 1px solid var(--bg-tertiary);
  cursor: pointer;
}
.cmd-item:last-child { border-bottom: none; }
.cmd-item:hover { background: var(--bg-tertiary); border-radius: 6px; }
.cmd-item-name { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.cmd-item-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cmd-cancel-btn { color: var(--text-secondary); margin-top: 8px; }

.cmd-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 8px 4px;
}
.cmd-item-active {
  border-left: 3px solid var(--accent);
}
.cmd-item-active .cmd-item-name {
  color: var(--accent);
}
.cmd-input-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.model-pill {
  background: rgba(188, 140, 255, 0.15) !important;
  color: #bc8cff !important;
  border-color: rgba(188, 140, 255, 0.3) !important;
}
