:root {
  --font-ui: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-editor: "SFMono-Regular", Menlo, Consolas, monospace;
  --bg: #07080a;
  --bg-alt: #0d0f13;
  --panel: rgba(16, 18, 23, 0.94);
  --panel-soft: rgba(20, 23, 29, 0.92);
  --card: rgba(21, 24, 31, 0.96);
  --card-hover: rgba(27, 31, 39, 0.98);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f4f6;
  --muted: #8d94a0;
  --muted-strong: #c4cad4;
  --accent: #f5f7fb;
  --accent-soft: rgba(245, 247, 251, 0.08);
  --focus: #7fa8ff;
  --danger: #ff7770;
  --warning: #f0b35f;
  --success: #76d7a8;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at top left, rgba(127, 168, 255, 0.08), transparent 20%),
    radial-gradient(circle at 82% 12%, rgba(255, 255, 255, 0.04), transparent 16%),
    linear-gradient(180deg, #08090c 0%, #06070a 100%);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  padding: 20px;
  overflow-x: hidden;
}

.app-shell-hidden {
  display: none;
}

.access-gate {
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}

.access-card {
  width: min(440px, 100%);
  padding: 28px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.gate-title {
  font-size: 44px;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 140px 140px;
  mask-image: radial-gradient(circle at center, black 28%, transparent 86%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
}

.nav-panel,
.panel.glass,
.topbar-compact {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.nav-panel {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: grid;
  gap: 16px;
  align-content: start;
  position: sticky;
  top: 20px;
}

.brand-chip,
.eyebrow,
.metric-name,
.card-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: var(--muted-strong);
}

.brand-chip {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-title,
.topbar-compact h3,
.section-head h3,
.thread-title,
.agent-card-premium h4,
.collective-title,
.task-title,
.column h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.brand-title {
  margin-top: 12px;
  font-size: 52px;
  line-height: 0.92;
}

.brand-copy,
.nav-note-copy,
.thread-copy,
.message-body,
.agent-copy,
.collective-copy,
.task-copy,
.helper-text {
  color: var(--muted-strong);
  line-height: 1.6;
}

.brand-copy {
  margin: 12px 0 0;
}

.tab-nav {
  display: grid;
  gap: 8px;
}

.tab-link {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-strong);
  border-radius: 14px;
  padding: 13px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: 150ms ease;
}

.tab-link:hover,
.tab-link.active {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
  color: var(--text);
}

.nav-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.nav-note-copy {
  margin: 12px 0 0;
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric-grid article {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 14px;
}

.metric-value {
  display: block;
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
}

.agent-pill-list,
.topbar-meta,
.inline-actions,
.section-head,
.segmented,
.upload-chip-list,
.thread-meta,
.task-meta-row,
.agent-stats,
.collective-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.agent-pill,
.mini-pill,
.topbar-tag,
.badge,
.status-pill,
.upload-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
}

/* ── ZONA 1: Control de ejecuciones ─────────────────────── */
.kanban-execution-browser {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
}

.execution-selector-panel {
  display: flex;
  flex-direction: column;
}

.execution-selector-panel .chat-thread-tabs {
  border-bottom: 1px solid var(--line);
  padding: 4px 12px 0;
}

.execution-selector-panel .task-history-table-wrap {
  max-height: 120px;
  overflow-y: auto;
}

/* ── ZONA 2: Chat de ejecución (panel propio) ────────────── */
.execution-chat-panel {
  display: flex;
  flex-direction: column;
  height: 460px;
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
}

/* Sección 1: header */
.execution-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.execution-chat-header-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.execution-chat-header-title .eyebrow {
  margin-bottom: 2px;
}

/* Sección 2: descripción de tarea */
.execution-task-desc {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted-strong);
  line-height: 1.55;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  max-height: 52px;
  overflow-y: auto;
}

.execution-task-desc:empty {
  display: none;
}

/* Sección 3: mensajes */
.execution-chat-panel .chat-messages {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: none;
  border-bottom: none;
}

/* Sección 4: formulario de respuesta */
.execution-chat-panel .compact-form {
  flex-shrink: 0;
  margin-top: 0;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.execution-chat-panel .compact-form textarea {
  resize: none;
  min-height: 56px;
  max-height: 100px;
}

.task-context-copy {
  white-space: pre-wrap;
  max-height: 72px;
  overflow: hidden;
  position: relative;
}

.task-desc-copy {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
}

.badge.success,
.topbar-tag.success {
  color: var(--success);
  border-color: rgba(118, 215, 168, 0.18);
  background: rgba(118, 215, 168, 0.1);
}

.badge.warning {
  color: var(--warning);
  border-color: rgba(240, 179, 95, 0.18);
  background: rgba(240, 179, 95, 0.1);
}

.badge.danger {
  color: var(--danger);
  border-color: rgba(255, 119, 112, 0.18);
  background: rgba(255, 119, 112, 0.1);
}

.main-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}

.topbar-compact {
  border-radius: var(--radius-xl);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-compact-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar-compact h3 {
  margin: 0;
  font-size: 20px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar-compact-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
  min-height: 0;
  overflow-y: auto;
}

body.jarvis-mode {
  padding: 0;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(58, 152, 255, 0.16), transparent 18%),
    radial-gradient(circle at 18% 16%, rgba(74, 196, 255, 0.12), transparent 22%),
    radial-gradient(circle at 84% 18%, rgba(69, 214, 194, 0.08), transparent 20%),
    linear-gradient(180deg, #01050a 0%, #04111d 38%, #02060d 100%);
}

body.jarvis-mode .noise {
  opacity: 0.16;
  background-size: 150px 150px;
  mask-image: radial-gradient(circle at center, black 28%, transparent 82%);
}

body.jarvis-mode .app-shell {
  max-width: none;
  min-height: 100dvh;
  grid-template-columns: 1fr;
  gap: 0;
}

body.jarvis-mode .nav-panel,
body.jarvis-mode .topbar-compact {
  display: none;
}

body.jarvis-mode .main-panel {
  min-height: 100dvh;
  gap: 0;
  padding: 0;
}

body.jarvis-mode .tab-page.active {
  min-height: 100dvh;
}

.jarvis-root {
  min-height: 100dvh;
}

body.jarvis-mode .jarvis-root {
  min-height: 100dvh;
}

.jarvis-shell {
  min-height: 100dvh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

.jarvis-return-button {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 6;
  appearance: none;
  border: 1px solid rgba(133, 201, 255, 0.28);
  background: rgba(5, 14, 26, 0.24);
  color: rgba(233, 247, 255, 0.96);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 10px;
  cursor: pointer;
  backdrop-filter: blur(22px);
  transition: 180ms ease;
}

.jarvis-return-button:hover {
  border-color: rgba(133, 201, 255, 0.45);
  background: rgba(7, 24, 42, 0.68);
}

.jarvis-ambient-layer {
  position: absolute;
  inset: -16%;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(53, 153, 255, 0.16), transparent 14%),
    radial-gradient(circle at 50% 50%, rgba(53, 153, 255, 0.09), transparent 32%),
    conic-gradient(from 0deg, rgba(0, 0, 0, 0), rgba(103, 194, 255, 0.08), rgba(0, 0, 0, 0), rgba(67, 218, 193, 0.05), rgba(0, 0, 0, 0));
  filter: blur(28px);
  animation: jarvisDrift 18s linear infinite;
}

.jarvis-scene {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 28px 34px;
  overflow: hidden;
}

.jarvis-orb-shell.connected .jarvis-orb-core-shell {
  border-color: rgba(110, 255, 229, 0.36);
}

.jarvis-orb-shell.listening .jarvis-orb-core-shell {
  border-color: rgba(110, 255, 229, 0.44);
}

.jarvis-orb-shell.thinking .jarvis-orb-core-shell {
  border-color: rgba(126, 201, 255, 0.44);
}

.jarvis-orb-shell.warning .jarvis-orb-core-shell {
  border-color: rgba(246, 192, 109, 0.44);
}

.jarvis-centerpiece {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  min-width: 0;
  width: min(82vw, 920px);
  text-wrap: balance;
}

.jarvis-orb-shell {
  position: relative;
  width: min(56vw, 760px);
  aspect-ratio: 1;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  outline: none;
  transition: transform 180ms ease, filter 180ms ease;
  overflow: hidden;
}

.jarvis-orb-shell:hover,
.jarvis-orb-shell:focus-visible {
  transform: scale(1.005);
  filter: brightness(1.03);
}

.jarvis-orb-canvas,
.jarvis-orb-core-shell,
.jarvis-orb-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.jarvis-orb-canvas {
  display: block;
  filter: drop-shadow(0 0 22px rgba(110, 196, 255, 0.12));
}

.jarvis-orb-core-shell {
  inset: 45%;
  width: auto;
  height: auto;
  background: radial-gradient(circle at center, rgba(238, 250, 255, 0.9), rgba(142, 224, 255, 0.16) 38%, rgba(10, 29, 52, 0) 78%);
  border: 0;
  box-shadow:
    0 0 38px rgba(126, 201, 255, 0.1),
    0 0 70px rgba(112, 247, 224, 0.06);
  animation: jarvisPulse 4.2s ease-in-out infinite;
  pointer-events: none;
}

.jarvis-orb-grid {
  inset: 4%;
  width: auto;
  height: auto;
  border: 0;
  box-shadow: none;
  background:
    radial-gradient(circle at center, rgba(110, 196, 255, 0.05), transparent 56%),
    radial-gradient(circle at 50% 50%, rgba(110, 196, 255, 0.1) 0 1px, transparent 1.5px);
  background-size: auto, 18px 18px;
  mask-image: radial-gradient(circle at center, transparent 0 18%, black 40% 86%, transparent 100%);
  opacity: 0.28;
  animation: jarvisSpin 36s linear infinite;
  pointer-events: none;
}

.jarvis-presence {
  max-width: min(48vw, 560px);
  display: grid;
  gap: 6px;
  text-align: center;
  justify-items: center;
}

.jarvis-presence-kicker {
  color: rgba(156, 208, 238, 0.74);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: normal;
}

.jarvis-presence-label {
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 12px;
  color: #ecf8ff;
  line-height: 1.35;
}

.jarvis-presence-copy {
  margin: 0;
  color: rgba(214, 232, 245, 0.8);
  line-height: 1.55;
  max-width: 42ch;
  font-size: 13px;
}

.jarvis-control-stack {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.jarvis-mode-switch {
  justify-content: center;
}

.jarvis-mode-switch button {
  min-width: 132px;
}

.jarvis-mode-copy {
  max-width: 46ch;
  color: rgba(184, 212, 230, 0.74);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.jarvis-hint-copy {
  color: rgba(163, 196, 218, 0.54);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  text-align: center;
}

.jarvis-live-rail {
  width: min(48vw, 560px);
  display: grid;
  gap: 8px;
  min-width: 0;
}

#jarvis-live-status {
  text-align: center;
  justify-self: center;
}

.jarvis-live-caption {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(115, 173, 210, 0.08);
  background: rgba(4, 12, 22, 0.12);
  color: rgba(205, 226, 241, 0.54);
  line-height: 1.55;
  font-size: 13px;
  backdrop-filter: blur(14px);
  transition: 180ms ease;
}

.jarvis-live-caption.active {
  border-color: rgba(129, 203, 255, 0.22);
  background: rgba(7, 21, 39, 0.44);
  color: rgba(239, 247, 255, 0.9);
  transform: translateY(-1px);
}

.jarvis-live-caption.user.active {
  border-color: rgba(103, 214, 255, 0.3);
}

.jarvis-live-caption.assistant.active {
  border-color: rgba(117, 255, 224, 0.28);
}

#jarvis-remote-audio {
  display: none;
}

@keyframes jarvisSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes jarvisSpinReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes jarvisPulse {
  0%, 100% { transform: scale(0.96); }
  50% { transform: scale(1.04); }
}

@keyframes jarvisFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes jarvisDrift {
  from { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.04); }
  to { transform: rotate(360deg) scale(1); }
}

.chat-layout,
.kanban-layout,
.collective-layout,
.financial-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}

.chat-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

.kanban-layout {
  grid-template-columns: 340px minmax(0, 1fr);
  align-items: stretch;
}

.collective-layout {
  grid-template-columns: 380px minmax(0, 1fr);
  align-items: stretch;
}

.financial-layout {
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
}

.financial-left-column,
.financial-right-column,
.financial-data-grid,
.financial-metrics-grid {
  display: grid;
  gap: 16px;
}

.financial-hero-grid {
  display: block;
}

.financial-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 18px;
}

