/* =============================================================================
   CitaScope — Estilos del Dashboard
   Tema oscuro profesional con acentos en índigo/esmeralda
   ============================================================================= */

/* ── Variables globales ─────────────────────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg-base:        #0b1120;
  --bg-surface:     #111827;
  --bg-card:        #1a2235;
  --bg-card-hover:  #1f2a3f;
  --bg-input:       #0f1829;
  --border:         #2a3a55;
  --border-subtle:  #1e2d44;

  --text-primary:   #e2e8f0;
  --text-secondary: #8b9bb4;
  --text-muted:     #4a5568;

  --indigo:         #6366f1;
  --indigo-light:   #818cf8;
  --indigo-dim:     rgba(99,102,241,.12);
  --emerald:        #10b981;
  --emerald-dim:    rgba(16,185,129,.12);
  --amber:          #f59e0b;
  --amber-dim:      rgba(245,158,11,.12);
  --blue:           #3b82f6;
  --blue-dim:       rgba(59,130,246,.12);
  --red:            #ef4444;
  --red-dim:        rgba(239,68,68,.12);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-card: 0 4px 24px rgba(0,0,0,.35);
  --shadow-glow: 0 0 28px rgba(99,102,241,.18);

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', monospace;

  --header-bg: rgba(11,17,32,.88);
  --header-border: var(--border-subtle);
  --header-shadow: none;

  --net-canvas-bg:   #0a0f1e;
  --net-label-color: rgba(226,232,240,.9);
  --net-link-color:  rgba(255,255,255,.22);
}

/* ── Tema Claro ──────────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:        #f1f5f9;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f8fafc;
  --bg-input:       #f1f5f9;
  --border:         #cbd5e1;
  --border-subtle:  #e2e8f0;

  --text-primary:   #1e293b;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --indigo:         #6366f1;
  --indigo-light:   #4f46e5;
  --indigo-dim:     rgba(99,102,241,.1);
  --emerald:        #059669;
  --emerald-dim:    rgba(5,150,105,.1);
  --amber:          #d97706;
  --amber-dim:      rgba(217,119,6,.1);
  --blue:           #2563eb;
  --blue-dim:       rgba(37,99,235,.1);
  --red:            #dc2626;
  --red-dim:        rgba(220,38,38,.1);

  --shadow-card: 0 2px 16px rgba(0,0,0,.08);
  --shadow-glow: 0 0 24px rgba(99,102,241,.12);

  --header-bg:     rgba(255,255,255,.95);
  --header-border: #e2e8f0;
  --header-shadow: 0 1px 8px rgba(0,0,0,.06);

  --net-canvas-bg:   #dde6f5;
  --net-label-color: #1e293b;
  --net-link-color:  rgba(30,41,59,.3);
}

/* ── Tema Bosque (Naturaleza) ────────────────────────────────────────────────── */
[data-theme="ocean"] {
  --bg-base:        #061510;
  --bg-surface:     #0c2518;
  --bg-card:        #112d1e;
  --bg-card-hover:  #163826;
  --bg-input:       #091a12;
  --border:         #1e4a30;
  --border-subtle:  #133520;

  --text-primary:   #c8f0d0;
  --text-secondary: #5a9e6e;
  --text-muted:     #2d6040;

  --indigo:         #22c55e;
  --indigo-light:   #4ade80;
  --indigo-dim:     rgba(34,197,94,.12);
  --emerald:        #a3e635;
  --emerald-dim:    rgba(163,230,53,.12);
  --amber:          #fbbf24;
  --amber-dim:      rgba(251,191,36,.12);
  --blue:           #34d399;
  --blue-dim:       rgba(52,211,153,.12);
  --red:            #fb923c;
  --red-dim:        rgba(251,146,60,.12);

  --shadow-card: 0 4px 24px rgba(0,0,0,.5);
  --shadow-glow: 0 0 28px rgba(34,197,94,.2);

  --header-bg:     rgba(6,21,16,.92);
  --header-border: #1e4a30;
  --header-shadow: none;

  --net-canvas-bg:   #030e08;
  --net-label-color: rgba(200,240,208,.9);
  --net-link-color:  rgba(255,255,255,.22);
}

