/* Legalis Iuris - Legal Document Interface */
/* Layout: Sidebar | Chat Panel | Document Panel (main) */

:root {
  --bg-primary: #09090b;
  --bg-secondary: #0f0f11;
  --bg-tertiary: #151518;
  --bg-hover: #1a1a1e;
  --bg-active: #222226;
  
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent-gold: #d4af37;
  --accent-gold-dim: #b8972f;
  --accent-glow: rgba(212, 175, 55, 0.1);
  --accent-border: rgba(212, 175, 55, 0.25);
  
  --border-color: #27272a;
  --border-subtle: #1c1c1f;
  
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Libre Baskerville', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --sidebar-width: 200px;
  --chat-width: 340px;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Libre+Baskerville:wght@400;700&family=JetBrains+Mono:wght@400;500&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ==================== LAYOUT ==================== */
.legal-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==================== SIDEBAR LEFT (Historial) ==================== */
.sidebar-left {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-gold);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
}

.logo svg {
  stroke: var(--accent-gold);
}

.new-chat-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.new-chat-btn:hover {
  background: var(--accent-gold-dim);
  transform: scale(1.05);
}

.new-chat-btn svg {
  stroke: var(--bg-primary);
}

/* Chat History */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-history::-webkit-scrollbar {
  width: 4px;
}

.chat-history::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.history-item-wrapper {
  position: relative;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.history-item-wrapper:hover {
  background: var(--bg-hover);
}

.history-item-wrapper.active {
  background: var(--bg-active);
  border-left: 2px solid var(--accent-gold);
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  padding-right: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
  flex: 1;
}

.history-item-wrapper:hover .history-item {
  color: var(--text-secondary);
}

.history-item-wrapper.active .history-item {
  color: var(--text-primary);
}

.history-delete-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.history-item-wrapper:hover .history-delete-btn {
  opacity: 1;
}

.history-delete-btn:hover {
  background: var(--error);
  color: white;
  opacity: 1;
}

.history-delete-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.history-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-date {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 8px;
}

/* ==================== CHAT PANEL ==================== */
.chat-panel {
  width: var(--chat-width);
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.chat-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tools-badges {
  display: flex;
  gap: 4px;
}

.mini-badge {
  padding: 2px 8px;
  background: var(--accent-glow);
  color: var(--accent-gold);
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

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

.msg-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.chat-msg.user .msg-icon {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.chat-msg.assistant .msg-icon {
  background: var(--accent-glow);
  color: var(--accent-gold);
  border: 1px solid var(--accent-border);
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-text {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.user .msg-text {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chat-msg.assistant .msg-text {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.msg-time {
  margin-top: 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Context indicator in user messages */
.msg-context-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  margin-bottom: 6px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  font-size: 0.65rem;
  color: var(--accent-gold);
  font-weight: 500;
}

.msg-context-indicator svg {
  stroke: var(--accent-gold);
}

.chat-msg.with-context .msg-text {
  border-left: 2px solid var(--accent-gold);
  padding-left: 10px;
  margin-left: 2px;
}

/* Chat Welcome */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 20px;
}

.chat-welcome .welcome-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  margin-bottom: 16px;
  color: var(--accent-gold);
}

.chat-welcome h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.chat-welcome p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Chat Input */
.chat-input {
  padding: 12px 16px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  transition: all var(--transition-fast);
}

.input-box:focus-within {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.input-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: none;
  max-height: 80px;
}

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

.send-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--bg-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-gold-dim);
}

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

.input-status {
  min-height: 20px;
  margin-top: 8px;
}

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-gold);
  font-size: 0.7rem;
}

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

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

/* ==================== DOCUMENT PANEL (MAIN) ==================== */
.document-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
}

.document-header {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.document-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.document-title svg {
  color: var(--accent-gold);
}

.document-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.action-btn svg {
  width: 14px;
  height: 14px;
}

/* Document Content */
.document-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 48px;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.document-content::-webkit-scrollbar {
  width: 8px;
}

.document-content::-webkit-scrollbar-track {
  background: transparent;
}

.document-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Document Empty State */
.document-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.empty-illustration {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  color: var(--text-muted);
}

.document-empty h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.document-empty p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.empty-suggestions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

.suggestion-btn {
  padding: 14px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-gold);
  color: var(--text-primary);
  transform: translateX(4px);
}

/* ==================== DOCUMENT TYPOGRAPHY ==================== */
.document-content h1,
.document-content h2,
.document-content h3,
.document-content h4,
.document-content h5,
.document-content h6 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.document-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent-gold);
  border-bottom: 2px solid var(--accent-border);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.document-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 2em;
}