.financial-toolbar h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.financial-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.financial-metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.financial-metric-card,
.financial-stat-card {
  padding: 14px 16px;
  min-height: 118px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    rgba(16, 19, 24, 0.96);
}

.financial-metric-value {
  display: block;
  margin-top: 8px;
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.financial-metric-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.financial-chat-panel {
  height: 580px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

#financial-intake-form {
  min-height: 500px;
}

.financial-chat-messages {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.financial-form-panel,
.financial-table-panel {
  min-width: 0;
}

.financial-analysis-panel {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.financial-analysis-box {
  min-width: 0;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(11, 14, 18, 0.95);
}

.financial-analysis-box pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted-strong);
  font-family: var(--font-editor);
  font-size: 12px;
  line-height: 1.55;
}

.financial-analysis-box details {
  display: grid;
  gap: 12px;
}

.financial-analysis-box summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.financial-analysis-progress {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.financial-progress-item {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 24, 30, 0.9);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.financial-progress-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted-strong);
}

.financial-progress-details {
  font-size: 12px;
  color: var(--muted);
}

.financial-progress-item.analizando {
  border-color: #c0a0ff;
}

.financial-progress-item.en-cola {
  border-color: rgba(255, 255, 255, 0.08);
}

.financial-progress-item.generando-propuestas {
  border-color: #f2c94c;
}

