/* Private Assistant Tab */

/* 诊断阶段状态条 */
.diagnosis-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: rgba(99, 102, 241, 0.06);
  border-left: 3px solid #6366f1;
  border-radius: 4px;
  font-size: 12px;
  color: #6b7280;
  transition: all 0.3s ease;
  overflow: hidden;
}
.diagnosis-bar.collapsed {
  max-height: 28px;
  opacity: 0.5;
}
.diagnosis-bar.collapsed .diagnosis-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diagnosis-icon { font-size: 14px; flex-shrink: 0; }
.diagnosis-text { flex: 1; line-height: 1.4; }

.assistant-streaming .diagnosis-bar {
  align-items: flex-start;
  max-height: min(220px, 34vh);
  overflow-y: auto;
  opacity: 1;
}

.assistant-streaming .diagnosis-text {
  white-space: pre-wrap;
  overflow: visible;
  text-overflow: clip;
}

.assistant-streaming .diagnosis-bar.collapsed {
  align-items: center;
  max-height: 28px;
  overflow: hidden;
  opacity: 0.5;
}

.assistant-streaming .diagnosis-bar.collapsed .diagnosis-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dpane-assistant.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 260px);
  min-height: 400px;
  position: relative;
}

.assistant-chat-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Messages */
.assistant-msg {
  max-width: 85%;
  animation: assist-fade-in 0.2s ease;
}

.assistant-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px 12px 4px 12px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.assistant-msg.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 16px;
  border-radius: 12px 12px 12px 4px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  word-break: break-word;
}

.assistant-msg-content {
  overflow-wrap: break-word;
}

.assistant-msg-content p {
  margin: 0 0 8px;
}

.assistant-msg-content p:last-child {
  margin-bottom: 0;
}

.assistant-msg-content ul,
.assistant-msg-content ol {
  margin: 6px 0;
  padding-left: 20px;
}

.assistant-msg-content li {
  margin-bottom: 4px;
}

.assistant-msg-content h1,
.assistant-msg-content h2,
.assistant-msg-content h3 {
  margin: 12px 0 6px;
  color: #fff;
}

.assistant-msg-content h1 { font-size: 16px; }
.assistant-msg-content h2 { font-size: 15px; }
.assistant-msg-content h3 { font-size: 14px; }

/* Code blocks */
.assistant-msg-content pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
}

.assistant-msg-content code {
  background: rgba(99, 102, 241, 0.15);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.assistant-msg-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Tables */
.assistant-msg-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 12px;
}

.assistant-msg-content th,
.assistant-msg-content td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  text-align: left;
}

.assistant-msg-content th {
  background: rgba(99, 102, 241, 0.1);
  font-weight: 600;
}

/* Loading bar */
.assistant-loading-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  overflow: hidden;
  position: relative;
}

.assistant-loading-bar.hidden {
  display: none;
}