/* ── Reset & base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Utilidades ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Header ──────────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
}
.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text-primary);
}
.logo-badge {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .08em;
  background: var(--indigo-dim);
  color: var(--indigo-light);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 4px;
  padding: 2px 6px;
}
.header-nav { display: flex; gap: 10px; align-items: center; }
.header-biblioteca-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  margin-right: 6px;
  filter: brightness(0) invert(1);
  opacity: .9;
}
[data-theme="light"] .header-biblioteca-logo,
[data-theme="light"] .footer-biblioteca-logo {
  filter: none;
  opacity: .85;
}

/* ── Theme Switcher ──────────────────────────────────────────────────────────── */
.theme-switcher {
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 5px;
}
.theme-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .15s;
  opacity: .55;
}
.theme-btn:hover  { opacity: .85; transform: scale(1.12); }
.theme-btn.active { background: var(--indigo-dim); opacity: 1; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.app-footer {
  background: var(--header-bg);
  border-top: 1px solid var(--header-border);
  padding: 18px 28px;
  margin-top: auto;
}
.footer-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-biblioteca-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: .85;
}
.footer-copy {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Botones ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .18s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99,102,241,.35);
}
.btn-primary:hover {
  background: var(--indigo-light);
  box-shadow: 0 4px 18px rgba(99,102,241,.5);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--indigo);
}

/* ── Vista Upload ────────────────────────────────────────────────────────────── */
.view-upload {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 28px;
}
.upload-hero {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  text-align: center;
}
.hero-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  background: linear-gradient(135deg, #e2e8f0 30%, var(--indigo-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="light"] .hero-title {
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: #1e3a6e;
  background-clip: unset;
  color: #1e3a6e;
}
.hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.7;
}

/* Drop zone */
.drop-zone {
  width: 100%;
  border: 2px dashed rgba(99,102,241,.45);
  border-radius: var(--radius-xl);
  background: var(--indigo-dim);
  padding: 52px 36px;
  cursor: pointer;
  transition: all .22s ease;
  position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--indigo);
  background: rgba(99,102,241,.18);
  box-shadow: var(--shadow-glow);
  transform: scale(1.01);
}
.drop-zone.drag-over .drop-icon-wrap { transform: scale(1.1); }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.drop-icon-wrap {
  transition: transform .22s;
}
.drop-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}
.drop-hint {
  font-size: .9rem;
  color: var(--text-secondary);
}
.drop-limit {
  font-size: .78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Features grid */
.feature-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: .82rem;
  color: var(--text-secondary);
}
.feature-icon { font-size: 1rem; }