.financial-progress-item.listo,
.financial-progress-item.completado {
  border-color: #5bc0be;
}

.financial-progress-item.sin-texto {
  border-color: #e57a7a;
}

.financial-progress-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  letter-spacing: 0.02em;
}

.financial-progress-badge.analizando {
  color: #c0a0ff;
  background: rgba(192, 160, 255, 0.12);
}

.financial-progress-badge.en-cola {
  color: var(--muted);
}

.financial-progress-badge.listo,
.financial-progress-badge.completado {
  color: #5bc0be;
  background: rgba(91, 192, 190, 0.12);
}

.financial-progress-badge.sin-texto,
.financial-progress-badge.error {
  color: #e57a7a;
  background: rgba(229, 122, 122, 0.12);
}

.financial-progress-badge.generando-propuestas {
  color: #f2c94c;
  background: rgba(242, 201, 76, 0.12);
}

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

.progress-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(192, 160, 255, 0.3);
  border-top-color: #c0a0ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.financial-facts-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.financial-fact-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.financial-analysis-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.financial-analysis-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.financial-analysis-actions button {
  appearance: none;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.financial-analysis-actions button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.financial-fact-value {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.financial-fact-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.financial-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(11, 14, 18, 0.95);
}

.financial-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.financial-table th,
.financial-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.financial-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(12, 15, 20, 0.98);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.financial-table td {
  font-size: 13px;
  color: var(--muted-strong);
}

.financial-table td strong {
  color: var(--text);
}

.financial-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.financial-row-actions button {
  appearance: none;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.financial-row-actions button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.financial-row-actions .danger {
  color: var(--danger);
}

.cron-layout {
  display: grid;
  gap: 16px;
}

.table-cell-stack {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.table-subcopy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.cron-check {
  display: grid;
  place-items: center;
  min-width: 52px;
}

.cron-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--focus);
}

.cron-table-input,
.cron-table-select,
.cron-table-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.cron-table-input,
.cron-table-select {
  min-width: 140px;
}

.cron-table-textarea {
  min-width: 320px;
  min-height: 92px;
  resize: vertical;
  line-height: 1.45;
}

.cron-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cron-row-actions button {
  appearance: none;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.cron-row-actions button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.cron-row-actions .danger {
  color: var(--danger);
}

.agent-table-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.agent-table-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  object-fit: cover;
}

.agent-table-model {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-editor);
}

.usage-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 18px;
}

.usage-toolbar h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.usage-layout,
.usage-metrics-grid,
.usage-overview-grid,
.usage-breakdown-grid {
  display: grid;
  gap: 16px;
}

.usage-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.usage-metrics-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.usage-panel {
  min-width: 0;
}

.usage-metric-card,
.usage-mini-card {
  min-width: 0;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    rgba(16, 19, 24, 0.96);
}

.usage-metric-value {
  display: block;
  margin-top: 8px;
  font-size: clamp(16px, 1.5vw, 24px);
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.usage-metric-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.usage-overview-grid,
.usage-breakdown-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.usage-list {
  display: grid;
  gap: 10px;
}

.usage-list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.usage-list-row strong,
.usage-list-row span {
  overflow-wrap: anywhere;
}

.agents-editor-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 320px minmax(0, 1fr);
}

.stack-layout {
  display: grid;
  gap: 16px;
}

.panel.glass {
  min-width: 0;
  border-radius: var(--radius-xl);
  padding: 20px;
}

.thread-panel {
  display: grid;
  gap: 18px;
  grid-template-rows: minmax(0, 1fr) auto;
  height: calc(100vh - 200px);
  min-height: 440px;
}

.thread-sidebar-section + .thread-sidebar-section {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.thread-sidebar-section {
  min-height: 0;
}

.kanban-board-panel {
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - 300px);
  min-height: 400px;
}

.kanban-params-col {
  background: rgba(99, 102, 241, 0.04) !important;
  border-color: rgba(99, 102, 241, 0.15) !important;
}

/* ── Columna Parámetros iniciales: diseño plano y limpio ─── */

/* Ocultar el panel interior y su encabezado — la columna ya tiene h4 */
.kanban-params-col .task-parameter-panel {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: 0;
  box-shadow: none;
}

.kanban-params-col .task-parameter-head,
.kanban-params-col .task-copy {
  display: none;
}

/* Grid de items en una sola columna */
.kanban-params-col .task-parameter-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

/* Cada item: fila simple con línea separadora */
.kanban-params-col .task-parameter-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 2px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  min-width: 0;
}

.kanban-params-col .task-parameter-item:last-child {
  border-bottom: none;
}

.kanban-params-col .task-parameter-label {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kanban-params-col .task-parameter-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 65%;
}

