/* =============================================================================
   PM Dashboard — estilos custom encima de Tailwind
   Tema: dark, glass morphism sutil, gradientes, animaciones suaves.
============================================================================= */

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Base font — letras grandes (1.5-2x del original) para lectura cómoda. */
html { font-size: 24px; }
@media (min-width: 1600px) { html { font-size: 26px; } }
@media (min-width: 2000px) { html { font-size: 28px; } }
@media (max-width: 1280px) { html { font-size: 22px; } }
@media (max-height: 720px) { html { font-size: 22px; } }

/* Stack de fuentes del sistema (no Google Fonts — para no depender de CDN) */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 22px;
  line-height: 1.6;
}

/* =============================================================================
   Sidebars retráctiles — clases explícitas con grid-template-columns directo
============================================================================= */
main {
  grid-template-columns: 240px 1fr 300px;
  transition: grid-template-columns 0.25s ease;
}

/* Asignación explícita de columnas — evita que display:none cause shift */
#left-pane { grid-column: 1; }
main > section { grid-column: 2; }
main > aside:last-of-type { grid-column: 3; }

body.left-collapsed:not(.right-collapsed) main {
  grid-template-columns: 0 1fr 300px;
}
body.right-collapsed:not(.left-collapsed) main {
  grid-template-columns: 240px 1fr 0;
}
body.left-collapsed.right-collapsed main {
  grid-template-columns: 0 1fr 0;
}

body.left-collapsed #left-pane,
body.right-collapsed main > aside:last-of-type {
  display: none;
}

/* Botón flotante para re-mostrar la sidebar colapsada */
.collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #2a2a38;
  background: #13131a;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s ease;
}
.collapse-toggle:hover {
  background: #1a1a24;
  color: #e5e5ec;
  border-color: #3a3a4a;
}
.collapse-toggle.is-collapsed { background: rgba(99, 102, 241, 0.15); color: #c4b5fd; border-color: rgba(99, 102, 241, 0.3); }
code, pre, kbd, .font-mono {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
               "Courier New", monospace;
}

/* =============================================================================
   Background — grid pattern + radial gradient
============================================================================= */
.bg-grid {
  background-image:
    linear-gradient(to right, rgba(99, 102, 241, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 102, 241, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-gradient-radial-top {
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(168, 85, 247, 0.15), transparent),
              radial-gradient(ellipse 60% 40% at 80% 100%, rgba(99, 102, 241, 0.1), transparent);
}

/* =============================================================================
   Header buttons
============================================================================= */
.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #2a2a38;
  background: transparent;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.header-btn:hover {
  background: #1a1a24;
  color: #e5e5ec;
  border-color: #3a3a4a;
}
.header-btn-primary {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-color: transparent;
  color: white;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}
.header-btn-primary:hover {
  background: linear-gradient(135deg, #818cf8, #c4b5fd);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}
.status-dot.bg-emerald-400::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.4);
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* =============================================================================
   Tabs (right pane)
============================================================================= */
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 7px 7px 0 0;
  color: #6b7280;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s ease;
  position: relative;
  margin-bottom: -1px;
}
.tab-btn:hover {
  color: #9ca3af;
}
.tab-btn.tab-active {
  color: #e5e5ec;
  background: #1a1a24;
  border-color: #2a2a38;
}
.tab-btn.tab-active::after {
  content: '';
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background: #1a1a24;
}
.tab-counter {
  background: #2a2a38;
  color: #9ca3af;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
}

/* =============================================================================
   Conversations sidebar
============================================================================= */
.conv-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  position: relative;
  background: transparent;
}
.conv-item:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.2);
}
.conv-item.conv-active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.06));
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: inset 2px 0 0 #6366f1;
}
.conv-item-title {
  font-size: 18px;
  font-weight: 500;
  color: #e5e5ec;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item-time {
  font-size: 14px;
  color: #6b7280;
  margin-top: 3px;
  font-feature-settings: "tnum";
}
.conv-item { padding: 10px 12px; }
.conv-item-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  gap: 2px;
}
.conv-item:hover .conv-item-actions {
  display: flex;
}
.conv-item-action {
  padding: 3px;
  border-radius: 4px;
  color: #6b7280;
  background: #1a1a24;
  border: 1px solid #2a2a38;
  cursor: pointer;
  transition: all 0.15s;
}
.conv-item-action:hover {
  background: #2a2a38;
  color: #e5e5ec;
}
.conv-item-action.danger:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.4);
}