/* ── Vista Loading ───────────────────────────────────────────────────────────── */
.view-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 28px;
}
.loading-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 52px 48px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* Anillo giratorio */
.loading-rings {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
}
.r1 {
  width: 60px; height: 60px;
  border-top-color: var(--indigo);
  animation: spin .8s linear infinite;
}
.r2 {
  width: 78px; height: 78px;
  border-right-color: var(--emerald);
  animation: spin 1.3s linear infinite reverse;
}
.r3 {
  width: 98px; height: 98px;
  border-bottom-color: var(--amber);
  animation: spin 1.9s linear infinite;
}
.ring-center {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-title {
  font-size: 1.25rem;
  font-weight: 700;
}
.loading-file {
  font-size: .82rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Steps list */
.loading-steps {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: .85rem;
  color: var(--text-muted);
  transition: all .3s;
}
.step.active {
  border-color: var(--indigo);
  background: var(--indigo-dim);
  color: var(--text-primary);
}
.step.done {
  border-color: var(--emerald);
  background: var(--emerald-dim);
  color: var(--emerald);
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: all .3s;
}
.step.active .step-dot {
  background: var(--indigo);
  box-shadow: 0 0 8px var(--indigo);
  animation: pulse 1s ease-in-out infinite;
}
.step.done .step-dot { background: var(--emerald); box-shadow: none; animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── Vista Dashboard ─────────────────────────────────────────────────────────── */
.view-dashboard {
  max-width: 1300px;
  margin: 0 auto;
  padding: 32px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeUp .4s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* Bandeja documento */
.doc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.doc-info { display: flex; align-items: center; gap: 14px; }
.doc-icon {
  width: 44px; height: 44px;
  background: var(--indigo-dim);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-name {
  font-size: .98rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-pages { font-size: .78rem; color: var(--text-secondary); margin-top: 2px; }
.doc-type-pill {
  padding: 7px 18px;
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 700;
  background: var(--indigo-dim);
  color: var(--indigo-light);
  border: 1px solid rgba(99,102,241,.35);
  white-space: nowrap;
}

/* KPIs */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-card.accent-indigo::before { background: var(--indigo); }
.kpi-card.accent-emerald::before { background: var(--emerald); }
.kpi-card.accent-amber::before { background: var(--amber); }
.kpi-card.accent-blue::before { background: var(--blue); }
.kpi-card:hover { box-shadow: var(--shadow-card); }

.kpi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.kpi-icon { font-size: 1.4rem; }
.kpi-trend {
  font-size: .72rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  padding: 3px 8px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
}
.kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}
.accent-indigo .kpi-value { color: var(--indigo-light); }
.accent-emerald .kpi-value { color: var(--emerald); }
.accent-amber .kpi-value { color: var(--amber); }
.accent-blue .kpi-value { color: var(--blue); }
.kpi-label { font-size: .78rem; color: var(--text-secondary); font-weight: 600; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.card-wide { grid-column: 1 / -1; }
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.card-sub {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Trío de charts */
.charts-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Chart wrappers */
.chart-wrap { position: relative; }
.chart-sm { height: 200px; margin-bottom: 16px; }
.chart-sm.chart-radar-wrap { height: 300px; }
.chart-lg { height: 280px; }

/* Leyenda de donut */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
}
.legend-left { display: flex; align-items: center; gap: 8px; }
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-name { color: var(--text-secondary); }
.legend-val { font-weight: 700; color: var(--text-primary); }
.legend-pct { color: var(--text-muted); font-size: .72rem; }

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.heatmap-cell {
  border-radius: var(--radius-sm);
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: default;
  transition: opacity .2s;
}
.heatmap-cell:hover { opacity: .85; }
.heatmap-count {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}
.heatmap-seg {
  font-size: .62rem;
  color: rgba(255,255,255,.7);
  font-family: var(--font-mono);
}
[data-theme="light"] .heatmap-count { color: #1e293b; }
[data-theme="light"] .heatmap-seg   { color: rgba(30,41,59,.65); }
.heatmap-scale {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .75rem;
  color: var(--text-muted);
}
.heatmap-bar {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg,
    rgba(99,102,241,.1) 0%,
    rgba(99,102,241,.5) 50%,
    rgba(99,102,241,1) 100%
  );
}

/* Índices */
.indices-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.index-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.index-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.index-name { font-size: .82rem; font-weight: 600; color: var(--text-secondary); }
.index-pct { font-size: 1.4rem; font-weight: 800; }
.ia-color  { color: var(--blue); }
.ic-color  { color: var(--red); }
.im-color  { color: var(--amber); }
.index-track {
  background: var(--bg-surface);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}
.index-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.ia-fill { background: var(--blue); }
.ic-fill { background: var(--red); }
.im-fill { background: var(--amber); }
.index-desc { font-size: .76rem; color: var(--text-muted); line-height: 1.5; }

/* Tabla de citas */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.table-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.select-filter {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  cursor: pointer;
  transition: border-color .18s;
}
.select-filter:hover,
.select-filter:focus { border-color: var(--indigo); outline: none; }

.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.cites-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.cites-table thead tr {
  background: var(--bg-surface);
}
.cites-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.cites-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  max-width: 260px;
}
.cites-table tbody tr { transition: background .15s; }
.cites-table tbody tr:hover { background: var(--bg-card-hover); }
.cites-table tbody tr:last-child td { border-bottom: none; }

.cell-cite {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--indigo-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.cell-ctx {
  color: var(--text-muted);
  font-size: .74rem;
  line-height: 1.5;
  max-width: 280px;
}
.cell-num { color: var(--text-muted); font-size: .72rem; width: 32px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-textual     { background: rgba(99,102,241,.2);  color: var(--indigo-light); }
.badge-paraphrased { background: rgba(16,185,129,.2);  color: var(--emerald); }
.badge-secondary   { background: rgba(245,158,11,.2);  color: var(--amber); }
.badge-support     { background: rgba(59,130,246,.2);  color: var(--blue); }
.badge-contrast    { background: rgba(239,68,68,.2);   color: var(--red); }
.badge-mention     { background: rgba(99,102,241,.15); color: #a5b4fc; }
.badge-introduction{ background: rgba(16,185,129,.12); color: var(--emerald); }
.badge-methodology { background: rgba(59,130,246,.12); color: var(--blue); }
.badge-results     { background: rgba(245,158,11,.12); color: var(--amber); }
.badge-discussion  { background: rgba(239,68,68,.12);  color: var(--red); }
.badge-other       { background: var(--bg-surface);    color: var(--text-muted); }

/* Diagnóstico */
.diagnosis-card {
  border-left: 3px solid var(--indigo);
}
.diagnosis-body {
  line-height: 1.8;
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 20px;
}
.diagnosis-body strong { color: var(--text-primary); }
.profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: .8rem;
}
.chip-label { color: var(--text-secondary); }
.chip-val { color: var(--text-primary); font-weight: 700; }

/* Recomendaciones */
.recs-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rec-item {
  display: flex;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: border-color .2s;
}
.rec-item:hover { border-color: var(--border); }
.rec-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}
.rec-body { flex: 1; }
.rec-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.rec-title { font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.rec-priority {
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 8px;
  border-radius: 99px;
}
.prio-Alta   { background: rgba(239,68,68,.2);  color: var(--red); }
.prio-Media  { background: rgba(245,158,11,.2); color: var(--amber); }
.prio-Baja   { background: rgba(16,185,129,.2); color: var(--emerald); }
.rec-category {
  font-size: .7rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
}
.rec-detail { font-size: .82rem; color: var(--text-secondary); line-height: 1.6; }

/* Toast de error */
.error-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1220;
  border: 1px solid rgba(239,68,68,.5);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  max-width: 520px;
  width: calc(100% - 48px);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}
.error-icon { color: var(--red); font-size: 1.1rem; flex-shrink: 0; }
.error-msg { flex: 1; font-size: .85rem; color: var(--text-primary); }
.error-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.error-close:hover { color: var(--text-primary); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .charts-trio { grid-template-columns: repeat(2, 1fr); }
  .indices-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .view-dashboard { padding: 20px 16px 40px; gap: 16px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .charts-trio { grid-template-columns: 1fr; }
  .indices-row { grid-template-columns: 1fr; }
  .heatmap-grid { grid-template-columns: repeat(5, 1fr); }
  .header-inner { padding: 0 16px; }
  .theme-btn { width: 24px; height: 24px; font-size: 13px; }
  .theme-switcher { padding: 2px 4px; gap: 2px; }
  .drop-zone { padding: 36px 20px; }
  .loading-card { padding: 36px 24px; }
  .hero-title { font-size: 1.5rem; }
  .table-toolbar { flex-direction: column; }
  .table-filters { width: 100%; }
  .select-filter { flex: 1; }
}
@media (max-width: 400px) {
  .kpi-row { grid-template-columns: 1fr; }
}

/* =============================================================================
   CitaScope v2 — Nuevos estilos (modo tabs, toggle IA, bulk, AI section)
   ============================================================================= */

/* ── Pestañas de modo ─────────────────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  justify-content: center;
  width: 100%;
}
.mode-tab {
  padding: 9px 24px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.mode-tab.active {
  background: var(--indigo);
  color: #fff;
  border-color: var(--indigo);
  box-shadow: 0 2px 12px rgba(99,102,241,.35);
}
.mode-tab:not(.active):hover {
  border-color: var(--indigo);
  color: var(--text-primary);
}

/* ── Toggle IA ────────────────────────────────────────────────────────────── */
.ai-toggle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.ai-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color .18s;
}
.ai-toggle-label:hover { border-color: #7c3aed; }
.ai-toggle-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #7c3aed;
  cursor: pointer;
}
.ai-toggle-icon { font-size: 1.1rem; }
.ai-toggle-text { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.ai-toggle-hint { font-size: .72rem; color: var(--text-muted); }

/* =============================================================================
   Acordeón de tarjetas del dashboard
   ============================================================================= */

.ac-card {
  padding: 0;
  overflow: hidden;
}
.ac-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  transition: background .15s;
}
.ac-header:hover { background: var(--bg-card-hover); }

.ac-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ac-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.ac-sub {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 400;
}
.ac-chevron {
  font-size: .7rem;
  color: var(--text-muted);
  transition: transform .25s ease;
  flex-shrink: 0;
}
.ac-chevron.open { transform: rotate(180deg); }

.ac-body {
  padding: 0 24px 24px;
  overflow: hidden;
}
.ac-body.collapsed {
  display: none;
}

/* diagnosis-card border should apply to the full card, not just header */
.diagnosis-card.ac-card { border-left: 3px solid var(--indigo); }

/* Separator between header and body when open */
.ac-card:has(.ac-body:not(.collapsed)) .ac-header {
  border-bottom: 1px solid var(--border-subtle);
}

/* Selector de modelo */
.model-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.model-select-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.model-select {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .8rem;
  padding: 7px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color .18s;
  max-width: 380px;
}
.model-select:hover,
.model-select:focus { border-color: #7c3aed; }
.model-select option,
.model-select optgroup { background: var(--bg-card); color: var(--text-primary); }
.model-select optgroup { font-weight: 600; font-size: .75rem; }

/* ── Badge OpenRouter ─────────────────────────────────────────────────────── */
.badge-or {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .06em;
  background: rgba(124,58,237,.15);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,.3);
  border-radius: 4px;
  padding: 2px 6px;
}
.badge-or-lg {
  font-size: .72rem;
  font-weight: 700;
  background: rgba(124,58,237,.15);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  white-space: nowrap;
}

/* ── Bulk file list ───────────────────────────────────────────────────────── */
.bulk-file-section {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bulk-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--bg-card);
}
.bulk-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  gap: 10px;
}
.bulk-file-name { flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-file-size { color: var(--text-muted); font-size: .72rem; white-space: nowrap; font-family: var(--font-mono); }
.bulk-file-remove {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: .9rem; padding: 2px 6px;
  border-radius: 4px; line-height: 1;
}
.bulk-file-remove:hover { color: var(--red); }
.bulk-file-status {
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 99px;
  white-space: nowrap;
}
.bfs-pending    { background: var(--bg-card); color: var(--text-muted); }
.bfs-processing { background: var(--indigo-dim); color: var(--indigo-light); }
.bfs-done       { background: var(--emerald-dim); color: var(--emerald); }
.bfs-error      { background: var(--red-dim); color: var(--red); }

/* ── Bulk loading progress ────────────────────────────────────────────────── */
.bulk-progress-track {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 99px;
  overflow: hidden;
  margin: 4px 0;
}
.bulk-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--emerald));
  border-radius: 99px;
  transition: width .4s ease;
}
.bulk-progress-label {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.bulk-status-list {
  list-style: none;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
}
.bulk-status-item {
  font-size: .78rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── AI results card ──────────────────────────────────────────────────────── */
.ai-card {
  border-left: 3px solid #7c3aed;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(124,58,237,.04) 100%);
}
.ai-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ── AI table badges ──────────────────────────────────────────────────────── */
.badge-positiva    { background: rgba(16,185,129,.2);  color: var(--emerald); }
.badge-negativa    { background: rgba(239,68,68,.2);   color: var(--red); }
.badge-neutra      { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-alta        { background: rgba(99,102,241,.2);  color: var(--indigo-light); }
.badge-media       { background: rgba(245,158,11,.2);  color: var(--amber); }
.badge-baja        { background: rgba(100,116,139,.2); color: #94a3b8; }

/* Peso en el discurso (barra inline) */
.peso-bar-wrap { display: flex; align-items: center; gap: 6px; }
.peso-bar {
  width: 52px; height: 5px;
  background: var(--bg-surface);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}
.peso-fill { height: 100%; background: #a78bfa; border-radius: 99px; }
.peso-val  { font-size: .7rem; color: var(--text-muted); font-family: var(--font-mono); }

/* Fila expandible de justificación */
.justif-row td {
  padding: 0;
  border-bottom: 1px solid var(--border-subtle);
}
.justif-content {
  padding: 12px 16px;
  background: rgba(124,58,237,.05);
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-left: 3px solid #7c3aed;
}
tr.ai-row { cursor: pointer; }
tr.ai-row:hover { background: var(--bg-card-hover); }

/* ── Bulk results ─────────────────────────────────────────────────────────── */
.btn-danger {
  background: rgba(239,68,68,.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.35);
}
.btn-danger:hover {
  background: rgba(239,68,68,.25);
  transform: translateY(-1px);
}

/* Accordion de documento en bulk */
.bulk-accordion-row td {
  padding: 0;
  border-bottom: 2px solid var(--border);
}
.bulk-accordion-content {
  padding: 20px 24px;
  background: rgba(99,102,241,.04);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.accordion-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.accordion-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.accordion-kpi-val   { font-size: 1.5rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.accordion-kpi-label { font-size: .72rem; color: var(--text-secondary); }
.accordion-diag {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--indigo);
}
.btn-ver-completo {
  align-self: flex-start;
  background: var(--indigo-dim);
  color: var(--indigo-light);
  border: 1px solid rgba(99,102,241,.35);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.btn-ver-completo:hover { background: rgba(99,102,241,.25); }

@media (max-width: 680px) {
  .accordion-kpi-row { grid-template-columns: repeat(2,1fr); }
}

/* ── Chip de usuario logueado ───────────────────────────────────────────────── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--indigo-dim);
  border: 1px solid var(--indigo);
  border-radius: 99px;
  padding: 4px 10px 4px 12px;
  font-size: .82rem;
  color: var(--indigo-light);
  font-weight: 600;
}
.user-chip button {
  background: none;
  border: none;
  color: var(--indigo-light);
  cursor: pointer;
  font-size: .9rem;
  padding: 0;
  line-height: 1;
  opacity: .7;
  transition: opacity .15s;
}
.user-chip button:hover { opacity: 1; }
.user-chip.hidden { display: none !important; }

/* ── Modal de control de acceso ─────────────────────────────────────────────── */
.access-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.access-modal-overlay.hidden { display: none; }
.access-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-card);
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.access-modal-icon {
  font-size: 2.4rem;
  text-align: center;
  margin-bottom: 14px;
}
.access-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 10px;
}
.access-modal-desc {
  font-size: .88rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 22px;
}
.access-form-group {
  margin-bottom: 14px;
}
.access-form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
}
.access-form-group input,
.access-form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  transition: border-color .18s;
}
.access-form-group input:focus,
.access-form-group textarea:focus { border-color: var(--indigo); }
.access-form-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: #f87171;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: .82rem;
  margin-bottom: 12px;
}
.access-form-error.hidden { display: none; }

/* ── Icono de ayuda contextual hacia la Guía ─────────────────────────────── */
.guide-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: .6rem;
  font-weight: 800;
  font-style: normal;
  color: #ffffff;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  text-decoration: none;
  margin-left: 5px;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
  transition: color .15s, border-color .15s, background .15s;
  cursor: pointer;
}
.guide-hint:hover {
  color: #ffffff;
  border-color: var(--indigo);
  background: var(--indigo);
}
[data-theme="light"] .guide-hint {
  color: #1e293b;
  border-color: #94a3b8;
}
[data-theme="light"] .guide-hint:hover {
  color: #ffffff;
}

/* =============================================================================
   CitaScope Suite — Estilos compartidos para módulos /ris /bib /citas
   ============================================================================= */

/* ── Dropdown de navegación de suite ─────────────────────────────────────── */
.sg-nav-wrap { position: relative; }

.sg-nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 8px;
  z-index: 200;
  animation: modal-in .15s ease;
}
.sg-dropdown-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px 8px;
}
.sg-tool-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.sg-tool-link:hover:not(.sg-tool-disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.sg-tool-link.sg-tool-active {
  background: var(--indigo-dim);
  color: var(--indigo-light);
}
.sg-tool-link.sg-tool-disabled {
  opacity: .4;
  cursor: not-allowed;
}
.sg-tool-icon { font-size: 1.1rem; flex-shrink: 0; }
.sg-tool-info { display: flex; flex-direction: column; line-height: 1.3; }
.sg-tool-info strong { font-size: .88rem; }
.sg-tool-info small  { font-size: .76rem; color: var(--text-muted); }

/* ── Layout general de módulos suite ──────────────────────────────────────── */
.suite-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Vista de carga (upload) ──────────────────────────────────────────────── */
.suite-upload-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 28px;
}
.suite-upload-hero {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}
.suite-upload-zone {
  width: 100%;
  border: 2px dashed rgba(99,102,241,.45);
  border-radius: var(--radius-xl);
  background: var(--indigo-dim);
  padding: 44px 32px;
  cursor: pointer;
  transition: all .22s ease;
}
.suite-upload-zone:hover,
.suite-upload-zone.drag-over {
  border-color: var(--indigo);
  background: rgba(99,102,241,.18);
  box-shadow: var(--shadow-glow);
}
.suite-upload-zone input[type="file"] { display: none; }
.suite-upload-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.suite-upload-hint {
  font-size: .88rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}
.suite-upload-ext {
  font-size: .76rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 8px;
}

/* ── Vista de resultados ──────────────────────────────────────────────────── */
.suite-dashboard {
  max-width: 1300px;
  margin: 0 auto;
  padding: 32px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeUp .4s ease both;
  width: 100%;
}

/* ── Tarjetas de estadísticas ─────────────────────────────────────────────── */
.suite-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.suite-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform .2s, box-shadow .2s;
}
.suite-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.suite-stat-icon { font-size: 1.6rem; }
.suite-stat-number {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--indigo-light);
  line-height: 1;
}
.suite-stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Sección con card ─────────────────────────────────────────────────────── */
.suite-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.suite-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Pestañas ─────────────────────────────────────────────────────────────── */
.suite-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.suite-tab {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 9px 18px;
  border-radius: var(--radius-xl);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}