.kanban-detail-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.kanban-detail-description {
  color: var(--muted-strong);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-composer-panel,
.collective-form-panel,
.collective-list-panel {
  height: calc(100vh - 300px);
  min-height: 400px;
}

.task-composer-panel,
.collective-form-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.collective-form-panel {
  overflow-y: auto;
}

.task-composer-panel .stack-form,
.collective-form-panel .stack-form {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.collective-list-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.kanban-board-guide {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.kanban-board-guide:not(:empty) {
  margin-bottom: 12px;
}

.coord-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(99, 179, 237, 0.06), rgba(154, 117, 234, 0.04));
  border: 1px solid rgba(99, 179, 237, 0.12);
}

.coord-header-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coord-header-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1.1;
}

.coord-header-copy {
  margin: 0;
  font-size: 14px;
  color: var(--muted-strong);
  line-height: 1.5;
  max-width: 52ch;
}

.coord-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.section-head {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head.spacious {
  margin-bottom: 0;
}

.section-head h3 {
  font-size: 28px;
}

.ghost-button,
.primary-button,
.attachment-button,
.link-button,
.segmented button,
.task-actions button {
  appearance: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: 150ms ease;
}

.ghost-button,
.attachment-button,
.link-button,
.segmented button,
.task-actions button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  border: 1px solid var(--line);
}

.primary-button {
  background: var(--accent);
  color: #0a0b0d;
  border: 1px solid transparent;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.primary-button.subtle {
  min-width: 170px;
  justify-content: center;
}

.ghost-button:hover,
.attachment-button:hover,
.link-button:hover,
.segmented button:hover,
.task-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.segmented button.active {
  background: var(--accent);
  color: #0a0b0d;
  border-color: transparent;
}

.primary-button:disabled,
.ghost-button:disabled,
.attachment-button:has(input:disabled) {
  opacity: 0.58;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.compact-form {
  margin-top: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

textarea,
input,
select {
  width: 100%;
  border-radius: 16px;
  background: #11141a;
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 13px 14px;
  color: var(--text);
  outline: none;
  font: inherit;
}

textarea::placeholder,
input::placeholder {
  color: #778090;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

select[multiple] {
  min-height: 220px;
  padding: 8px;
  background: #11141a;
}

select option {
  color: var(--text);
  background: #11141a;
}

select[multiple] option {
  padding: 10px 12px;
  border-radius: 10px;
  margin: 2px 0;
}

select option:checked,
select[multiple] option:checked {
  background: linear-gradient(135deg, rgba(127, 168, 255, 0.28), rgba(255, 255, 255, 0.08));
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(127, 168, 255, 0.54);
  box-shadow: 0 0 0 4px rgba(127, 168, 255, 0.12);
}

.helper-text {
  margin: 0;
  font-size: 12px;
}

.helper-text-status {
  min-height: 20px;
}

.helper-text-status.success {
  color: var(--success);
}

.helper-text-status.warning {
  color: var(--warning);
}

.helper-text-status.danger {
  color: var(--danger);
}

.split-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.collective-task-list,
.agent-grid,
.kanban-board {
  display: grid;
  gap: 12px;
}

.chat-thread-tabs {
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
  padding-bottom: 0;
  flex-shrink: 0;
}

.chat-thread-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 2px 2px 0 2px;
  flex-shrink: 0;
  margin-bottom: -1px;
}

.chat-thread-tab.active {
  background: transparent;
  border-bottom-color: var(--accent);
}

.chat-thread-tab-label,
.chat-thread-tab-close {
  appearance: none;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  color: inherit;
  cursor: pointer;
}

.chat-thread-tab-label {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-strong);
}

.chat-thread-tab.active .chat-thread-tab-label {
  color: var(--text);
}

.chat-thread-tab-close {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--muted);
}

.chat-thread-tab.active .chat-thread-tab-close {
  color: var(--muted-strong);
}

.chat-thread-tab-close:hover {
  background: rgba(255, 119, 112, 0.12);
  color: var(--danger);
}

.agent-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kanban-board {
  grid-template-columns: repeat(3, minmax(240px, 1fr)) minmax(220px, 280px);
  align-items: start;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 6px;
}

.collective-board {
  height: 100%;
}

.collective-task-list {
  min-height: 0;
}

.message-card,
.agent-card-premium,
.collective-card,
.task-card,
.column {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.task-card.task-needs-input {
  border-color: rgba(255, 180, 0, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 180, 0, 0.15);
}

.task-needs-input-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  margin: -4px -4px 10px -4px;
  background: rgba(255, 180, 0, 0.1);
  border: 1px solid rgba(255, 180, 0, 0.3);
  border-radius: 14px;
  font-size: 11px;
  color: #FFB400;
  cursor: pointer;
  transition: background 0.15s;
}
.task-needs-input-banner:hover { background: rgba(255, 180, 0, 0.18); }

.task-needs-input-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFB400;
  flex-shrink: 0;
  animation: needs-input-pulse 1.2s ease-in-out infinite;
}

@keyframes needs-input-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.thread-title {
  font-size: 20px;
  line-height: 1;
  overflow-wrap: break-word;
  word-break: break-word;
}

.collective-title,
.task-title {
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: break-word;
}

