:root {
  --chat-bg: #0f0f0f;
  --chat-bubble-user: #1a3a32;
  --chat-bubble-assistant: #1a1a1a;
  --chat-border: #2a2a2a;
  --panel-width: 320px;
}

.ai-guide-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.ai-guide-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  background: var(--background-card);
}

.ai-guide-header h1 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: 600;
}

.ai-guide-header .subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--foreground-muted);
}

.ai-guide-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.agent-select {
  background: var(--background-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  font-size: 0.9rem;
  min-width: 160px;
}

.lang-select {
  background: var(--background-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  font-size: 0.9rem;
  min-width: 120px;
  cursor: pointer;
}

.lang-select:focus {
  outline: none;
  border-color: var(--primary);
}

.ai-guide-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.ai-guide-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--background);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 80%;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: fadeIn 0.2s ease;
}

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

.chat-bubble.user {
  align-self: flex-end;
  background: var(--chat-bubble-user);
  border: 1px solid rgba(0, 255, 200, 0.15);
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--chat-bubble-assistant);
  border: 1px solid var(--chat-border);
}

.chat-bubble .bubble-header {
  font-size: 0.75rem;
  color: var(--foreground-muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.chat-bubble .bubble-content {
  white-space: pre-wrap;
}

.chat-bubble .bubble-content p {
  margin: 0 0 0.5rem;
}

.chat-bubble .bubble-content p:last-child {
  margin-bottom: 0;
}

.chat-input-area {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--background-card);
}

.chat-input-area textarea {
  flex: 1;
  background: var(--background-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--foreground);
  resize: none;
  max-height: 120px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}

.chat-input-area textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

#send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--background);
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

#send-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 12px var(--primary-glow);
}

.quick-actions {
  padding: 0 2rem 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--background-card);
}

.quick-action-chip {
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  background: var(--background-hover);
  border: 1px solid var(--border);
  color: var(--foreground-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chat-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.chat-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.chat-btn:hover {
  background: var(--primary);
  color: var(--background);
}

.chat-btn.primary {
  background: var(--primary);
  color: var(--background);
}

.chat-btn.primary:hover {
  box-shadow: 0 0 12px var(--primary-glow);
}

.chat-forms {
  margin-top: 0.75rem;
}

.chat-form {
  padding: 1rem;
  background: var(--background-hover);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.chat-form .form-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--foreground);
}

.chat-form .form-field {
  margin-bottom: 0.75rem;
}

.chat-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--foreground-muted);
  margin-bottom: 0.3rem;
}

.chat-form input,
.chat-form textarea,
.chat-form select {
  width: 100%;
  background: var(--background-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.9rem;
}

.chat-form input:focus,
.chat-form textarea:focus,
.chat-form select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.chat-form .form-submit-btn {
  margin-top: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: var(--background);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.chat-form .form-submit-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 10px var(--primary-glow);
}

.ai-guide-panel {
  width: var(--panel-width);
  border-left: 1px solid var(--border);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.panel-tab {
  flex: 1;
  padding: 0.75rem 0.4rem;
  background: none;
  border: none;
  color: var(--foreground-muted);
  font-size: 0.78rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.panel-tab:hover {
  color: var(--foreground);
}

.panel-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.progress-card {
  background: var(--background-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.progress-card .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
}

.progress-card .stat-row:last-child {
  margin-bottom: 0;
}

.progress-card .stat-label {
  color: var(--foreground-muted);
}

.progress-card .stat-value {
  color: var(--primary);
  font-weight: 600;
}

.progress-bar {
  height: 6px;
  background: var(--background-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.agent-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.agent-list-item:hover {
  background: var(--background-hover);
}

.agent-list-item.active {
  border-color: var(--primary);
  background: rgba(0, 255, 200, 0.05);
}

.agent-list-item .agent-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--background-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.agent-list-item .agent-info {
  flex: 1;
  min-width: 0;
}

.agent-list-item .agent-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--foreground);
}

.agent-list-item .agent-stage {
  font-size: 0.75rem;
  color: var(--foreground-muted);
}

.memory-item {
  padding: 0.75rem;
  border-radius: 6px;
  background: var(--background-card);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.memory-item .memory-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.25rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.session-item {
  padding: 0.75rem;
  border-radius: 6px;
  background: var(--background-card);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.session-item:hover {
  border-color: var(--primary);
}

.session-item .session-title {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--foreground);
}

.session-item .session-meta {
  font-size: 0.75rem;
  color: var(--foreground-muted);
  margin-top: 0.2rem;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--foreground-muted);
  font-size: 0.9rem;
}

.chat-btn .btn-icon {
  margin-right: 0.35rem;
  opacity: 0.85;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.md-table th,
.md-table td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.md-table th {
  background: var(--background-hover);
  color: var(--primary);
  font-weight: 600;
}

.md-table td {
  background: var(--background);
  color: var(--foreground);
}

.md-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 900px) {
  .ai-guide-panel {
    display: none;
  }
  .ai-guide-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .ai-guide-header-right {
    width: 100%;
  }
  .agent-select {
    flex: 1;
  }
  .lang-select {
    flex: 1;
  }
}