.loading-bar-indicator {
  width: 100%;
  height: 2px;
  position: absolute;
  top: 0;
  left: 0;
  background: linear-gradient(90deg, transparent, #6366f1, transparent);
  animation: loading-slide 1.5s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-bar-text {
  font-size: 11px;
  color: #a5b4fc;
  white-space: nowrap;
}

/* Streaming cursor */
.assistant-msg-content.streaming-cursor::after {
  content: '|';
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes assist-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Attachment badge */
.assistant-attach-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  font-size: 11px;
  color: #a5b4fc;
}

/* Files changed indicator */
.assistant-files-changed {
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: #34d399;
}

.assistant-files-changed code {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

.files-changed-icon {
  margin-right: 4px;
}

/* Media preview */
.assistant-media-preview {
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.assistant-media-preview img {
  max-width: 180px;
  max-height: 140px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  object-fit: cover;
}

.assistant-media-preview img:hover {
  transform: scale(1.05);
}

/* Inline markdown images in AI messages */
.assistant-msg-content img {
  max-width: 180px;
  max-height: 140px;
  border-radius: 8px;
  cursor: pointer;
  object-fit: cover;
  transition: transform 0.2s;
  display: block;
  margin: 8px 0;
}

.assistant-msg-content img:hover {
  transform: scale(1.05);
}

/* Lightbox overlay */
.assistant-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: assist-fade-in 0.15s ease;
}

.assistant-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.assistant-media-preview video,
.assistant-msg-content video {
  max-width: 320px;
  border-radius: 8px;
}

.assistant-media-preview audio {
  width: 100%;
  max-width: 320px;
  border-radius: 8px;
}

/* Tool logs */
.assistant-tool-logs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  max-height: 96px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.assistant-streaming .assistant-tool-logs {
  display: block;
  height: 38px;
  max-height: 38px;
  overflow-y: hidden;
  overflow-x: hidden;
  padding-right: 2px;
  position: relative;
}

.assistant-streaming .ptree-expert-log {
  max-height: min(110px, 20vh);
  overflow-y: auto;
}

.assistant-streaming .parallel-tree,
.assistant-msg.process-complete.process-expanded .parallel-tree {
  max-height: min(360px, 42vh);
  overflow-y: auto;
  padding-right: 4px;
}

.assistant-process-summary {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(99, 102, 241, 0.14);
  border-radius: 7px;
  background: rgba(99, 102, 241, 0.06);
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  cursor: pointer;
}

.assistant-process-summary:hover {
  border-color: rgba(99, 102, 241, 0.28);
  color: rgba(255, 255, 255, 0.76);
}

.process-summary-action {
  color: #a5b4fc;
  font-weight: 700;
}

.assistant-msg.process-complete .assistant-process-summary {
  display: flex;
}

.assistant-msg.process-complete:not(.process-expanded) .diagnosis-bar,
.assistant-msg.process-complete:not(.process-expanded) .assistant-tool-logs,
.assistant-msg.process-complete:not(.process-expanded) .parallel-tree {
  display: none;
}

.assistant-msg.process-complete.process-expanded .diagnosis-bar {
  align-items: flex-start;
  max-height: min(220px, 34vh);
  overflow-y: auto;
  opacity: 0.85;
}

.assistant-msg.process-complete.process-expanded .assistant-tool-logs,
.assistant-msg.process-complete.process-expanded .ptree-expert-log {
  max-height: min(110px, 20vh);
  overflow-y: auto;
}

.assistant-streaming .diagnosis-bar,
.assistant-streaming .assistant-tool-logs,
.assistant-streaming .parallel-tree,
.assistant-msg.process-complete.process-expanded .diagnosis-bar,
.assistant-msg.process-complete.process-expanded .assistant-tool-logs,
.assistant-msg.process-complete.process-expanded .parallel-tree {
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(165, 180, 252, 0.45) rgba(255, 255, 255, 0.04);
}

.assistant-msg.process-complete.process-expanded .diagnosis-text {
  white-space: pre-wrap;
}

.assistant-log-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  min-height: 30px;
  border-radius: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: assist-fade-in 0.15s ease;
  transition: all 0.2s ease;
}

.assistant-streaming .assistant-tool-logs .assistant-log-entry {
  height: 30px;
  margin-bottom: 0;
}

.assistant-streaming .assistant-tool-logs .assistant-log-entry:not(:last-child),
.assistant-streaming .assistant-tool-logs .assistant-log-entry.done.collapsed {
  display: none;
}

.assistant-log-entry.active {
  border-color: rgba(103, 232, 249, 0.2);
  color: rgba(103, 232, 249, 0.8);
  padding: 5px 10px;
}

.assistant-log-entry.done {
  opacity: 0.7;
}

.assistant-log-entry.done.collapsed {
  min-height: 30px;
  height: 30px;
  padding: 4px 10px;
  font-size: 10px;
  opacity: 0.28;
}

.log-icon {
  font-size: 12px;
}

.assistant-log-entry.collapsed .log-icon {
  font-size: 10px;
}

.log-label {
  font-weight: 500;
}

.log-spinner {
  margin-left: auto;
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(103, 232, 249, 0.3);
  border-top-color: #67e8f9;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Parallel task cards */
.parallel-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.parallel-task-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s;
}

.parallel-task-card.active {
  border-color: rgba(103, 232, 249, 0.3);
  color: rgba(103, 232, 249, 0.9);
  background: rgba(103, 232, 249, 0.06);
}

.parallel-task-card.done {
  border-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
  background: rgba(16, 185, 129, 0.06);
}

.ptask-spinner {
  width: 8px;
  height: 8px;
  border: 1.5px solid rgba(99, 102, 241, 0.3);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.parallel-task-card.active .ptask-spinner {
  border-color: rgba(103, 232, 249, 0.3);
  border-top-color: #67e8f9;
}

.parallel-task-card.done .ptask-spinner {
  border: none;
  animation: none;
}

.ptask-label {
  font-weight: 500;
}

.ptask-status {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.7;
}

.ptask-output {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 10px;
  font-family: 'SF Mono', monospace;
  color: rgba(255, 255, 255, 0.5);
  max-height: 60px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
  transition: max-height 0.3s;
}

.ptask-output.collapsed {
  max-height: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
}

.parallel-task-card {
  flex-wrap: wrap;
}

.assistant-log-entry.done .log-spinner {
  border: none;
  animation: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.log-ok {
  color: #34d399;
  font-size: 10px;
  line-height: 1;
  display: block;
}

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

/* ── Parallel Tree ─────────────────────────────────────────── */

.parallel-tree {
  padding: 10px 0;
  animation: assist-fade-in 0.2s ease;
}

.ptree-expert {
  margin-bottom: 6px;
}

.ptree-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  transition: all 0.2s ease;
}

.ptree-node.expert {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.ptree-node.expert.active {
  border-color: rgba(103, 232, 249, 0.3);
  background: rgba(103, 232, 249, 0.06);
}

.ptree-node.expert.done {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.06);
  opacity: 0.8;
}

.ptree-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.ptree-label {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.ptree-status {
  margin-left: auto;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.ptree-node.active .ptree-status {
  color: #67e8f9;
}

.ptree-node.done .ptree-status {
  color: #34d399;
}

.ptree-expert-log {
  margin: 4px 0 4px 20px;
  padding-left: 12px;
  border-left: 1px solid rgba(99, 102, 241, 0.15);
  max-height: 80px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ptree-expert-log:empty {
  display: none;
}

.ptree-branches {
  margin-left: 18px;
  padding-left: 14px;
  border-left: 2px solid rgba(99, 102, 241, 0.12);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ptree-branches:empty {
  display: none;
}

.ptree-branch {
  display: flex;
  align-items: center;
  gap: 0;
  animation: assist-fade-in 0.15s ease;
}

.ptree-connector {
  width: 14px;
  height: 1px;
  background: rgba(99, 102, 241, 0.2);
  flex-shrink: 0;
}

.ptree-branch .ptree-node {
  flex: 1;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ptree-branch .ptree-node.active {
  border-color: rgba(103, 232, 249, 0.25);
  background: rgba(103, 232, 249, 0.04);
}

.ptree-branch .ptree-node.done {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.04);
}

.ptree-branch .ptree-node.error {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.04);
}

.ptree-branch .ptree-node.error .ptree-status {
  color: #f87171;
}

/* Input bottom area (pending files + input bar) */
.assistant-input-bottom {
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Pending files bar */
/* Context files (from slash command) */
.assistant-context-files {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 0;
}
.assistant-context-files.has-files {
  display: flex;
}
.context-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 14px;
  font-size: 11px;
  color: #6ee7b7;
  animation: assist-fade-in 0.15s ease;
  cursor: default;
}
.context-file-chip:hover {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.4);
}
.context-file-icon {
  font-size: 13px;
  line-height: 1;
}
.context-file-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-file-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 13px;
  line-height: 1;
  transition: opacity 0.15s;
  margin-left: 2px;
}
.context-file-remove:hover {
  opacity: 1;
  color: #f87171;
}

.assistant-pending-files {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 0;
}

.assistant-pending-files.has-files {
  display: flex;
}

.assistant-pending-file {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  font-size: 11px;
  color: #c4b5fd;
  animation: assist-fade-in 0.15s ease;
}

.assistant-pending-file img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
}

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

.assistant-pending-file .pending-file-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 13px;
  line-height: 1;
  transition: opacity 0.15s;
}

.assistant-pending-file .pending-file-remove:hover {
  opacity: 1;
  color: #f87171;
}

/* Input bar */
.assistant-input-bar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.assistant-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.assistant-upload-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#assistant-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

#assistant-input:focus {
  border-color: rgba(99, 102, 241, 0.5);
}

#assistant-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

#assistant-send-btn {
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.8);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
  flex-shrink: 0;
}