.chat-messages {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 16px 4px 16px 0;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chat-panel {
  height: calc(100vh - 200px);
  min-height: 420px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.message-card {
  padding: 18px;
}

.message-card.pending {
  border-style: dashed;
  opacity: 0.78;
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.message-author {
  font-weight: 600;
  color: var(--text);
}

.message-attachments,
.upload-chip-list {
  margin-top: 10px;
}

.upload-chip button {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
  padding: 0;
}

.column {
  min-height: 0;
  height: 100%;
  padding: 16px;
  background: rgba(14, 16, 21, 0.98);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.column h4 {
  font-size: 18px;
}

.task-stack {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.task-card,
.collective-card {
  padding: 16px;
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
}

.review-guide-card {
  padding: 16px;
  background: linear-gradient(180deg, rgba(24, 28, 36, 0.98), rgba(17, 20, 27, 0.98));
  border: 1px solid rgba(240, 179, 95, 0.18);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  min-width: 0;
  overflow: hidden;
}

.task-review-block {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.task-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-review-mode {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-review-mode button {
  appearance: none;
  border-radius: 16px;
  padding: 12px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  cursor: pointer;
  text-align: left;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-review-mode button.active {
  background: rgba(127, 168, 255, 0.14);
  border-color: rgba(127, 168, 255, 0.34);
  color: var(--text);
}

.review-guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.review-guide-grid,
.task-parameter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.review-guide-item,
.task-parameter-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  min-width: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.task-parameter-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(127, 168, 255, 0.16);
  background: linear-gradient(180deg, rgba(20, 24, 32, 0.96), rgba(15, 18, 25, 0.96));
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.task-parameter-panel-guide {
  margin-top: 0;
}

.task-parameter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.task-parameter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.task-parameter-value {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-copy-compact {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.task-review-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.task-history-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.task-history-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.task-history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.task-history-table th,
.task-history-table td {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.task-history-table th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.task-history-table td {
  color: var(--text);
}

.task-history-link {
  appearance: none;
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.task-history-link:hover {
  color: var(--accent-soft);
}

.danger-button {
  color: #ffb7b2;
  border-color: rgba(255, 119, 112, 0.24);
}

.mini-pill.review-pending {
  color: var(--warning);
  border-color: rgba(240, 179, 95, 0.2);
  background: rgba(240, 179, 95, 0.1);
}

.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .review-guide-grid,
  .task-parameter-grid {
    grid-template-columns: 1fr;
  }
}

.agent-file-textarea {
  min-height: 520px;
  font-family: var(--font-editor);
  font-size: 12px;
  line-height: 1.5;
}

.agent-card-premium {
  padding: 18px;
}

.agent-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.agent-identity {
  display: flex;
  gap: 14px;
  align-items: center;
}

.agent-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: #0e1015;
  border: 1px solid var(--line);
}

.agent-model {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-editor);
}

.agent-copy strong,
.collective-copy strong,
.task-copy strong {
  color: var(--text);
}

.empty-state {
  padding: 30px 18px;
  text-align: center;
  color: var(--muted-strong);
  font-size: 13px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1500px) {
  .chat-layout,
  .kanban-layout,
  .collective-layout,
  .agents-editor-layout,
  .financial-layout,
  .usage-layout,
  .usage-overview-grid,
  .usage-breakdown-grid,
  .financial-data-grid {
    grid-template-columns: 1fr;
  }

  .agent-grid {
    grid-template-columns: 1fr;
  }

  .nav-panel {
    position: static;
  }

  .jarvis-orb-shell {
    width: min(54vw, 500px);
  }

  .jarvis-live-rail,
  .jarvis-presence {
    width: min(76vw, 760px);
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .topbar-compact {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-compact-right {
    justify-content: flex-start;
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }

  .financial-metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .financial-facts-grid {
    grid-template-columns: 1fr;
  }

  .usage-metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .split-grid {
    grid-template-columns: 1fr;
  }

  .jarvis-scene {
    padding: 26px 18px 20px;
  }

  .jarvis-orb-shell {
    width: min(62vw, 460px);
  }

  .jarvis-live-rail,
  .jarvis-presence {
    width: min(88vw, 720px);
    max-width: none;
  }
}

@media (max-width: 860px) {
  body {
    padding: 12px;
  }

  .nav-panel,
  .panel.glass,
  .topbar-compact {
    border-radius: 22px;
  }

  .brand-title {
    font-size: 40px;
  }

  .panel.glass,
  .nav-panel {
    padding: 18px;
  }

  .topbar-compact {
    padding: 12px 18px;
  }

  .financial-metrics-grid {
    grid-template-columns: 1fr;
  }

  .financial-facts-grid {
    grid-template-columns: 1fr;
  }

  .usage-metrics-grid {
    grid-template-columns: 1fr;
  }

  body.jarvis-mode {
    padding: 0;
  }

  .jarvis-return-button {
    top: 14px;
    left: 14px;
    padding: 9px 14px;
  }

  .jarvis-scene {
    padding: 74px 12px 18px;
    gap: 18px;
  }

  .jarvis-orb-shell {
    width: min(84vw, 360px);
  }

  .jarvis-live-rail,
  .jarvis-presence {
    width: min(94vw, 620px);
  }

  .jarvis-presence-kicker {
    font-size: 10px;
    letter-spacing: 0.18em;
  }

  .jarvis-presence-label {
    font-size: 11px;
    letter-spacing: 0.2em;
  }

  .jarvis-presence-copy {
    font-size: 12px;
    line-height: 1.45;
  }

  .jarvis-hint-copy {
    font-size: 9px;
    letter-spacing: 0.14em;
  }
}

/* ── Documentos subidos ─────────────────────────────────── */
.financial-uploads-panel {
  margin-top: 0;
}

.financial-uploads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.financial-uploads-table thead th {
  text-align: left;
  padding: 6px 10px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.financial-uploads-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}

.financial-uploads-table tbody tr:last-child {
  border-bottom: none;
}

.financial-uploads-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.financial-uploads-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.upload-name-cell a {
  color: var(--fg);
  text-decoration: none;
  word-break: break-word;
}

.upload-name-cell a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.upload-size-cell,
.upload-date-cell {
  color: var(--muted);
  white-space: nowrap;
  width: 80px;
}

.upload-action-cell {
  text-align: right;
  width: 90px;
}

.danger-ghost {
  color: #e57a7a;
  border-color: rgba(229, 122, 122, 0.3);
  font-size: 12px;
  padding: 3px 10px;
}

.danger-ghost:hover {
  background: rgba(229, 122, 122, 0.1);
  border-color: #e57a7a;
}

/* ═══════════════════════════════════════════════════════════════════
   INSPECTOR PANEL — Logs de ejecución + Documentos adjuntos
   ═══════════════════════════════════════════════════════════════════ */

.inspector-panel {
  margin-top: 1.5rem;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  background: var(--surface-2, rgba(255,255,255,0.04));
  overflow: hidden;
  animation: inspectorSlideIn 0.22s ease;
}

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

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--surface-3, rgba(255,255,255,0.06));
  flex-shrink: 0;
  gap: 1rem;
}

.inspector-task-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.inspector-task-label .eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
}

.inspector-task-label strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.inspector-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.5;
  padding: 0 0.25rem;
  line-height: 1;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.inspector-close:hover { opacity: 1; }

.inspector-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 200px;
  max-height: clamp(300px, 42vh, 520px);
}

.inspector-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inspector-col + .inspector-col {
  border-left: 1px solid var(--border, rgba(255,255,255,0.08));
}

.inspector-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
  background: var(--surface-2, rgba(255,255,255,0.03));
  flex-shrink: 0;
}

.inspector-refresh {
  background: none;
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 1px 6px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.inspector-refresh:hover { opacity: 1; }

.inspector-log-list,
.inspector-doc-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
}

.inspector-empty {
  padding: 1rem;
  font-size: 0.78rem;
  opacity: 0.45;
  text-align: center;
}

.inspector-loading {
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 0.8; }
}

/* Log entries */
.inspector-log-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.28rem 1rem;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.04));
  line-height: 1.4;
}
.inspector-log-entry:hover {
  background: rgba(255,255,255,0.03);
}

.inspector-log-ts {
  color: var(--muted, rgba(255,255,255,0.4));
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  padding-top: 1px;
}

.inspector-log-msg {
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
  opacity: 0.85;
}

.log-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-top: 1px;
}
.badge-automation { background: rgba(99,102,241,0.25); color: #a5b4fc; }
.badge-result     { background: rgba(16,185,129,0.2);  color: #6ee7b7; }
.badge-error      { background: rgba(239,68,68,0.2);   color: #fca5a5; }
.badge-note       { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
.badge-system     { background: rgba(245,158,11,0.15); color: #fcd34d; }

/* Doc entries */
.inspector-doc-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  font-size: 0.77rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.04));
}
.inspector-doc-entry:hover {
  background: rgba(255,255,255,0.03);
}

.inspector-doc-icon { flex-shrink: 0; font-size: 1rem; }

.inspector-doc-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}

.inspector-doc-meta {
  font-size: 0.68rem;
  opacity: 0.4;
  flex-shrink: 0;
}

.inspector-doc-dl {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.45;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 2px 6px;
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  border-radius: 4px;
  transition: opacity 0.15s;
}
.inspector-doc-dl:hover { opacity: 1; }

/* Highlight selected task card */
[data-task-id].inspector-selected,
[data-collective-task-id].inspector-selected {
  outline: 2px solid rgba(99,102,241,0.7);
  outline-offset: -2px;
}

@media (max-width: 700px) {
  .inspector-body { grid-template-columns: 1fr; }
  .inspector-col + .inspector-col { border-left: none; border-top: 1px solid var(--border, rgba(255,255,255,0.08)); }
}

/* ── Mobile tweaks ≤ 860px ──────────────────────────────── */
@media (max-width: 860px) {
  /* Coordination how-to guide: 3 cols → 1 col */
  .coord-steps-grid {
    grid-template-columns: 1fr !important;
  }

  /* Coordination header stacks on small screens */
  .coord-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .coord-header-actions {
    align-items: flex-start;
    width: 100%;
  }
}

/* ── Mobile tweaks ≤ 600px ──────────────────────────────── */
@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  .brand-title {
    font-size: 30px;
  }

  .section-head h3 {
    font-size: 22px;
  }

  /* Fixed-height panels become scrollable containers */
  .chat-panel,
  .thread-panel,
  .kanban-board-panel,
  .task-composer-panel,
  .collective-form-panel,
  .collective-list-panel {
    height: auto;
    min-height: 320px;
    max-height: 75vh;
  }

  .financial-chat-panel {
    height: auto;
    min-height: 280px;
  }

  .agent-file-textarea {
    min-height: 260px;
  }

  .topbar-compact-right {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* ─── Carousel Studio ─────────────────────────────────────────────────────── */

.c-outputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.c-slide-thumb {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.c-slide-thumb a {
  display: block;
  width: 100%;
}

.c-slide-thumb img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s;
}

.c-slide-thumb img:hover {
  transform: scale(1.02);
}

.c-slide-thumb-name {
  font-size: 8px;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  max-width: 108px;
}

.c-tmpl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.c-tmpl-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--line);
  transition: border-color 0.15s;
}
.c-tmpl-card > *:not(.c-tmpl-edit-panel) {
  flex-shrink: 0;
}

.c-tmpl-card.is-active {
  border-color: rgba(242, 194, 0, 0.35);
}

.c-tmpl-card img {
  width: 48px;
  height: 60px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.c-tmpl-body {
  flex: 1;
  min-width: 0;
}

.c-tmpl-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-tmpl-card.is-active .c-tmpl-name {
  color: #F2C200;
}

.c-tmpl-meta {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-tmpl-activate-btn {
  font-size: 9px;
  padding: 4px 8px;
  background: rgba(242, 194, 0, 0.1);
  border: 1px solid rgba(242, 194, 0, 0.25);
  border-radius: 5px;
  color: #F2C200;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.c-tmpl-activate-btn:hover {
  background: rgba(242, 194, 0, 0.18);
}

.c-tmpl-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.c-tmpl-edit-btn {
  font-size: 9px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.c-tmpl-edit-btn:hover { background: rgba(255,255,255,0.1); color: var(--fg); }

.c-tmpl-edit-panel {
  flex-basis: 100%;
  margin-top: 2px;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.c-tmpl-edit-label {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.c-tmpl-edit-input {
  width: 100%;
  padding: 5px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: var(--fg);
  font-size: 11px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.c-tmpl-edit-input:focus { outline: none; border-color: rgba(255,255,255,0.25); }

.c-tmpl-edit-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.c-tmpl-save-btn {
  font-size: 10px;
  padding: 5px 12px;
  background: rgba(242,194,0,0.12);
  border: 1px solid rgba(242,194,0,0.3);
  border-radius: 5px;
  color: #F2C200;
  cursor: pointer;
}
.c-tmpl-save-btn:hover { background: rgba(242,194,0,0.2); }

.c-tmpl-save-msg {
  font-size: 10px;
  color: #39FF14;
}

.c-tmpl-delete-btn {
  font-size: 10px;
  padding: 5px 10px;
  background: rgba(255,60,60,0.08);
  border: 1px solid rgba(255,60,60,0.25);
  border-radius: 5px;
  color: #ff6b6b;
  cursor: pointer;
}
.c-tmpl-delete-btn:hover { background: rgba(255,60,60,0.18); }

.c-job-status {
  display: none;
  padding: 10px 0;
  font-size: 10px;
}

.c-job-status.running {
  display: block;
  color: #F2C200;
}

.c-job-status.error {
  display: block;
  color: var(--danger);
}

/* (c-thumb-del individual removed — replaced by bulk selection) */

.c-outputs-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.c-sel-all-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.c-del-selected-btn {
  font-size: 10px;
  padding: 4px 10px;
  background: rgba(255, 119, 112, 0.1);
  border: 1px solid rgba(255, 119, 112, 0.3);
  border-radius: 6px;
  color: var(--danger);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.c-del-selected-btn:hover:not(:disabled) {
  background: rgba(255, 119, 112, 0.2);
}

.c-del-selected-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.c-thumb-check-wrap {
  position: relative;
  display: block;
  width: 100%;
  cursor: pointer;
}

.c-thumb-check {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--danger);
}

.c-thumb-check-wrap img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s;
}

.c-thumb-check:checked + a img,
.c-thumb-check-wrap:has(.c-thumb-check:checked) img {
  border-color: var(--danger);
  transform: scale(0.96);
}

#carousel-edit-instruction {
  resize: vertical;
  min-height: 80px;
  font-size: 12px;
  line-height: 1.5;
}

/* ══════════════════ PRODUCTIVITY TAB ════════════════════════════════════ */
.productivity-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .productivity-layout { grid-template-columns: 1fr; }
}
.productivity-left  { display: flex; flex-direction: column; gap: 16px; }
.productivity-right { position: sticky; top: 16px; }

/* Calendar grid */
.productivity-calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.prod-day-block { display: flex; flex-direction: column; gap: 4px; }
.prod-day-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 4px 0 2px;
  border-bottom: 1px solid var(--line);
}
.prod-event-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
}
.prod-event-time  { color: var(--muted); min-width: 52px; flex-shrink: 0; }
.prod-event-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-event-del   {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px; flex-shrink: 0;
}
.prod-event-del:hover { color: #ff6b6b; }

/* Task tabs */
.prod-task-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.prod-task-tab {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.prod-task-tab.active, .prod-task-tab:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: var(--line-strong);
}

/* Task list */
.productivity-tasks-panel { min-height: 80px; max-height: 260px; overflow-y: auto; }
.prod-task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.prod-task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.12s;
}
.prod-task-item:hover { background: rgba(255,255,255,0.04); border-color: var(--line); }
.prod-task-check { width: 14px; height: 14px; margin-top: 1px; flex-shrink: 0; accent-color: #4ade80; cursor: pointer; }
.prod-task-title { font-size: 12px; flex: 1; line-height: 1.4; color: var(--text); }
.prod-task-notes { font-size: 10px; color: var(--muted); display: block; }

/* Quick add form */
.prod-quick-add-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.prod-quick-add-form input {
  flex: 1;
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
}
.prod-quick-add-form input:focus { outline: none; border-color: var(--line-strong); }

/* Chat */
.productivity-chat-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100vh - 180px);
  min-height: 400px;
}
.productivity-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Event modal */
.prod-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.prod-modal-box {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
}
.prod-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}
/* ═══════════════════════ CEREBRO TAB ══════════════════════════════════ */
.tab-page .financial-layout {
  min-height: 400px;
}
.tab-page .financial-left-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  grid-row: 1 / -1;
}
.cerebro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.cerebro-stat { text-align: center; }
.cerebro-stat .metric-value { font-size: 22px; font-weight: 700; display: block; }
.cerebro-stat .metric-name { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.cerebro-graph-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#cerebro-svg { width: 100%; flex: 1; min-height: 400px; }
.cerebro-results { overflow-y: auto; }
.cerebro-result-item {
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted-strong);
}
.cerebro-result-item:hover { background: var(--accent-soft); color: var(--text); }
.cerebro-result-item .result-type {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 6px;
}
.cerebro-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted-strong);
  cursor: pointer;
  padding: 3px 0;
}
.cerebro-filter input { accent-color: var(--focus); }
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-persona { background: #7fa8ff; }
.dot-org { background: #76d7a8; }
.dot-territorio { background: #f0b35f; }
.dot-evento { background: #ff7770; }
.dot-proyecto { background: #a78bfa; }
.dot-tema { background: #f472b6; }
.cerebro-detail-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-strong);
  max-height: 300px;
  overflow-y: auto;
}
.cerebro-detail-content h5 { margin: 10px 0 4px; color: var(--text); font-size: 13px; }
.cerebro-detail-content ul { padding-left: 16px; margin: 4px 0; }
.cerebro-detail-content li { margin: 2px 0; }
.panel-subtitle { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--muted-strong); }

/* ── Cerebro Modal ── */
.cerebro-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cerebro-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}
.cerebro-modal-box {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.cerebro-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.cerebro-modal-header .eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.cerebro-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.cerebro-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted-strong);
}
.cerebro-modal-body .detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cerebro-modal-body .detail-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.cerebro-modal-body .detail-meta-item .dot {
  width: 8px;
  height: 8px;
}
.cerebro-modal-body h5 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 16px 0 6px;
  font-weight: 600;
}
.cerebro-modal-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.cerebro-modal-body ul li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.cerebro-modal-body ul li:last-child { border-bottom: none; }
.cerebro-modal-body ul li strong {
  color: var(--text);
  font-weight: 600;
  min-width: 100px;
}
.cerebro-modal-body ul li .relation-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.cerebro-modal-body ul li .relation-link:hover { color: var(--focus); }
.cerebro-modal-body ul li .relation-ctx {
  color: var(--muted);
  font-size: 12px;
}
.cerebro-modal-body .historial-item {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
}
.cerebro-modal-body .historial-item .fecha {
  color: var(--muted);
  font-size: 11px;
  min-width: 80px;
  font-family: monospace;
}
.cerebro-modal-body .historial-item .nota { color: var(--text); }
.cerebro-modal-body .summary-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border-left: 3px solid var(--border);
}