.document-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.document-content p {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 1em;
  text-align: justify;
}

.document-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.document-content em {
  color: var(--text-muted);
  font-style: italic;
}

.document-content ul,
.document-content ol {
  margin: 1em 0 1em 2em;
  color: var(--text-secondary);
}

.document-content li {
  margin-bottom: 0.5em;
  line-height: 1.7;
}

.document-content blockquote {
  border-left: 3px solid var(--accent-gold);
  padding: 12px 20px;
  margin: 1.5em 0;
  background: var(--bg-tertiary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.document-content code {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent-gold);
}

.document-content pre {
  background: var(--bg-tertiary);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.5em 0;
  border: 1px solid var(--border-color);
}

.document-content pre code {
  background: transparent;
  padding: 0;
}

.document-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

.document-content a {
  color: var(--accent-gold);
  text-decoration: none;
}

.document-content a:hover {
  text-decoration: underline;
}

/* ==================== TOOLS USED BADGE ==================== */
.tools-used {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.tools-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.tools-used .tool-badge {
  padding: 2px 6px;
  font-size: 0.6rem;
  background: var(--accent-glow);
  color: var(--accent-gold);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 180px;
    --chat-width: 300px;
  }
}

@media (max-width: 900px) {
  .sidebar-left {
    display: none;
  }
  
  :root {
    --chat-width: 280px;
  }
}

@media (max-width: 700px) {
  .chat-panel {
    display: none;
  }
  
  .document-content {
    padding: 24px;
  }
}

/* ==================== SELECTION POPUP ==================== */
.selection-popup {
  position: fixed;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--transition-fast);
}

.selection-popup.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.send-to-chat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent-gold);
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.send-to-chat-btn:hover {
  background: var(--accent-gold-dim);
  transform: scale(1.05);
}

.send-to-chat-btn svg {
  stroke: var(--bg-primary);
}

/* ==================== CONTEXT MESSAGE IN CHAT ==================== */
.context-message {
  margin-bottom: 16px;
  padding: 0 4px;
}

.context-card {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.context-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 100%);
  border-bottom: 1px solid var(--accent-border);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.context-card-header svg {
  stroke: var(--accent-gold);
  flex-shrink: 0;
}

.context-card-header span {
  flex: 1;
}