/* =============================================================================
   Agents panel
============================================================================= */
.agent-card {
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  font-size: 16px;
}
.agent-card .font-semibold { font-size: 16px !important; }
.agent-card p { font-size: 14px !important; line-height: 1.45; margin-top: 4px !important; }
.agent-card:hover {
  background: #1a1a24;
  border-color: #2a2a38;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.agent-card.is-pm {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(99, 102, 241, 0.04));
  border-color: rgba(168, 85, 247, 0.3);
}
.agent-card.is-pm:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(99, 102, 241, 0.08));
}
.agent-card.is-active {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4), 0 0 24px rgba(99, 102, 241, 0.2);
}
.agent-card.is-active::before {
  content: '';
  position: absolute;
  width: 4px; height: 4px;
  background: #818cf8;
  border-radius: 50%;
  margin-top: 4px;
  margin-left: -10px;
  animation: pulse-glow 1s ease-in-out infinite;
}

/* Pills de modelo */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.pill-opus {
  background: rgba(168, 85, 247, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.pill-sonnet {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.pill-haiku {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* =============================================================================
   Chat messages
============================================================================= */
.msg {
  animation: slideUp 0.3s ease-out;
  max-width: 100%;
  /* Cuando hacemos scrollIntoView({block:'start'}) sobre un msg nuevo,
     dejar un margen arriba para que no quede pegado al borde. */
  scroll-margin-top: 16px;
}

.msg-user {
  display: flex;
  justify-content: flex-end;
}
.msg-user .msg-bubble {
  max-width: 82%;
  background: linear-gradient(135deg, #1a1a24, #1f1f2c);
  border: 1px solid #2a2a38;
  border-radius: 16px 16px 4px 16px;
  padding: 14px 18px;
  font-size: 21px;
  line-height: 1.6;
  color: #e5e5ec;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.msg-assistant {
  display: flex;
  gap: 12px;
}
.msg-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.msg-avatar svg {
  width: 22px;
  height: 22px;
  color: white;
}
.msg-assistant .msg-content {
  flex: 1;
  min-width: 0;
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 500;
}
.msg-role {
  color: #c4b5fd;
  font-weight: 600;
  font-size: 15px;
}
.msg-time {
  font-feature-settings: "tnum";
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.msg-stats {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  color: #6b7280;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
  cursor: help;
}

/* =============================================================================
   Attachments — chips para archivos pendientes de mandar y dentro del bubble
============================================================================= */
.attachment-pending {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 4px;
  background: #1a1a24;
  border: 1px solid #2a2a38;
  border-radius: 5px;
  font-size: 11px;
  color: #d1d5db;
  max-width: 220px;
}
.attachment-preview {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: #0a0a0f;
}
.attachment-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.attachment-size {
  color: #6b7280;
  font-size: 10px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.attachment-remove {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 1px;
  border-radius: 2px;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.attachment-remove:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 6px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 3px;
  font-size: 10px;
  color: #93c5fd;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Drop overlay highlight cuando estás arrastrando */
#drop-zone.is-dragover #drop-overlay {
  display: flex !important;
}

/* =============================================================================
   Modal de detalle de agente — sección de actividad
============================================================================= */
.agent-status-active {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 6px;
  font-size: 13px;
  color: #c4b5fd;
  font-weight: 600;
  margin-bottom: 14px;
}
.dot-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #a855f7;
  border-radius: 50%;
  animation: pulseGlow 1s ease-in-out infinite;
  flex-shrink: 0;
}
.agent-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.agent-stats-grid > div {
  background: #1a1a24;
  border: 1px solid #2a2a38;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}
.agent-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: #f3f4f6;
  font-feature-settings: "tnum";
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.agent-stat-lbl {
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.agent-task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}
.agent-task-item {
  background: #13131a;
  border: 1px solid #2a2a38;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #d1d5db;
}
.agent-task-item.is-error {
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.05);
}
.agent-task-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: #6b7280;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.agent-task-time { color: #9ca3af; }
.agent-task-tokens {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  padding: 1px 6px;
  border-radius: 3px;
}
.agent-task-err-badge {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.agent-task-task { color: #e5e5ec; line-height: 1.5; margin-bottom: 4px; }
.agent-task-task strong, .agent-task-result strong {
  color: #c4b5fd;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.agent-task-result {
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.5;
  font-style: italic;
  border-top: 1px solid #2a2a38;
  padding-top: 6px;
  margin-top: 6px;
}
.msg-bubble-assistant {
  font-size: 21px;
  line-height: 1.65;
  color: #e5e5ec;
}

/* Markdown rendering — assistant */
.msg-bubble-assistant p { margin: 0.4em 0; }
.msg-bubble-assistant p:first-child { margin-top: 0; }
.msg-bubble-assistant p:last-child { margin-bottom: 0; }
.msg-bubble-assistant strong { color: #f3f4f6; font-weight: 600; }
.msg-bubble-assistant em { color: #d1d5db; font-style: italic; }
.msg-bubble-assistant a { color: #93c5fd; text-decoration: underline; text-decoration-color: rgba(147, 197, 253, 0.4); text-underline-offset: 2px; }
.msg-bubble-assistant a:hover { color: #bfdbfe; text-decoration-color: rgba(191, 219, 254, 0.8); }
.msg-bubble-assistant code:not(pre code) {
  background: #0a0a0f;
  border: 1px solid #2a2a38;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.875em;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #c4b5fd;
}
.msg-bubble-assistant pre {
  background: #0a0a0f !important;
  border: 1px solid #2a2a38;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0;
  overflow-x: auto;
  font-size: 12px;
  position: relative;
}
.msg-bubble-assistant pre code {
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  font-size: 12px !important;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  color: #e5e5ec !important;
}
.msg-bubble-assistant ul, .msg-bubble-assistant ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}
.msg-bubble-assistant ul li { list-style: disc; }
.msg-bubble-assistant ol li { list-style: decimal; }
.msg-bubble-assistant li { margin: 0.2em 0; }
.msg-bubble-assistant h1, .msg-bubble-assistant h2, .msg-bubble-assistant h3 {
  font-weight: 700;
  margin: 0.7em 0 0.3em;
  color: #f3f4f6;
}
.msg-bubble-assistant h1 { font-size: 1.2em; }
.msg-bubble-assistant h2 { font-size: 1.1em; }
.msg-bubble-assistant h3 { font-size: 1em; }
.msg-bubble-assistant blockquote {
  border-left: 3px solid #6366f1;
  padding-left: 12px;
  margin: 0.5em 0;
  color: #9ca3af;
  font-style: italic;
}
.msg-bubble-assistant table {
  border-collapse: collapse;
  margin: 0.5em 0;
  font-size: 12px;
}
.msg-bubble-assistant table th, .msg-bubble-assistant table td {
  padding: 6px 10px;
  border: 1px solid #2a2a38;
}
.msg-bubble-assistant table th {
  background: #1a1a24;
  font-weight: 600;
}

/* Code block copy button */
.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #1a1a24;
  border: 1px solid #2a2a38;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 10px;
  color: #9ca3af;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: #2a2a38; color: #e5e5ec; }
.code-copy-btn.copied { color: #86efac; border-color: rgba(34, 197, 94, 0.4); }

/* Delegation indicator */
.delegation {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  margin: 6px 0 6px 42px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.06);
  border-left: 3px solid #a855f7;
  font-size: 11.5px;
  color: #c4b5fd;
  animation: slideInRight 0.3s ease-out;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.delegation-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(168, 85, 247, 0.3);
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
.delegation.is-done .delegation-spinner {
  border: 2px solid #22c55e;
  background: #22c55e;
  animation: none;
  position: relative;
}
.delegation.is-done .delegation-spinner::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #0a0a0f;
  font-weight: 900;
}
.delegation strong {
  color: #d8b4fe;
  font-weight: 600;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Typing indicator (3 dots) */
.typing-indicator {
  display: inline-flex;
  gap: 3px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #1a1a24, #1f1f2c);
  border: 1px solid #2a2a38;
  border-radius: 14px 14px 14px 4px;
  margin-left: 42px;
}
.typing-indicator span {
  width: 6px; height: 6px;
  background: #818cf8;
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  max-width: 540px;
  margin: 0 auto;
}
.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.empty-state-icon svg { width: 26px; height: 26px; color: #c4b5fd; }
.empty-state h2 {
  font-size: 26px;
  font-weight: 700;
  color: #f3f4f6;
  margin-bottom: 10px;
}
.empty-state p {
  font-size: 18px;
  color: #9ca3af;
  margin-bottom: 22px;
  line-height: 1.6;
}
.suggestion-pill { font-size: 16px; padding: 10px 18px; }
.empty-state-icon {
  width: 72px !important;
  height: 72px !important;
}
.empty-state-icon svg {
  width: 36px !important;
  height: 36px !important;
}
.suggestion-pill {
  display: inline-block;
  padding: 6px 12px;
  margin: 3px;
  background: #1a1a24;
  border: 1px solid #2a2a38;
  border-radius: 999px;
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s;
}
.suggestion-pill:hover {
  background: #2a2a38;
  color: #e5e5ec;
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

/* =============================================================================
   Scrollbars
============================================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a38; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a4a; }
* { scrollbar-width: thin; scrollbar-color: #2a2a38 transparent; }

/* =============================================================================
   Toasts
============================================================================= */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  background: #1a1a24;
  border: 1px solid #2a2a38;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  color: #e5e5ec;
  animation: slideInRight 0.25s ease-out;
  max-width: 360px;
  position: relative;
}
.toast.is-leaving { animation: slideOutRight 0.25s ease-in forwards; }
@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(20px); }
}
.toast-success { border-left: 3px solid #22c55e; }
.toast-error { border-left: 3px solid #f43f5e; }
.toast-info { border-left: 3px solid #6366f1; }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: #86efac; }
.toast-error .toast-icon { color: #fda4af; }
.toast-info .toast-icon { color: #93c5fd; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close { color: #6b7280; cursor: pointer; flex-shrink: 0; }
.toast-close:hover { color: #e5e5ec; }

/* =============================================================================
   Activity feed
============================================================================= */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
  animation: slideUp 0.2s ease-out;
}
.activity-item:hover {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.15);
}
.activity-icon {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-icon svg { width: 12px; height: 12px; color: #c4b5fd; }
.activity-content { flex: 1; min-width: 0; }
.activity-title {
  font-size: 11.5px;
  font-weight: 500;
  color: #e5e5ec;
  display: flex; align-items: center; gap: 4px;
}
.activity-time {
  font-size: 10px;
  color: #6b7280;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-feature-settings: "tnum";
  margin-top: 1px;
}
.activity-preview {
  font-size: 10.5px;
  color: #9ca3af;
  margin-top: 3px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* =============================================================================
   Command palette + modals
============================================================================= */
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #e5e5ec;
  transition: background 0.1s;
}
.palette-item:hover, .palette-item.is-selected {
  background: rgba(99, 102, 241, 0.15);
}
.palette-item .palette-icon {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: #2a2a38;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #9ca3af;
}
.palette-item .palette-icon svg { width: 12px; height: 12px; }
.palette-item-meta { color: #6b7280; font-size: 11px; margin-left: auto; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

kbd {
  display: inline-block;
  padding: 1px 6px;
  background: #2a2a38;
  border: 1px solid #3a3a4a;
  border-radius: 4px;
  font-size: 10px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #d1d5db;
  margin: 0 2px;
}

/* Mention popover */
.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
}
.mention-item:hover, .mention-item.is-selected {
  background: rgba(99, 102, 241, 0.15);
}
.mention-name { font-weight: 600; color: #e5e5ec; }

/* Latency pill */
#latency-pill {
  font-feature-settings: "tnum";
}

/* Cursor blink for streaming text */
.streaming-cursor::after {
  content: '▊';
  display: inline-block;
  margin-left: 2px;
  color: #818cf8;
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Shimmer loading state */
.shimmer {
  background: linear-gradient(90deg, #1a1a24 0%, #2a2a38 50%, #1a1a24 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: 4px;
}

/* Text utility */
.text-balance { text-wrap: balance; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile + tablet adjustments — sidebars colapsadas */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr !important; }
  #left-pane, main > aside { display: none; }
  .empty-state { padding: 24px 12px; }
}

/* Pantallas con poca altura: ajuste leve, sin sacrificar legibilidad */
@media (max-height: 720px) {
  html { font-size: 14px; }
  .empty-state { padding: 28px 16px; }
  .empty-state-icon { width: 44px; height: 44px; margin-bottom: 10px; }
  .empty-state-icon svg { width: 22px; height: 22px; }
  .empty-state h2 { font-size: 15px; margin-bottom: 4px; }
  .empty-state p { font-size: 13px; margin-bottom: 12px; }
}