/* ── Modal action buttons ── */
.cerebro-modal-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.cerebro-modal-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.cerebro-modal-btn-edit {
  background: var(--focus);
  color: #fff;
  border-color: var(--focus);
}
.cerebro-modal-btn-edit:hover { filter: brightness(1.15); }
.cerebro-modal-btn-delete {
  background: transparent;
  color: #ef4444;
  border-color: #ef4444;
}
.cerebro-modal-btn-delete:hover { background: rgba(239,68,68,0.1); }
.cerebro-modal-btn-save {
  background: #22c55e;
  color: #fff;
  border-color: #22c55e;
}
.cerebro-modal-btn-save:hover { filter: brightness(1.1); }
.cerebro-modal-btn-save:disabled { opacity: 0.6; cursor: wait; }
.cerebro-modal-btn-cancel {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.cerebro-modal-btn-cancel:hover { background: var(--accent-soft); }

/* ── Edit fields inside modal ── */
.cerebro-modal-body .cerebro-edit-field { margin-bottom: 12px; }
.cerebro-modal-body .cerebro-edit-field label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.cerebro-modal-body .cerebro-edit-field input,
.cerebro-modal-body .cerebro-edit-field textarea,
.cerebro-modal-body .cerebro-edit-field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
}
.cerebro-modal-body .cerebro-edit-field input:focus,
.cerebro-modal-body .cerebro-edit-field textarea:focus,
.cerebro-modal-body .cerebro-edit-field select:focus {
  border-color: var(--focus);
  outline: none;
}
.cerebro-modal-body .cerebro-edit-field textarea {
  resize: vertical;
  min-height: 50px;
}