#assistant-send-btn:hover {
  background: rgba(99, 102, 241, 1);
}

#assistant-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#assistant-send-btn.stop-mode {
  background: rgba(239, 68, 68, 0.8);
}

#assistant-send-btn.stop-mode:hover {
  background: rgba(239, 68, 68, 1);
}

/* Suggestion Chips */
.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
}

.suggestion-chip {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.06);
  color: #6366f1;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.suggestion-chip:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.5);
}

/* ── Skills Cards ────────────────────────────────────────────── */

.skills-section {
  margin-top: 28px;
}

.skills-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.skills-grid,
.assistant-skills-inline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.assistant-skills-inline {
  padding: 4px 0 12px;
}

.skill-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
}

.skill-card:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}

.skill-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.skill-card-body {
  min-width: 0;
}

.skill-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.skill-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Preview Popup ───────────────────────────────────────────── */

.assistant-preview-popup {
  position: fixed;
  bottom: 80px;
  right: 24px;
  border-radius: 14px;
  overflow: visible;
  background: var(--surface-solid, #1a1a2e);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  animation: popup-slide-in 0.3s ease;
  transition: width 0.3s ease, height 0.3s ease;
}

.assistant-preview-popup.dragging {
  opacity: 0.92;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 40px rgba(99, 102, 241, 0.15);
}

/* Size variants */
.assistant-preview-popup.size-small { width: 420px; height: 520px; }
.assistant-preview-popup.size-medium { width: 640px; height: 700px; }
.assistant-preview-popup.size-large { width: 900px; height: 85vh; }

@keyframes popup-slide-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.preview-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: grab;
  user-select: none;
}