.context-remove-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.context-remove-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.context-card-body {
  padding: 12px 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
  border-left: 3px solid var(--accent-gold);
  margin: 8px;
  background: var(--bg-tertiary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.context-card-body::-webkit-scrollbar {
  width: 4px;
}

.context-card-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.context-instruction {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.context-instruction svg {
  stroke: var(--accent-gold);
  flex-shrink: 0;
}

/* ==================== MODE SELECTOR ====================  */
.mode-selector {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.mode-btn.active {
  background: var(--accent-glow);
  color: var(--accent-gold);
  border: 1px solid var(--accent-border);
}

.mode-btn svg {
  width: 14px;
  height: 14px;
}

/* Mode indicator in messages */
.msg-mode-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-bottom: 6px;
  border-radius: 10px;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.msg-mode-indicator.ask {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.msg-mode-indicator.agent {
  background: var(--accent-glow);
  color: var(--accent-gold);
  border: 1px solid var(--accent-border);
}

.msg-mode-indicator svg {
  width: 10px;
  height: 10px;
}

/* System messages */
.chat-msg.system {
  justify-content: center;
}

.chat-msg.system .msg-content {
  flex: none;
}

.system-text {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ==================== INLINE DIFF (VS Code Style) ==================== */
.inline-diff-block {
  position: relative;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.inline-diff-block:hover {
  border-color: var(--accent-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.inline-diff-actions {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  z-index: 10;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.inline-diff-block:hover .inline-diff-actions {
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.inline-accept-btn,
.inline-reject-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.inline-accept-btn {
  color: #4ade80;
}

.inline-accept-btn:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: #4ade80;
  transform: scale(1.1);
}

.inline-reject-btn {
  color: #f87171;
}

.inline-reject-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #f87171;
  transform: scale(1.1);
}

.inline-accept-btn svg,
.inline-reject-btn svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.inline-diff-old {
  padding: 12px 50px 12px 36px;
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid #f87171;
  color: var(--text-secondary);
  position: relative;
  text-decoration: line-through;
  opacity: 0.85;
  line-height: 1.7;
  font-size: 0.9rem;
}

.inline-diff-old::before {
  content: '−';
  position: absolute;
  left: 14px;
  top: 12px;
  color: #f87171;
  font-weight: bold;
  font-size: 1.2rem;
  line-height: 1;
  font-family: monospace;
}

.inline-diff-new {
  padding: 12px 50px 12px 36px;
  background: rgba(34, 197, 94, 0.1);
  border-left: 4px solid #4ade80;
  color: var(--text-primary);
  position: relative;
  line-height: 1.7;
  font-size: 0.9rem;
}

.inline-diff-new::before {
  content: '+';
  position: absolute;
  left: 14px;
  top: 12px;
  color: #4ade80;
  font-weight: bold;
  font-size: 1.2rem;
  line-height: 1;
  font-family: monospace;
}

/* Markdown dentro de los bloques de diff */
.inline-diff-old strong,
.inline-diff-new strong {
  font-weight: 600;
}

.inline-diff-old em,
.inline-diff-new em {
  font-style: italic;
}

.inline-diff-old p,
.inline-diff-new p {
  margin: 0.5em 0;
}

.inline-diff-old p:first-child,
.inline-diff-new p:first-child {
  margin-top: 0;
}

.inline-diff-old p:last-child,
.inline-diff-new p:last-child {
  margin-bottom: 0;
}

/* Si solo hay contenido nuevo (sin antiguo) */
.inline-diff-block .inline-diff-new:only-child {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

/* Si solo hay contenido antiguo (sin nuevo) */
.inline-diff-block .inline-diff-old:only-child {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

/* Cuando hay ambos (modificado) */
.inline-diff-block .inline-diff-old + .inline-diff-new {
  border-top: 1px dashed rgba(34, 197, 94, 0.3);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.inline-diff-block .inline-diff-old:has(+ .inline-diff-new) {
  border-bottom: 1px dashed rgba(239, 68, 68, 0.3);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Diffy diff styles */
.diffy-diff {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px;
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}

.diffy-diff ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.diffy-diff li {
  padding: 1px 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.diffy-diff li.del {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  text-decoration: line-through;
  text-decoration-color: rgba(239, 68, 68, 0.4);
}

.diffy-diff li.ins {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.diffy-diff li.unchanged {
  color: var(--text-secondary);
}

.diffy-diff del {
  background: rgba(239, 68, 68, 0.25);
  text-decoration: none;
  border-radius: 2px;
  padding: 0 2px;
}

.diffy-diff ins {
  background: rgba(34, 197, 94, 0.25);
  text-decoration: none;
  border-radius: 2px;
  padding: 0 2px;
}

/* Cambios aceptados/rechazados */
.accepted-change {
  padding: 8px 12px;
  background: rgba(34, 197, 94, 0.05);
  border-left: 2px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

.rejected-change {
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.05);
  border-left: 2px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  margin: 8px 0;
  opacity: 0.7;
}

/* Pending change indicator in chat */
.pending-change-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 16px 0;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
}

.pending-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
  }
}

.pending-icon svg {
  stroke: var(--bg-primary);
}

.pending-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-text strong {
  font-size: 0.8rem;
  color: var(--accent-gold);
}

.pending-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==================== UTILITIES ==================== */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.3s ease;
}