.suite-tab:hover { border-color: var(--indigo); color: var(--text-primary); }
.suite-tab.active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99,102,241,.35);
}
.suite-tab-pane { display: none; }
.suite-tab-pane.active { display: block; }
.suite-tab-pane:not(.hidden) { display: block; }

/* ── Grid 2 columnas chart + table ────────────────────────────────────────── */
.suite-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .suite-grid-2 { grid-template-columns: 1fr; } }

.suite-chart-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  height: 360px;
  position: relative;
}
.suite-table-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-height: 360px;
  overflow-y: auto;
}
.suite-table-box h4 {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 12px 16px 0;
  margin-bottom: 10px;
}
.suite-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.suite-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
}
.suite-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}
.suite-table tr:last-child td { border-bottom: none; }
.suite-table tr:hover td { background: var(--bg-card-hover); color: var(--text-primary); }
.suite-table .td-num {
  font-weight: 700;
  color: var(--indigo-light);
  white-space: nowrap;
}
.suite-table .td-pct { color: var(--text-muted); white-space: nowrap; }

/* ── Exportar ─────────────────────────────────────────────────────────────── */
.suite-export-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Barra de salud (BibTeX) ──────────────────────────────────────────────── */
.health-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.health-bar-item { display: flex; align-items: center; gap: 12px; }
.health-bar-label { width: 90px; font-size: .82rem; color: var(--text-secondary); flex-shrink: 0; }
.health-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.health-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease;
}
.health-bar-fill.high   { background: var(--emerald); }
.health-bar-fill.medium { background: var(--amber); }
.health-bar-fill.low    { background: var(--red); }
.health-bar-pct { font-size: .8rem; font-weight: 700; color: var(--text-secondary); width: 42px; text-align: right; flex-shrink: 0; }

