/* =====================================================
   PromptPilot Main Styles
   ===================================================== */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-hover: #1e293b;
  --bg-selected: #1e3a5f;
  --border-color: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #3b82f6;
  --accent-success: #22c55e;
  --accent-warning: #eab308;
  --accent-danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Header */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header h1 span {
  font-size: 1.75rem;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-success);
  animation: pulse 2s infinite;
}

.status-dot.offline {
  background: var(--accent-danger);
  animation: none;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Navigation */
.nav-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  gap: 4px;
}

.nav-tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

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

/* Main Content */
.app-content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Section Styles */
.section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.section h2 {
  margin: 0 0 16px 0;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-description {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.9375rem;
}

/* Form Elements */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

textarea,
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  resize: vertical;
}

textarea:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-primary);
}

textarea {
  min-height: 120px;
}

.token-counter {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  flex-wrap: wrap;
}

.token-counter .token-count {
  color: var(--accent-primary, #3b82f6);
  font-weight: 500;
}

.token-counter .token-total {
  color: var(--accent-success, #22c55e);
  font-weight: 600;
}

.token-counter .token-cost {
  color: var(--text-secondary, #94a3b8);
  background: var(--bg-tertiary, #334155);
  padding: 2px 8px;
  border-radius: 4px;
}

.token-counter .token-breakdown {
  color: var(--text-muted, #64748b);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

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

.model-select-inline {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8125rem;
  cursor: pointer;
}

.btn-success {
  background: var(--accent-success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

/* Results Area */
.results-area {
  margin-top: 24px;
  min-height: 100px;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-secondary);
}

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

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

.error-state {
  padding: 20px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #fca5a5;
}

.result-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

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

.result-title {
  font-weight: 600;
  font-size: 1rem;
}

.result-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* CharDiff Styles - Improved */
.chardiff-visualization {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

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

.chardiff-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.chardiff-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.chardiff-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diff-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 4px solid;
  transition: all 0.15s;
}

.diff-item:hover {
  transform: translateX(4px);
}

.diff-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  gap: 4px;
}

.diff-action {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.diff-action.insert {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

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

.diff-action.replace {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.diff-action.highlight {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.diff-type-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.diff-content {
  flex: 1;
}

.diff-text {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-text.insert {
  border-left: 3px solid #22c55e;
}

.diff-text.delete {
  border-left: 3px solid #ef4444;
  text-decoration: line-through;
  opacity: 0.7;
}

.diff-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.diff-range {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
}

.diff-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.diff-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.diff-btn-accept {
  background: #22c55e;
  color: white;
}

.diff-btn-accept:hover {
  background: #16a34a;
}

.diff-btn-reject {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Type Colors */
.diff-item.persona {
  border-left-color: #6366f1;
}

.diff-item.context {
  border-left-color: #06b6d4;
}

.diff-item.format {
  border-left-color: #f59e0b;
}

.diff-item.constraint {
  border-left-color: #f43f5e;
}

.diff-item.tone {
  border-left-color: #10b981;
}

.diff-item.example {
  border-left-color: #a855f7;
}

.diff-type-badge.persona {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.diff-type-badge.context {
  background: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
}

.diff-type-badge.format {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.diff-type-badge.constraint {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
}

.diff-type-badge.tone {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.diff-type-badge.example {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.diff-tooltip {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  max-width: 300px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.diff-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.diff-actions button {
  padding: 6px 12px;
  font-size: 0.75rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-accept {
  background: var(--accent-success);
  color: white;
}

.btn-reject {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.btn-modify {
  background: var(--accent-primary);
  color: white;
}

/* Execution Plan */
.execution-plan {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plan-step {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  position: relative;
  transition: all 0.3s ease;
}

.plan-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.step-badge {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
}

.step-title {
  flex: 1;
  font-weight: 600;
}

.step-effort {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: 20px;
}

.step-description {
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-size: 0.9375rem;
}

.step-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}
.step-dep {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
}
.step-dep-back     { background: rgba(239,68,68,0.12);  color: #fca5a5; }
.step-dep-forward  { background: rgba(59,130,246,0.12); color: #93c5fd; }
.step-dep-concurrent { background: rgba(245,158,11,0.12); color: #fcd34d; }
.step-dep-free     { background: rgba(34,197,94,0.12);  color: #86efac; }

.step-prompt {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.step-prompt-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.step-prompt pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.step-expected {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.step-expected strong {
  color: var(--text-primary);
}

.step-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.step-actions .btn {
  padding: 8px 16px;
  font-size: 0.8125rem;
}

.step-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Step Status Badges */
.step-status-badge {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.step-status-badge.status-pending {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
}

.step-status-badge.status-processing {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  animation: pulse 1.5s infinite;
}

.step-status-badge.status-completed {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

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

/* Step styling by status */
.plan-step.status-processing {
  border-left-color: #3b82f6 !important;
  background: rgba(59, 130, 246, 0.05);
}

.plan-step.status-completed {
  border-left-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.05);
}

.plan-step.status-error {
  border-left-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.05);
}

/* Step Results */
.step-results {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.step-results-content h4 {
  margin: 0 0 12px 0;
  color: var(--accent-primary);
  font-size: 0.9375rem;
}

.step-recommendations ul {
  margin: 8px 0;
  padding-left: 20px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.step-recommendations li {
  margin-bottom: 4px;
}

.step-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.step-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  border-radius: 6px;
  color: #fca5a5;
  font-size: 0.8125rem;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 8px;
  z-index: 10;
}

.loading-overlay .loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-overlay span {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Parallel Groups */
.parallel-groups {
  margin-top: 20px;
  padding: 16px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
}

.parallel-groups h4 {
  margin: 0 0 12px 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

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

.group-badge {
  background: var(--accent-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8125rem;
}

/* History Explorer Container */
.history-panel {
  height: calc(100vh - 200px);
  min-height: 600px;
}

/* Responsive */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .nav-tabs {
    overflow-x: auto;
    padding: 0 12px;
  }

  .app-content {
    padding: 16px;
  }

  .section {
    padding: 16px;
  }
}

/* Context & Actions Styles */
.context-section,
.openapi-section {
  margin-bottom: 32px;
}

.subsection-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.file-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-upload-zone:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
}

.file-upload-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.upload-text {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sampling-config {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.sampling-config h4 {
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.config-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.config-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.config-row input,
.config-row select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.context-files-list {
  margin-top: 20px;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.file-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.file-card:hover {
  border-color: var(--accent-primary);
}

.file-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.file-icon {
  font-size: 1.5rem;
}

.file-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.btn-remove:hover {
  color: #ef4444;
}

.file-stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.compression {
  color: #22c55e;
  font-weight: 500;
}

.file-preview-snippet {
  background: var(--bg-primary);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 12px;
  font-size: 0.75rem;
  overflow: hidden;
}

.file-preview-snippet code {
  color: var(--text-secondary);
  font-family: monospace;
}

.context-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

.context-preview {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.context-preview h4 {
  margin-bottom: 12px;
}

.preview-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.preview-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: 16px;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 32px 0;
}

/* OpenAPI Section */
.conversion-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 24px 0;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.flow-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.conversion-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mcp-output,
.actions-output {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
}

.code-output {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.actions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.action-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.action-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.action-number {
  background: var(--accent-primary);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.action-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.action-method {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.action-method.get {
  background: #dbeafe;
  color: #1d4ed8;
}

.action-method.post {
  background: #dcfce7;
  color: #15803d;
}

.action-method.put {
  background: #fef3c7;
  color: #b45309;
}

.action-method.delete {
  background: #fee2e2;
  color: #b91c1c;
}

.action-method.patch {
  background: #f3e8ff;
  color: #7c3aed;
}

.action-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.action-prompt {
  margin-bottom: 12px;
}

.action-prompt label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.action-prompt pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 12px;
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.input-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* CharDiff Applied State */
.diff-item.applied {
  opacity: 0.5;
  background: rgba(34, 197, 94, 0.1) !important;
  border-left: 4px solid #22c55e;
}

.diff-item.applied .diff-btn-accept {
  background: #22c55e;
  color: white;
  cursor: not-allowed;
}

/* CharDiff Rejected State */
.diff-item.rejected {
  opacity: 0.3;
  background: rgba(239, 68, 68, 0.1) !important;
  border-left: 4px solid #ef4444;
}

.diff-item.rejected .diff-btn {
  cursor: not-allowed;
  opacity: 0.5;
}

.diff-range.adjusted {
  color: #f59e0b;
  font-weight: 600;
}

/* Execution Results Highlighting */
.execution-highlighted {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.execution-highlight-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

.execution-output {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diff-block {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  padding: 12px;
  border-radius: 0 6px 6px 0;
}

.diff-block.diff-persona {
  border-left-color: #8b5cf6;
}

.diff-block.diff-context {
  border-left-color: #3b82f6;
}

.diff-block.diff-format {
  border-left-color: #10b981;
}

.diff-block.diff-constraint {
  border-left-color: #f59e0b;
}

.diff-block.diff-tone {
  border-left-color: #ec4899;
}

.diff-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.75rem;
}

.diff-type {
  background: var(--accent-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.diff-priority {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
}

.diff-priority.priority-high {
  background: #fee2e2;
  color: #dc2626;
}

.diff-priority.priority-medium {
  background: #fef3c7;
  color: #d97706;
}

.diff-priority.priority-low {
  background: #dbeafe;
  color: #2563eb;
}

.diff-content {
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-explanation {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.suggestion-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 6px;
}

.suggestion-header {
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.suggestion-content {
  color: var(--text-primary);
  white-space: pre-wrap;
}

.keyword-highlight {
  background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

.execution-raw {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Enhanced step status styles */
.plan-step.status-completed {
  border-left: 4px solid #22c55e;
}

.plan-step.status-error {
  border-left: 4px solid #ef4444;
}

.plan-step.status-processing {
  border-left: 4px solid #f59e0b;
  animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {

  0%,
  100% {
    border-left-color: #f59e0b;
  }

  50% {
    border-left-color: #fbbf24;
  }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}



/* =====================================================
   Interactive Inline Editor (Grammarly Style)
   ===================================================== */
.interactive-review-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 20px;
  position: relative;
}

/* ── Display-All diff panel ─────────────────────────────── */
.diff-all-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
  max-height: 520px;
  overflow-y: auto;
  background: var(--bg-primary);
  border-radius: 0 0 12px 12px;
}

.diff-all-panel.visible {
  display: flex;
}

.diff-all-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.8125rem;
  color: var(--text-muted);
  gap: 12px;
}

.diff-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 4px solid var(--border-color);
  transition: opacity 0.2s, background 0.2s;
  position: relative;
}

.diff-card.diff-card-applied {
  opacity: 0.45;
  background: rgba(34, 197, 94, 0.07);
  border-left-color: #22c55e;
}

.diff-card.diff-card-rejected {
  opacity: 0.3;
  background: rgba(239, 68, 68, 0.07);
  border-left-color: #ef4444;
}

.diff-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.diff-card-index {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 20px;
}

.diff-card-body {
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'Fira Code', 'Consolas', monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-card-explanation {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.diff-card-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.diff-card-status {
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
}

.diff-card-status.status-applied { color: #22c55e; }
.diff-card-status.status-rejected { color: #ef4444; }
.diff-card-status.status-pending  { color: var(--text-muted); }

.interactive-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.interactive-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.interactive-editor-content {
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 150px;
}

/* Inline Highlight Styles */
.inline-suggestion {
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  border-bottom: 2px solid;
}

.inline-suggestion:hover {
  background: rgba(255, 255, 255, 0.1);
}

.suggestion-delete {
  border-bottom-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  text-decoration: line-through;
  color: #fca5a5;
}

.suggestion-replace {
  border-bottom-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
}

.suggestion-highlight {
  border-bottom-color: #3b82f6;
  background: rgba(59, 130, 246, 0.15);
}

.suggestion-insert {
  display: inline-block;
  width: 0;
  height: 1.2em;
  position: relative;
  vertical-align: middle;
  border-bottom: none;
}

.insert-marker {
  position: absolute;
  left: -2px;
  top: 2px;
  bottom: -4px;
  width: 4px;
  background: #22c55e;
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.insert-marker:hover {
  background: #16a34a;
  width: 6px;
  left: -3px;
}

/* Floating Popover */
  .suggestion-popover {
    position: absolute;
    z-index: 1000;
    width: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.2s ease;
  }

  /* ── Auth & Facts Additions ── */
  #header-quota {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .feature-facts-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 18px;
    gap: 12px;
  }
  .facts-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.2s;
  }
  .facts-badge--active {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.3);
    box-shadow: 0 0 8px rgba(34,197,94,0.15);
    animation: facts-glow 2.5s ease-in-out infinite;
  }
  @keyframes facts-glow {
    0%,100% { box-shadow: 0 0 6px rgba(34,197,94,0.15); }
    50%      { box-shadow: 0 0 14px rgba(34,197,94,0.35); }
  }
  .facts-badge--empty {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
  }
  .facts-badge--empty a {
    color: var(--accent-primary);
    text-decoration: none;
  }
  .facts-badge--empty a:hover { text-decoration: underline; }
  .feature-gate {
    position: relative;
  }
  .feature-gate-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.8);
    backdrop-filter: blur(3px);
    border-radius: 10px;
    z-index: 10;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    padding: 24px;
  }
  .feature-gate-overlay.visible { display: flex; }
  .feature-gate-overlay p { color: var(--text-secondary); font-size: 0.9rem; margin: 0; }
  .feature-gate-overlay strong { color: var(--text-primary); font-size: 1rem; }
  #pp-auth-banner {
    background: linear-gradient(90deg, rgba(59,130,246,0.15) 0%, rgba(139,92,246,0.1) 100%);
    border-bottom: 1px solid rgba(59,130,246,0.25);
    padding: 10px 24px;
    display: none;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
  }
  #pp-auth-banner.visible { display: flex; }
  #pp-auth-banner strong { color: var(--text-primary); }
  #pp-auth-banner .pp-banner-cta {
    margin-left: auto;
    white-space: nowrap;
  }
  .tier-guest { color: #64748b; }
  .tier-free  { color: var(--accent-primary); }
  .tier-pro   { color: #8b5cf6; }