/* ── Relation connector ── */
.cerebro-rel-connector {
  display: flex;
  gap: 6px;
}
.cerebro-rel-tipo-select {
  width: 140px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 8px;
  font-size: 12px;
}
.cerebro-rel-search-wrap {
  flex: 1;
  position: relative;
}
.cerebro-rel-search-wrap input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
}
.cerebro-rel-search-wrap input:focus {
  border-color: var(--focus);
  outline: none;
}
.cerebro-rel-results {
  display: none;
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 1100;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.cerebro-rel-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.cerebro-rel-result-item:hover { background: var(--accent-soft); }

/* ── Pending relations list ── */
.cerebro-rel-pending { margin-top: 8px; }
.cerebro-rel-pending-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}
.cerebro-rel-pending-tipo {
  color: var(--muted);
  font-weight: 500;
  min-width: 100px;
}
.cerebro-rel-pending-arrow { color: var(--muted); }
.cerebro-rel-pending-name {
  color: var(--focus);
  flex: 1;
}
.cerebro-rel-pending-del {
  color: #ef4444;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.cerebro-rel-pending-del:hover { color: #ff6b6b; }

/* ── Monitoreo Fuentes ───────────────────────────────────── */
#monitoreo-fuentes-panel {
  grid-column: 1 / -1;
  margin-top: 16px;
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
}
#monitoreo-fuentes-panel .section-head {
  margin-bottom: 12px;
}
.monitoreo-fuentes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 12px;
  max-height: 300px;
  overflow-y: auto;
}
.monitoreo-fuentes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 12px;
  max-height: 400px;
  overflow-y: auto;
}
.monitoreo-fuente-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.monitoreo-fuente-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.monitoreo-fuente-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.monitoreo-fuente-meta {
  font-size: 11px;
  color: var(--muted);
}
.monitoreo-fuente-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.monitoreo-fuente-actions button {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  cursor: pointer;
}
.monitoreo-fuente-actions button:hover {
  background: var(--accent-soft);
}
.monitoreo-fuente-actions .btn-edit {
  border-color: #3b82f6;
  color: #3b82f6;
}
.monitoreo-fuente-actions .btn-delete {
  border-color: #ef4444;
  color: #ef4444;
}
.monitoreo-fuentes-form {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.monitoreo-fuentes-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.monitoreo-fuentes-form .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.monitoreo-fuentes-form .form-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* ── Filters list ── */
.cerebro-filters-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cerebro-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted-strong);
  cursor: pointer;
  transition: background 0.15s;
}
.cerebro-filter-item:hover { background: var(--accent-soft); }
.cerebro-filter-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--focus);
  cursor: pointer;
  flex-shrink: 0;
}
.cerebro-filter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cerebro-filter-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.node-label {
  font-size: 11px;
  fill: var(--text);
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}
.link-line { stroke: rgba(255,255,255,0.12); stroke-width: 1; }
.link-line:hover { stroke: rgba(255,255,255,0.4); }
.link-line.link-respaldado_por { stroke: #22c55e; }
.link-line.link-aliado_de { stroke: #3b82f6; }
.link-line.link-opuesto { stroke: #ef4444; }
.link-line.link-partido { stroke: #0891b2; }
.link-line.link-grupo_politico { stroke: #8b5cf6; }
.link-line.link-asociado { stroke: rgba(255,255,255,0.15); }
.cerebro-filter label { display: flex; align-items: center; gap: 6px; }

/* ── Alcance tabs ──────────────────────────────────────────── */
.cerebro-alcance-tabs {
  display: flex; gap: 4px;
}
.cerebro-alcance-tab {
  flex: 1; padding: 7px 0; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 12px; cursor: pointer;
  font-weight: 500; transition: all 0.2s;
}
.cerebro-alcance-tab.active {
  background: var(--focus); color: #fff; border-color: var(--focus);
}
.cerebro-alcance-tab:hover:not(.active) {
  background: var(--accent-soft); color: var(--text);
}

/* ── Context menu ────────────────────────────────────────────── */
.cerebro-context-menu {
  position: fixed; z-index: 2000;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 0; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.cerebro-ctx-item {
  padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--text);
}
.cerebro-ctx-item:hover { background: var(--accent-soft); }
.cerebro-ctx-danger { color: #ef4444; }
.cerebro-ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Edit panel ────────────────────────────────────────────── */
.cerebro-edit-panel {
  position: fixed; top: 52px; right: -340px; width: 320px;
  height: calc(100vh - 52px); background: var(--card);
  border-left: 1px solid var(--border); padding: 16px;
  overflow-y: auto; transition: right 0.3s ease; z-index: 500;
}
.cerebro-edit-panel.open { right: 0; }
.cerebro-edit-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer;
}
.cerebro-edit-title { font-size: 14px; color: var(--focus); margin-bottom: 14px; }
.cerebro-edit-field { margin-bottom: 12px; }
.cerebro-edit-field label {
  display: block; font-size: 11px; color: var(--muted);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.cerebro-edit-field input,
.cerebro-edit-field textarea,
.cerebro-edit-field select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 7px 10px; font-size: 13px;
}
.cerebro-edit-field input:focus,
.cerebro-edit-field textarea:focus,
.cerebro-edit-field select:focus { border-color: var(--focus); outline: none; }
.cerebro-edit-field textarea { resize: vertical; min-height: 50px; }
.cerebro-edit-rels-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; background: var(--bg); border-radius: 4px;
  margin-bottom: 4px; font-size: 12px;
}
.cerebro-edit-rels-item .rel-type { color: var(--muted); }
.cerebro-edit-rels-item .rel-target { color: var(--focus); flex: 1; }
/* ════════════════════════════════════════════════════════════════════════ */