.preview-popup-header:active {
  cursor: grabbing;
}

.preview-popup-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Navigation bar */
.preview-popup-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.preview-popup-url {
  flex: 1;
  min-width: 60px;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: #e2e8f0;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  outline: none;
  transition: border-color 0.15s;
}

.preview-popup-url:focus {
  border-color: rgba(99, 102, 241, 0.5);
}

.preview-popup-go {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.preview-popup-go:hover {
  background: rgba(99, 102, 241, 0.4);
}

.preview-popup-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Size buttons */
.preview-popup-size {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.preview-popup-size:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.preview-popup-size.active {
  background: rgba(99, 102, 241, 0.3);
  border-color: rgba(99, 102, 241, 0.5);
  color: #c4b5fd;
}

.preview-popup-open,
.preview-popup-close {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}

.preview-popup-open:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.preview-popup-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.preview-popup-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 0;
}

.assistant-preview-popup.dragging .preview-popup-iframe {
  pointer-events: none;
}

/* Tweak toolbar */
.preview-popup-tweaks {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  cursor: grab;
}

.preview-popup-tweaks:active {
  cursor: grabbing;
}

.tweak-pick-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tweak-pick-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
}

.tweak-pick-btn.active {
  background: rgba(99, 102, 241, 0.35);
  border-color: #6366f1;
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.tweak-chip {
  padding: 5px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tweak-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.tweak-status {
  font-size: 11px;
  color: #67e8f9;
  margin-left: auto;
  white-space: nowrap;
}

/* Picking mode — cursor hint on iframe */
.assistant-preview-popup.picking-mode .preview-popup-iframe {
  cursor: crosshair;
}

/* ── Slash Command Menu ── */
.assistant-slash-anchor {
  position: relative;
  flex: 1;
  display: flex;
}
.assistant-slash-anchor #assistant-input {
  width: 100%;
}

.assistant-slash-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(15, 15, 35, 0.97);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.08);
  backdrop-filter: blur(16px);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  z-index: 100;
}
.assistant-slash-menu.hidden {
  display: none;
}
.slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.slash-item:hover,
.slash-item.active {
  background: rgba(99, 102, 241, 0.15);
}
.slash-icon {
  font-size: 15px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.slash-label {
  font-size: 13px;
  color: #e0e7ff;
  font-weight: 500;
  white-space: nowrap;
}
.slash-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: auto;
}
.slash-item-selected {
  opacity: 0.5;
  pointer-events: none;
}
.slash-item-selected .slash-icon {
  color: #34d399;
}