/* ── Alerta de recomendaciones ────────────────────────────────────────────── */
.suite-alert {
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 20px;
}
.suite-alert-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 8px;
}
.suite-alert ul { padding-left: 20px; }
.suite-alert li { font-size: .83rem; color: var(--text-secondary); margin-bottom: 4px; }

/* ── Formulario generador de citas ────────────────────────────────────────── */
.citas-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .citas-layout { grid-template-columns: 1fr; } }

.cs-form-group { margin-bottom: 16px; }
.cs-form-label {
  display: block;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.cs-required { color: var(--red); margin-left: 2px; }
.cs-form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: .88rem;
  color: var(--text-primary);
  font-family: var(--font);
  transition: border-color .18s, box-shadow .18s;
}
.cs-form-control:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-dim);
}
.cs-form-control.error { border-color: var(--red); }
.cs-form-error {
  font-size: .78rem;
  color: var(--red);
  margin-top: 4px;
}
.cs-form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cs-form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 600px) {
  .cs-form-row-2 { grid-template-columns: 1fr; }
  .cs-form-row-4 { grid-template-columns: 1fr 1fr; }
}

.cs-author-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}
.cs-author-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cs-author-title { font-size: .85rem; font-weight: 700; color: var(--indigo-light); }
.cs-add-author-btn {
  width: 100%;
  border: 1px dashed var(--indigo);
  background: transparent;
  color: var(--indigo-light);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: .85rem;
  cursor: pointer;
  transition: background .18s;
}
.cs-add-author-btn:hover { background: var(--indigo-dim); }

.cs-citation-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.cs-citation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.cs-citation-format { font-weight: 700; font-size: .88rem; color: var(--text-primary); }
.cs-citation-desc   { font-size: .76rem; color: var(--text-muted); margin-top: 2px; }
.cs-citation-category {
  background: var(--indigo-dim);
  color: var(--indigo-light);
  border: 1px solid rgba(99,102,241,.25);
  padding: 2px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.cs-citation-text {
  background: var(--bg-card);
  border-left: 3px solid var(--indigo);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.65;
  font-style: italic;
}
.cs-citation-actions { margin-top: 10px; display: flex; gap: 8px; }

.cs-export-card {
  background: var(--emerald-dim);
  border: 1px solid rgba(16,185,129,.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.cs-export-title { font-weight: 700; color: var(--emerald); margin-bottom: 6px; }
.cs-export-desc  { font-size: .83rem; color: var(--text-secondary); margin-bottom: 14px; }
.cs-compat-line  { font-size: .76rem; color: var(--text-muted); margin-top: 10px; }

/* ── Toast de suite ───────────────────────────────────────────────────────── */
.sg-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: .88rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.sg-toast.show { transform: translateY(0); opacity: 1; }
.sg-toast.ok   { border-color: var(--emerald); }
.sg-toast.err  { border-color: var(--red); }

/* =============================================================================
   Autor — source toggle
   ============================================================================= */
.src-toggle-btn {
  padding: 7px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
}
.src-toggle-btn:hover  { border-color: var(--indigo); color: var(--indigo-light); }
.src-toggle-btn.src-active {
  background: var(--indigo-dim);
  border-color: var(--indigo);
  color: var(--indigo-light);
  font-weight: 600;
}

/* =============================================================================
   Red de Coautoría (red.html) — OAI-PMH Network Visualizer
   ============================================================================= */

.red-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 20px;
  height: calc(100vh - 160px);
  min-height: 520px;
}
@media (max-width: 900px) {
  .red-layout { grid-template-columns: 1fr; height: auto; }
  .red-canvas-area { height: 460px; }
}

.red-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 2px;
}

/* Canvas container */
.red-canvas-area {
  position: relative;
  background: var(--net-canvas-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
#red-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#red-canvas:active { cursor: grabbing; }

/* Tooltip */
.red-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, .95);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .8rem;
  pointer-events: none;
  max-width: 230px;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  line-height: 1.5;
}
.red-tooltip h4 {
  color: var(--indigo-light);
  margin: 0 0 5px;
  font-size: .85rem;
  font-weight: 600;
}
.red-tooltip ul {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}
.red-tooltip li { color: var(--text-secondary); margin-bottom: 1px; }

/* Zoom controls */
.red-zoom-controls {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.red-zoom-controls button {
  width: 30px;
  height: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.red-zoom-controls button:hover {
  background: var(--indigo);
  border-color: var(--indigo);
}

/* Progress bar */
.red-progress-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.red-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-light));
  width: 0%;
  transition: width .3s ease;
}

/* Canvas placeholder */
.red-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .9rem;
  pointer-events: none;
  gap: 12px;
}
.red-placeholder .red-placeholder-icon {
  font-size: 3rem;
  opacity: .35;
}

/* Stats mini-grid inside sidebar */
.red-stats-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.red-stat-mini {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
}
.red-stat-mini .val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--indigo-light);
}
.red-stat-mini .lbl {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Legend dots */
.red-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.red-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  color: var(--text-secondary);
}
.red-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

