/* ==============================================================================
   TRIBUTOHUB BOLIVIA - COMPACT MINIMALIST DESIGN SYSTEM (VS CODE / DENSE WORKSPACE)
   ============================================================================== */

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

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Modo Claro de Alto Contraste */
  --app-bg: #edf2f7;
  --panel-bg: #ffffff;
  --panel-header-bg: #e2e8f0;
  --hover-bg: #e2e8f0;
  --active-bg: #cbd5e1;
  
  --border-color: #cbd5e1;
  --border-subtle: #94a3b8;
  --border-focus: #1d4ed8;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --accent-blue: #1d4ed8;
  --accent-blue-hover: #1e40af;
  --accent-blue-subtle: #eff6ff;

  --accent-green: #059669;
  --accent-green-subtle: #d1fae5;
  --accent-amber: #d97706;
  --accent-amber-subtle: #fef3c7;
  --accent-red: #dc2626;
  --accent-red-subtle: #fee2e2;
  --accent-purple: #7c3aed;
  --accent-purple-subtle: #ede9fe;

  --plus-gradient: linear-gradient(135deg, #d97706, #ec4899);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;

  --status-bar-bg: #0f172a;
  --status-bar-text: #f8fafc;
}

[data-bs-theme="dark"] {
  /* Modo Oscuro de Alto Contraste (Deep Slate & Obsidian) */
  --app-bg: #070b14;
  --panel-bg: #0f172a;
  --panel-header-bg: #0b1120;
  --hover-bg: #1e293b;
  --active-bg: #334155;

  --border-color: #1e293b;
  --border-subtle: #334155;
  --border-focus: #38bdf8;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #38bdf8;
  --accent-blue-hover: #7dd3fc;
  --accent-blue-subtle: rgba(56, 189, 248, 0.15);

  --accent-green: #34d399;
  --accent-green-subtle: rgba(52, 211, 153, 0.15);
  --accent-amber: #fbbf24;
  --accent-amber-subtle: rgba(251, 191, 36, 0.15);
  --accent-red: #f87171;
  --accent-red-subtle: rgba(248, 113, 113, 0.15);
  --accent-purple: #a78bfa;
  --accent-purple-subtle: rgba(167, 139, 250, 0.15);

  --plus-gradient: linear-gradient(135deg, #f59e0b, #ec4899);

  --status-bar-bg: #050811;
  --status-bar-text: #94a3b8;
}

/* ==============================================================================
   RESET Y BASE COMPACTA
   ============================================================================== */
* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-sans);
  background-color: var(--app-bg);
  color: var(--text-main);
  font-size: 0.86rem;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 24px; /* Espacio para la barra de estado */
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code, .font-mono {
  font-family: var(--font-mono);
  font-size: 0.82em;
}

/* ==============================================================================
   DUAL-TIER HEADER (TOPBAR + DEDICATED MENUBAR)
   ============================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  overflow: visible !important;
}

.navbar-compact,
.header-topbar {
  height: 48px;
  background-color: #0b1120 !important;
  border-bottom: 1px solid #1e293b !important;
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1040;
  overflow: visible !important;
}

.header-menubar {
  min-height: 38px;
  background-color: #0f172a !important;
  border-bottom: 1px solid #1e293b !important;
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1035;
  overflow: visible !important;
}

.header-menubar .container-fluid {
  overflow: visible !important;
  position: relative;
}

.menubar-nav-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0;
  overflow: visible !important;
  position: relative;
}

.brand-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: #f8fafc !important;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none !important;
}

.brand-badge .brand-title {
  letter-spacing: 0.5px;
  font-weight: 800;
  color: #ffffff;
}

.nav-link-compact {
  font-size: 0.82rem;
  font-weight: 500;
  color: #94a3b8 !important;
  background-color: transparent !important;
  background: transparent !important;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none !important;
  cursor: pointer;
}

button.nav-link-compact {
  background-color: transparent !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.nav-link-compact:hover,
button.nav-link-compact:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  text-decoration: none;
}

.nav-link-compact.active,
button.nav-link-compact.active {
  color: #38bdf8 !important;
  background-color: rgba(56, 189, 248, 0.12) !important;
  border-color: rgba(56, 189, 248, 0.25) !important;
  font-weight: 600;
}

.menubar-dropdown .dropdown-toggle.show {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.menubar-dropdown {
  position: relative;
}

.menubar-dropdown .dropdown-toggle::after {
  vertical-align: middle;
  margin-left: 0.35rem;
  font-size: 0.7rem;
}

.menubar-dropdown .dropdown-menu {
  position: absolute !important;
  z-index: 1070 !important;
  background-color: #0f172a !important;
  border: 1px solid #334155 !important;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6) !important;
  margin-top: 4px !important;
}

.menubar-dropdown .dropdown-menu.dropdown-menu-end {
  right: 0 !important;
  left: auto !important;
}

.menubar-dropdown .dropdown-item {
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.12s ease;
}

.menubar-dropdown .dropdown-item:hover {
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.1);
}

/* Buscador Central Integrado en Navbar (Command Bar / Spotlight) */
.command-bar-wrapper {
  position: relative;
  background-color: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
  height: 34px;
}

.command-bar-wrapper:hover {
  border-color: #475569;
  background-color: rgba(15, 23, 42, 0.98);
}

.command-bar-wrapper:focus-within {
  border-color: #38bdf8;
  background-color: #0f172a;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.command-bar-input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.86rem;
  font-weight: 500;
  color: #f8fafc;
  padding: 0;
}

.command-bar-input::placeholder {
  color: #64748b;
  font-size: 0.82rem;
}

.kbd-shortcut {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
}

.navbar-suggest-btn {
  border-color: #334155 !important;
  color: #cbd5e1 !important;
  background-color: rgba(255, 255, 255, 0.04);
  transition: all 0.15s ease;
}

.navbar-suggest-btn:hover {
  border-color: #64748b !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.theme-toggle-btn {
  color: #94a3b8;
  transition: color 0.15s ease, transform 0.15s ease;
}

.theme-toggle-btn:hover {
  color: #f8fafc;
  transform: scale(1.08);
}

/* Chips Compactos */
.chip-compact {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--panel-bg);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.chip-compact:hover {
  background: var(--hover-bg);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.chip-compact.active {
  background-color: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1e40af !important;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(29, 78, 216, 0.2);
}

[data-bs-theme="dark"] .chip-compact.active {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.35);
}

/* ==============================================================================
   FILTROS COMPACTOS & TABS
   ============================================================================== */
.filter-tabs {
  display: flex;
  gap: 3px;
  background-color: var(--panel-header-bg);
  padding: 3px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  align-items: center;
  flex-wrap: wrap;
  overflow: visible !important;
  position: relative;
  z-index: 55;
}

.filter-tabs .dropdown {
  position: relative;
  z-index: 60;
}

.filter-tabs .dropdown-menu {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.08);
  z-index: 1060 !important;
  margin-top: 4px;
  right: 0 !important;
  left: auto !important;
  min-width: 285px;
  max-width: min(320px, calc(100vw - 32px));
}

.filter-tabs .dropdown-item.category-pill-btn {
  font-size: 0.76rem;
  border: none;
  background: transparent;
  color: var(--text-main);
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.filter-tabs .dropdown-item.category-pill-btn:hover {
  background-color: var(--hover-bg);
  color: var(--accent-blue);
}

.filter-tabs .dropdown-item.category-pill-btn.active {
  background-color: #1d4ed8 !important;
  color: #ffffff !important;
  font-weight: 600;
}

[data-bs-theme="dark"] .filter-tabs .dropdown-item.category-pill-btn.active {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 600;
}

.filter-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

#moreCategoriesLabel {
  display: inline-block;
  max-width: 125px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.filter-tab-btn:hover {
  color: var(--text-main);
  background-color: var(--hover-bg);
}

/* Contador dentro de cada tab: discreto, no un badge tipo cápsula */
.filter-tab-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  padding: 0 2px;
  opacity: 0.75;
}

/* Tab Activa: Color vivo y contrastado de identificación */
[data-bs-theme="light"] .filter-tab-btn.active {
  background-color: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1e40af !important;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(29, 78, 216, 0.28);
}

[data-bs-theme="light"] .filter-tab-btn.active .filter-tab-badge {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  opacity: 1;
}

[data-bs-theme="dark"] .filter-tab-btn.active {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

[data-bs-theme="dark"] .filter-tab-btn.active .filter-tab-badge {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  opacity: 1;
}

/* Botón y Sección Colapsable de Filtros Avanzados */
.filter-toggle-btn {
  font-size: 0.76rem;
  transition: all 0.18s ease;
}

.filter-toggle-btn.is-active {
  background-color: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1e40af !important;
}

.filter-toggle-btn.is-active i {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .filter-toggle-btn.is-active {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
}

[data-bs-theme="dark"] .filter-toggle-btn.is-active i {
  color: #ffffff !important;
}

.toggle-chevron {
  display: inline-block;
  transition: transform 0.2s ease;
}

.filter-toggle-btn.is-active .toggle-chevron {
  transform: rotate(180deg);
}

.advanced-filters-collapse {
  animation: slideDownFade 0.2s ease-out;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Panel Unificado de Filtros, Fechas y Etiquetas */
.unified-filter-panel {
  position: relative;
  z-index: 50;
  overflow: visible !important;
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.unified-filter-panel select.form-select,
.unified-filter-panel input[type="date"] {
  background-color: var(--panel-bg);
  color: var(--text-main);
  border-color: var(--border-color);
}

/* ==============================================================================
   BANNER DE INTENCIÓN COMPACTO
   ============================================================================== */
.intent-box-compact {
  background-color: var(--panel-bg);
  border: 1px solid var(--accent-blue);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-xs);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: fadeIn 0.15s ease;
}

/* ==============================================================================
   TARJETAS Y ELEMENTOS COMPACTOS (HIGH DENSITY)
   ============================================================================== */
.resource-card-compact {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.resource-card-compact:hover {
  border-color: var(--border-subtle);
  background-color: var(--hover-bg);
}

.resource-title-compact {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.25rem;
}

.resource-title-compact a {
  color: var(--text-main);
}
.resource-title-compact a:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.resource-desc-compact {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==============================================================================
   BADGES DE ALTA DENSIDAD
   ============================================================================== */
.badge-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-code-blue { background: var(--accent-blue-subtle); color: var(--accent-blue); }
.badge-code-green { background: var(--accent-green-subtle); color: var(--accent-green); }
.badge-code-amber { background: var(--accent-amber-subtle); color: var(--accent-amber); }
.badge-code-red { background: var(--accent-red-subtle); color: var(--accent-red); }
.badge-code-purple { background: var(--accent-purple-subtle); color: var(--accent-purple); }
.badge-code-gray { background: var(--hover-bg); color: var(--text-muted); border: 1px solid var(--border-color); }

.badge-plus-tag {
  background: var(--plus-gradient);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.68rem;
  padding: 2px 5px;
  border-radius: 3px;
}

/* ==============================================================================
   VISTA EN DOBLE PANEL CON SPLITTER ARRASTRABLE (MASTER-DETAIL SPLIT VIEW)
   ============================================================================== */
.master-detail-layout {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
  z-index: 1;
  width: 100%;
}

.master-list-pane {
  width: var(--master-list-width, 410px);
  min-width: 280px;
  max-width: 650px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

/* Divisor Arrastrable (Splitter) */
.layout-splitter {
  width: 10px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
  z-index: 10;
  margin: 0 3px;
}

.layout-splitter::after {
  content: '';
  width: 2px;
  height: 38px;
  background-color: var(--border-color);
  border-radius: 2px;
  transition: background-color 0.15s ease, height 0.15s ease;
}

.layout-splitter:hover::after,
.layout-splitter.is-dragging::after {
  background-color: var(--accent-blue);
  height: 90%;
  width: 3px;
}

.layout-splitter:hover,
.layout-splitter.is-dragging {
  background-color: rgba(37, 99, 235, 0.08);
}

.detail-view-pane {
  flex-grow: 1;
  min-width: 0;
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  min-height: calc(100vh - 170px);
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Modo Lectura / Pantalla Completa (Zen Mode) */
.master-detail-layout.zen-mode .master-list-pane,
.master-detail-layout.zen-mode .layout-splitter {
  display: none !important;
}

.master-detail-layout.zen-mode .detail-view-pane {
  width: 100% !important;
  max-height: calc(100vh - 130px);
}

body.in-zen-mode header,
body.in-zen-mode .unified-filter-panel,
body.in-zen-mode .command-bar-wrapper {
  display: none !important;
}

/* Chips de Impuesto */
.tax-chip.active {
  background: var(--accent-blue) !important;
  color: #ffffff !important;
  border-color: var(--accent-blue) !important;
  font-weight: 700;
}

@media (max-width: 991px) {
  .master-detail-layout {
    flex-direction: column;
  }
  .master-list-pane {
    width: 100% !important;
    max-width: 100%;
  }
  .layout-splitter {
    display: none !important;
  }
}

.master-item {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  transition: all 0.1s ease;
  position: relative;
  text-decoration: none !important;
  display: block;
}

.master-item:hover {
  background-color: var(--hover-bg);
  border-color: var(--border-subtle);
}

.master-item.active {
  background-color: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-left: 4.5px solid #1d4ed8 !important;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.12);
}

.master-item.active .master-item-title {
  color: #1e40af;
  font-weight: 700;
}

[data-bs-theme="dark"] .master-item.active {
  background-color: rgba(2, 132, 199, 0.14) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  border-left: 4.5px solid #38bdf8 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .master-item.active .master-item-title {
  color: #38bdf8;
  font-weight: 700;
}

/* Título de documento multilínea (solución para títulos largos cortados) */
.master-item-title {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.master-item-desc {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Colores laterales sutiles según categoría */
.master-item.cat-border-1 { border-left: 3px solid #0284c7; }
.master-item.cat-border-2 { border-left: 3px solid #059669; }
.master-item.cat-border-3 { border-left: 3px solid #7c3aed; }
.master-item.cat-border-4 { border-left: 3px solid #dc2626; }
.master-item.cat-border-5 { border-left: 3px solid #d97706; }

/* Resaltado de texto coincidente en búsquedas */
.search-highlight {
  background-color: rgba(253, 224, 71, 0.45);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
  border-bottom: 1.5px solid #eab308;
}

/* Recurso con Informe o Resumen Adjunto */
.master-item.has-informe {
  background-color: rgba(168, 85, 247, 0.03);
  border-color: rgba(168, 85, 247, 0.28);
}
.master-item.has-informe:hover {
  background-color: rgba(168, 85, 247, 0.07);
  border-color: rgba(168, 85, 247, 0.48);
}

.informe-box {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.06) 0%, rgba(59, 130, 246, 0.06) 100%);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-left: 4px solid #9333ea;
  border-radius: var(--radius-xs);
  padding: 1rem;
  margin-bottom: 1rem;
}

/* ==============================================================================
   PESTAÑAS DE DOCUMENTOS TIPO VS CODE / BROWSER TABS
   ============================================================================== */
.doc-tabs-bar {
  display: flex;
  align-items: center;
  background-color: var(--panel-header-bg);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  gap: 2px;
  padding: 4px 4px 0 4px;
  user-select: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.doc-tabs-bar::-webkit-scrollbar { display: none; }

.doc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  max-width: 220px;
  transition: all 0.1s ease;
  position: relative;
}

.doc-tab:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.doc-tab.active {
  background-color: var(--panel-bg);
  color: var(--accent-blue);
  font-weight: 600;
  border-top: 2px solid var(--accent-blue);
}

.doc-tab .tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-tab .tab-close-btn {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--text-muted);
  border-radius: 50%;
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}
.doc-tab .tab-close-btn:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* MENÚ CONTEXTUAL DE PESTAÑAS (CLIC DERECHO) */
.tab-context-menu {
  position: fixed;
  z-index: 1080;
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  min-width: 170px;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  display: none;
}

.tab-context-menu-item {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  transition: background-color 0.1s ease;
}

.tab-context-menu-item:hover {
  background-color: var(--hover-bg);
  color: var(--accent-blue);
}

.tab-context-menu-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 3px 0;
}

/* ==============================================================================
   VALIDACIÓN VISUAL DE FORMULARIOS (ROJO / VERDE / AMARILLO)
   ============================================================================== */
.field-required.is-empty {
  background-color: rgba(239, 68, 68, 0.07) !important;
  border-color: #ef4444 !important;
}

.field-required.is-filled {
  background-color: rgba(34, 197, 94, 0.07) !important;
  border-color: #22c55e !important;
}

.field-optional {
  background-color: rgba(234, 179, 8, 0.05) !important;
  border-color: rgba(234, 179, 8, 0.3) !important;
}

.form-progress-bar {
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.form-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #eab308, #22c55e);
  width: 0%;
  transition: width 0.25s ease;
}

.detail-view-pane {
  position: sticky;
  top: 56px;
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  min-height: 480px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  scrollbar-width: thin;
}

/* ==============================================================================
   BADGES DE ALTA DENSIDAD
   ============================================================================== */
.status-bar-vscode {
  height: 24px;
  background-color: var(--status-bar-bg);
  color: var(--status-bar-text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem;
}

.status-bar-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.4rem;
  height: 100%;
}

.status-bar-item:hover {
  background: rgba(255, 255, 255, 0.15);
  cursor: default;
}

/* ==============================================================================
   CALCULADORAS COMPACTAS (SIDE-BY-SIDE SPLIT)
   ============================================================================== */
.panel-compact {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
}

.nit-grid-compact {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.nit-btn-compact {
  height: 34px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  color: var(--text-main);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.1s ease;
}

.nit-btn-compact:hover, .nit-btn-compact.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

/* ==============================================================================
   PRO LOCK COMPACTO
   ============================================================================== */
.card-plus-locked-compact {
  position: relative;
  border: 1px dashed var(--accent-amber);
}

.card-plus-locked-compact .locked-content {
  filter: blur(3px);
  opacity: 0.5;
  pointer-events: none;
}

.card-plus-overlay-compact {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
  z-index: 5;
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.15s ease forwards;
}

/* ==============================================================================
   VENTANA FLOTANTE: MODO SPLIT IA (80% / 20%)
   ============================================================================== */
.ai-split-panel {
  position: fixed;
  bottom: 35px;
  right: 20px;
  width: 420px;
  max-width: calc(100vw - 36px);
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  z-index: 1060;
  overflow: hidden;
  transition: all 0.2s ease;
}

.ai-split-panel.minimized .ai-split-body {
  display: none !important;
}

.ai-split-header {
  background-color: var(--card-bg);
  cursor: grab;
  user-select: none;
}

.ai-split-header:active {
  cursor: grabbing;
}

/* ==============================================================================
   MEJORAS UI/UX: FILTROS SCROLL, DASHBOARD, CONTADOR DE VISTAS Y DIFF VIEWER
   ============================================================================== */

/* Barra de Chips y Tags con scroll horizontal elástico */
.tags-scroll-container {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
  max-width: 100%;
}
.tags-scroll-container::-webkit-scrollbar {
  display: none;
}

/* Títulos Legibles y Modernos en Tarjetas */
.master-item-title {
  font-family: var(--font-sans) !important;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-main);
  text-transform: none !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}

/* Badges de Estado Normativo en la tarjeta Master */
.master-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.master-status-dot.vigente { background-color: var(--accent-green); box-shadow: 0 0 5px rgba(5, 150, 105, 0.4); }
.master-status-dot.modificado { background-color: var(--accent-amber); box-shadow: 0 0 5px rgba(217, 119, 6, 0.4); }
.master-status-dot.derogado { background-color: var(--accent-red); box-shadow: 0 0 5px rgba(220, 38, 38, 0.4); }
.master-status-dot.informativo { background-color: var(--text-dim); }

/* Indicadores de Vistas e Impresiones */
.stat-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Dashboard de Bienvenida en Panel Vacío */
.welcome-dashboard {
  max-width: 780px;
  margin: 0 auto;
  text-align: left;
}

.dashboard-card-mini {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  transition: all 0.15s ease;
  height: 100%;
}
.dashboard-card-mini:hover {
  border-color: var(--accent-blue);
  background-color: var(--hover-bg);
  transform: translateY(-1px);
  cursor: pointer;
}

/* Comparador de Normativas Modal y Diff Container */
.diff-split-container {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.diff-doc-box {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  max-height: 480px;
  overflow-y: auto;
  line-height: 1.5;
}
.diff-doc-box.doc-original {
  border-left: 3px solid var(--accent-amber);
}
.diff-doc-box.doc-nuevo {
  border-left: 3px solid var(--accent-green);
}
.diff-badge-original {
  background: rgba(217, 119, 6, 0.12);
  color: var(--accent-amber);
  font-weight: 600;
}
.diff-badge-nuevo {
  background: rgba(5, 150, 105, 0.12);
  color: var(--accent-green);
  font-weight: 600;
}

/* ==============================================================================
   ÁRBOL DE TRAZABILIDAD Y LÍNEA DE TIEMPO NORMATIVA (EL "GIT" DE LOS IMPUESTOS)
   ============================================================================== */
.normativa-tree-timeline {
  position: relative;
  padding-left: 20px;
  margin-left: 8px;
  border-left: 2px dashed rgba(59, 130, 246, 0.4);
}

.normativa-tree-node {
  position: relative;
  margin-bottom: 8px;
}

.normativa-tree-node::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--panel-bg);
  border: 2px solid var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.normativa-tree-node.deroga::before {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.normativa-tree-node.modifica::before {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.normativa-tree-node.reglamenta::before {
  border-color: #a855f7;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.normativa-card-item {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  transition: all 0.15s ease;
}

.normativa-card-item:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Visor de Coincidencia en Contenido de PDF */
.pdf-match-box {
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.2) !important;
}

.pdf-fulltext-container {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 12px;
  max-height: 480px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  user-select: text;
}

/* Pestañas Superiores del Panel Izquierdo (Resultados vs Árbol Genealógico) */
.left-tab-btn {
  font-size: 0.74rem;
  font-weight: 500;
  border-radius: 4px;
  color: var(--text-muted);
  border-color: transparent;
  transition: all 0.15s ease;
}

.left-tab-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
  border-color: var(--border-color);
}

.left-tab-btn.active {
  background-color: var(--panel-bg) !important;
  color: var(--accent-blue) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

/* Resaltado de diferencias de texto tipo GitHub/GitLab (Diff Viewer) */
.diff-word-del {
  background-color: rgba(239, 68, 68, 0.22);
  color: #dc2626;
  text-decoration: line-through;
  padding: 1px 3px;
  border-radius: 2px;
  margin: 0 1px;
}

.diff-word-ins {
  background-color: rgba(34, 197, 94, 0.22);
  color: #16a34a;
  font-weight: 600;
  padding: 1px 3px;
  border-radius: 2px;
  margin: 0 1px;
}

.diff-line-del {
  background-color: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  padding: 2px 6px;
  margin-bottom: 4px;
  border-radius: 0 2px 2px 0;
}

.diff-line-ins {
  background-color: rgba(34, 197, 94, 0.08);
  border-left: 3px solid #22c55e;
  padding: 2px 6px;
  margin-bottom: 4px;
  border-radius: 0 2px 2px 0;
}

.diff-line-same {
  padding: 2px 6px;
  margin-bottom: 2px;
  color: var(--text-muted);
}

/* Toast de notificación rápida */
.hub-toast {
  position: fixed;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-main);
  color: var(--panel-bg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  z-index: 2000;
  animation: fadeIn 0.15s ease;
}

/* ==============================================================================
/* ==============================================================================
   TIMELINE INFOGRÁFICO ALTERNADO (DISEÑO PROFESIONAL & ELEGANTE)
   ============================================================================== */
.timeline-infographic-wrapper {
  position: relative;
  width: 100%;
}

.timeline-disclaimer-card {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2) !important;
  border-left: 4px solid var(--accent-blue, #2563eb) !important;
  border-radius: var(--radius-sm, 8px);
}

.timeline-scroll-track {
  overflow-x: auto;
  overflow-y: visible;
  padding: 18px 12px 36px 12px;
  scroll-behavior: smooth;
  cursor: grab;
  user-select: none;
}
.timeline-scroll-track.active-dragging {
  cursor: grabbing;
}
.timeline-scroll-track::-webkit-scrollbar {
  height: 8px;
}
.timeline-scroll-track::-webkit-scrollbar-track {
  background: var(--bg-tertiary, #f1f5f9);
  border-radius: 4px;
}
.timeline-scroll-track::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.timeline-scroll-track::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.timeline-infographic-track {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: max-content;
  position: relative;
  padding-right: 48px;
}

/* Columna de cada etapa */
.timeline-stage-col {
  width: 295px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Zona superior (Cards impares / Year pares) */
.stage-top-zone {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding: 0 10px 14px 10px;
}

/* Zona central del eje horizontal */
.stage-middle-zone {
  height: 64px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Línea continua del eje horizontal */
.stage-middle-zone::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  background: #cbd5e1;
  z-index: 1;
}

/* Primer elemento empieza en el centro */
.timeline-stage-col:first-child .stage-middle-zone::before {
  left: 50%;
}

/* Flecha al final de la última columna */
.timeline-stage-col:last-child .stage-middle-zone::after {
  content: '';
  position: absolute;
  right: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid var(--accent-blue, #3b82f6);
  z-index: 2;
}

/* Medallón circular del nodo */
.timeline-node-medallion {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--node-color, #3b82f6);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18), 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--node-color, #3b82f6);
  position: relative;
  z-index: 3;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.timeline-node-medallion:hover {
  transform: scale(1.18);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.28), 0 6px 16px rgba(0,0,0,0.12);
}

/* Número de paso en el medallón */
.node-step-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--node-color, #3b82f6);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Vástago conector vertical (hacia arriba o abajo) */
.timeline-stem-up {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 38px;
  background: var(--node-color, #3b82f6);
  z-index: 2;
}

.timeline-stem-down {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 38px;
  background: var(--node-color, #3b82f6);
  z-index: 2;
}

.timeline-dashed-up {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 38px;
  border-left: 2px dashed var(--node-color, #3b82f6);
  z-index: 2;
}

.timeline-dashed-down {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 38px;
  border-left: 2px dashed var(--node-color, #3b82f6);
  z-index: 2;
}

/* Zona inferior (Cards pares / Year impares) */
.stage-bottom-zone {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  padding: 14px 10px 16px 10px;
}

/* Cuadro de Año estilizado tipo Infografía */
.timeline-year-box {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  border: 2px solid var(--node-color, #3b82f6);
  color: var(--node-color, #3b82f6);
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s ease;
}

.timeline-stage-col:hover .timeline-year-box {
  transform: scale(1.05);
}

/* Tarjeta Bento de la Etapa */
.timeline-bento-card {
  width: 100%;
  max-width: 280px;
  background: var(--panel-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  text-align: left;
}

.timeline-bento-card:hover {
  border-color: var(--node-color, #3b82f6);
  box-shadow: 0 8px 22px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.timeline-bento-card.is-query-focus {
  border: 2px solid #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* Cinta de Encabezado de la Tarjeta */
.timeline-card-ribbon {
  padding: 7px 10px;
  background: var(--node-gradient, linear-gradient(135deg, #2563eb, #3b82f6));
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.3px;
}

/* Cuerpo de la Tarjeta */
.timeline-card-content {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.timeline-card-ref {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent-blue, #2563eb);
}

.timeline-card-title {
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-primary, #1e293b);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Bloque "¿Qué papel juega en la línea de tiempo?" */
.timeline-role-explainer-box {
  background: var(--bg-tertiary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-left: 3px solid var(--node-color, #3b82f6) !important;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.timeline-role-header {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--node-color, #3b82f6);
  margin-bottom: 2px;
}

.timeline-role-desc {
  font-size: 0.71rem;
  line-height: 1.35;
  color: var(--text-secondary, #475569);
}

/* Modo Compacto / Vertical para Barra Lateral o Dispositivos Móviles */
.is-compact-timeline .timeline-infographic-track {
  flex-direction: column;
  padding-right: 0;
  gap: 16px;
}

.is-compact-timeline .timeline-stage-col {
  width: 100%;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

.is-compact-timeline .stage-top-zone,
.is-compact-timeline .stage-bottom-zone {
  min-height: auto;
  padding: 0;
  width: auto;
  flex-grow: 1;
}

.is-compact-timeline .stage-middle-zone {
  height: auto;
  width: 50px;
  flex-shrink: 0;
  flex-direction: column;
}

.is-compact-timeline .stage-middle-zone::before,
.is-compact-timeline .stage-middle-zone::after,
.is-compact-timeline .timeline-stem-up,
.is-compact-timeline .timeline-stem-down,
.is-compact-timeline .timeline-dashed-up,
.is-compact-timeline .timeline-dashed-down {
  display: none;
}

.is-compact-timeline .timeline-year-box {
  display: block;
  margin-top: 6px;
  padding: 2px 6px;
  font-size: 0.78rem;
}

.is-compact-timeline .timeline-bento-card {
  max-width: 100%;
}

/* ==============================================================================
   INTERACCIÓN AL HACER CLIC EN UN PUNTO (MEDALLÓN O ETAPA) DEL TIMELINE
   ============================================================================== */
.timeline-infographic-track.has-selected .timeline-stage-col {
  opacity: 0.55;
  transition: all 0.25s ease;
}

.timeline-infographic-track.has-selected .timeline-stage-col.is-selected-stage {
  opacity: 1;
  transform: scale(1.02);
}

.timeline-stage-col.is-selected-stage .timeline-node-medallion {
  transform: scale(1.25);
  box-shadow: 0 0 0 7px rgba(37, 99, 235, 0.25), 0 8px 22px rgba(0,0,0,0.18);
  border-color: var(--node-color, #2563eb);
  animation: pulseMedallion 1.8s infinite;
}

@keyframes pulseMedallion {
  0% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35), 0 4px 12px rgba(0,0,0,0.12); }
  50% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.12), 0 8px 20px rgba(0,0,0,0.18); }
  100% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35), 0 4px 12px rgba(0,0,0,0.12); }
}

.timeline-stage-col.is-selected-stage .timeline-bento-card {
  border-color: var(--node-color, #2563eb);
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
  transform: translateY(-4px);
}

.timeline-stage-col.is-selected-stage .timeline-year-box {
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

/* Barra de Inspección del Hito Activo Seleccionado */
.timeline-active-inspector {
  background: var(--panel-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-left: 4px solid var(--accent-blue, #2563eb) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  transition: all 0.25s ease;
}


/* MAPA CONCEPTUAL */
.tree-concept-map-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.concept-map-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 991px) {
  .concept-map-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.concept-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.concept-col-header {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  background: var(--body-bg);
  border: 1px dashed var(--border-color);
  text-align: center;
}

.concept-node-center {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
  border: 2px solid var(--accent-blue);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.15);
  border-radius: 8px;
  padding: 12px;
  position: relative;
}

.concept-node-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  transition: all 0.2s ease;
  position: relative;
}

.concept-node-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.concept-node-card.deroga {
  border-left: 4px solid #ef4444;
}

.concept-node-card.modifica {
  border-left: 4px solid #f59e0b;
}

.concept-node-card.reglamenta {
  border-left: 4px solid #8b5cf6;
}

.concept-node-card.concordante {
  border-left: 4px solid #3b82f6;
}

.concept-connector-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  display: inline-block;
  font-weight: 600;
}

/* Modal de Trazabilidad y Árbol Expandido */
#modalExpandedTree .modal-dialog {
  max-width: 95vw;
}

#modalExpandedTree .modal-body {
  max-height: 82vh;
  overflow-y: auto;
  padding: 1.25rem;
}

/* Visor de Trazabilidad en Panel Principal Derecho */
.pane-tree-container {
  border-radius: var(--radius-sm);
  background: var(--body-bg);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

/* ==============================================================================
   VENTANA FLOTANTE PINNED: INSPECTOR Y ANÁLISIS DEL HITO TIMELINE
   ============================================================================== */
.timeline-floating-inspector {
  position: fixed;
  bottom: 45px;
  right: 28px;
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: 86vh;
  z-index: 2200;
  background: var(--panel-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

[data-theme="dark"] .timeline-floating-inspector {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.timeline-floating-inspector.d-none {
  display: none !important;
}

.tfi-header {
  user-select: none;
  background: var(--bg-tertiary, #f8fafc);
}

[data-theme="dark"] .tfi-header {
  background: #0f172a;
}

.tfi-box-content {
  background: var(--bg-tertiary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  color: var(--text-primary, #1e293b);
}

[data-theme="dark"] .tfi-box-content {
  background: rgba(15, 23, 42, 0.6);
  border-color: #334155;
  color: #e2e8f0;
}

.tfi-impact-before {
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.25) !important;
  border-left: 3px solid #ef4444 !important;
}

.tfi-impact-after {
  background: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.25) !important;
  border-left: 3px solid #10b981 !important;
}

[data-theme="dark"] .tfi-impact-before {
  background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .tfi-impact-after {
  background: rgba(16, 185, 129, 0.1);
}

/* ==============================================================================
   DISEÑO LIMPIO: SELECTOR SEGMENTADO DEL PANEL IZQUIERDO (TABS MODERNAS)
   ============================================================================== */
.pane-segmented-header {
  background-color: var(--panel-header-bg, #f8fafc);
  border-bottom: 1px solid var(--border-color);
}

.pane-segmented-control {
  display: flex;
  background-color: rgba(125, 133, 144, 0.1);
  padding: 3px;
  border-radius: 6px;
  gap: 2px;
  width: 100%;
}

.pane-segmented-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.pane-segmented-tab:hover {
  color: var(--text-main);
}

.pane-segmented-tab.active {
  background-color: #1d4ed8;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(29, 78, 216, 0.25);
}

[data-bs-theme="dark"] .pane-segmented-tab.active {
  background-color: #0284c7;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.pane-tab-counter {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.8;
  margin-left: 2px;
}

.pane-segmented-tab.active .pane-tab-counter {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  opacity: 1;
}

/* ==============================================================================
   DISEÑO LIMPIO: ELEMENTOS DE LISTA IZQUIERDA
   ============================================================================== */
.master-item-ref {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.01em;
}

/* ==============================================================================
   DISEÑO LIMPIO: CABECERA JERÁRQUICA DEL DOCUMENTO ACTIVO
   ============================================================================== */
.doc-header-clean {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.doc-ref-number {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-blue);
  letter-spacing: -0.01em;
}

.doc-title-main {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.45;
  margin-top: 5px;
}

.doc-meta-inline {
  font-size: 0.75rem;
}

.badge-status-clean {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

/* ==============================================================================
   DISEÑO DE SISTEMA: BADGES & ETIQUETAS (DATOS NO CLICABLES)
   ============================================================================== */
.doc-ref-number {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e40af;
  background: rgba(30, 64, 175, 0.08);
  border: 1.5px solid rgba(30, 64, 175, 0.25);
  border-radius: 6px;
  padding: 3px 10px;
  letter-spacing: 0.5px;
  display: inline-block;
}

[data-bs-theme="dark"] .doc-ref-number {
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(96, 165, 250, 0.35);
}

.badge-status-clean {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-status-clean .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.badge-status-warning {
  background-color: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-status-warning .status-dot { background-color: #f59e0b; }

.badge-status-success {
  background-color: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-status-success .status-dot { background-color: #10b981; }

.badge-status-danger {
  background-color: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-status-danger .status-dot { background-color: #ef4444; }

.badge-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--bs-secondary-color, #64748b);
  background: var(--bs-tertiary-bg, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
}

.badge-meta-pill.badge-meta-tematica {
  background: rgba(147, 51, 234, 0.08);
  color: #7e22ce;
  border-color: rgba(147, 51, 234, 0.25);
  font-weight: 600;
}

[data-bs-theme="dark"] .badge-meta-pill {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

[data-bs-theme="dark"] .badge-meta-pill.badge-meta-tematica {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.3);
}

/* ==============================================================================
   DISEÑO DE SISTEMA: BOTONERA DE ACCIONES (ACTION PILLS)
   ============================================================================== */
.doc-action-bar {
  padding: 8px 12px;
  background-color: var(--bs-tertiary-bg, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
}

.doc-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--bs-secondary-color, #475569);
  background: var(--bs-body-bg, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.doc-action-pill:hover {
  border-color: var(--accent-blue, #2563eb);
  color: var(--accent-blue, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.doc-action-pill.active {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.4);
  color: #dc2626 !important;
  font-weight: 700;
}

.doc-action-pill.active.favorite-btn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
  color: #d97706 !important;
}

[data-bs-theme="dark"] .doc-action-pill {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

[data-bs-theme="dark"] .doc-action-pill:hover {
  border-color: #38bdf8;
  color: #38bdf8;
}

/* ==============================================================================
   DISEÑO DE SISTEMA: TABS & SEGMENTED CONTROLS (CAMBIO DE VISTAS)
   ============================================================================== */
.viewer-unified-toolbar {
  background-color: var(--panel-header-bg, #f8fafc);
  min-height: 44px;
}

.viewer-segmented-control {
  display: inline-flex;
  align-items: center;
  background-color: #e2e8f0;
  padding: 3px;
  border-radius: 9px;
  gap: 3px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .viewer-segmented-control {
  background-color: #0f172a;
  border-color: #334155;
}

.viewer-segmented-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

[data-bs-theme="dark"] .viewer-segmented-tab {
  color: #94a3b8;
}

.viewer-segmented-tab:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.45);
}

[data-bs-theme="dark"] .viewer-segmented-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.viewer-segmented-tab.active {
  background-color: #ffffff;
  color: #0f172a !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .viewer-segmented-tab.active {
  background-color: #1e293b;
  color: #38bdf8 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.viewer-tab-count {
  font-size: 0.68rem;
  font-weight: 800;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.12);
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 2px;
}

.viewer-segmented-tab.active .viewer-tab-count {
  background: #2563eb;
  color: #ffffff;
}

[data-bs-theme="dark"] .viewer-tab-count {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

[data-bs-theme="dark"] .viewer-segmented-tab.active .viewer-tab-count {
  background: #0284c7;
  color: #ffffff;
}

/* Sub-pestañas de Trazabilidad (Timeline / Árbol / Mapa) */
.pane-submode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--bs-secondary-color, #64748b);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pane-submode-btn:hover {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

.pane-submode-btn.active {
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* ==========================================================================
   16. ESTILOS DE LA PÁGINA "ACERCA DE BOLIVIX"
   ========================================================================== */
.acerca-hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(147, 51, 234, 0.04) 100%);
  border-color: var(--border-color) !important;
}

[data-bs-theme="dark"] .acerca-hero {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.pilar-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  border-color: var(--border-color) !important;
}

.pilar-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04) !important;
  border-color: var(--accent-blue) !important;
}

[data-bs-theme="dark"] .pilar-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(59, 130, 246, 0.15) !important;
}

.pilar-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   17. ESTILOS DE LA SUBNAVEGACIÓN ADMINISTRATIVA (ADMIN CONSOLE)
   ========================================================================== */
.admin-subnav-wrapper {
  position: sticky;
  top: 42px;
  z-index: 1010;
  backdrop-filter: blur(8px);
  background-color: var(--panel-bg) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.admin-subnav {
  user-select: none;
}

.admin-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-nav-item:hover {
  color: var(--text-main);
  background-color: rgba(37, 99, 235, 0.08);
}

.admin-nav-item.active {
  color: var(--accent-blue);
  background-color: rgba(37, 99, 235, 0.12);
  font-weight: 600;
}

[data-bs-theme="dark"] .admin-nav-item.active {
  color: #60a5fa;
  background-color: rgba(96, 165, 250, 0.15);
}

.admin-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ==============================================================================
   WORKSPACE OCR & LECTOR DE TEXTO EXTRAÍDO + BUSCADOR PDF
   ============================================================================== */
.ocr-workspace-toolbar {
  background-color: var(--panel-header-bg, #f1f5f9);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.extracted-text-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
  background-color: var(--panel-bg, #ffffff);
  line-height: 1.7;
}

.ocr-article-heading {
  display: block;
  font-weight: 700;
  color: var(--accent-blue, #0284c7);
  background: var(--accent-blue-subtle, rgba(2, 132, 199, 0.08));
  padding: 4px 10px;
  border-radius: var(--radius-xs, 4px);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--accent-blue, #0284c7);
}

.ocr-article-pulse {
  animation: ocrPulse 1.5s ease-out;
}

@keyframes ocrPulse {
  0% { background-color: rgba(245, 158, 11, 0.35); }
  100% { background: var(--accent-blue-subtle, rgba(2, 132, 199, 0.08)); }
}

mark.ocr-highlight {
  background-color: #fef08a !important;
  color: #1e1b4b !important;
  padding: 1px 3px;
  border-radius: 2px;
}

mark.ocr-highlight-current {
  background-color: #f59e0b !important;
  color: #000000 !important;
  font-weight: 700;
  outline: 2px solid #d97706;
  border-radius: 2px;
}

[data-bs-theme="dark"] mark.ocr-highlight {
  background-color: #854d0e !important;
  color: #fef08a !important;
}

[data-bs-theme="dark"] mark.ocr-highlight-current {
  background-color: #f59e0b !important;
  color: #000000 !important;
}

.pdf-search-box {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.pdf-search-box:focus-within {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

/* UI Especializada para Resoluciones No Publicadas */
.no-publicada-box {
  border-color: rgba(234, 88, 12, 0.25) !important;
  transition: box-shadow 0.25s ease;
}
.no-publicada-box:hover {
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.08) !important;
}
.no-publicada-icon-wrap {
  animation: pulse-border 3s infinite ease-in-out;
}
@keyframes pulse-border {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.2);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 0 0 8px rgba(234, 88, 12, 0);
  }
}
[data-bs-theme="dark"] .no-publicada-box {
  background-color: rgba(30, 41, 59, 0.6) !important;
  border-color: rgba(234, 88, 12, 0.3) !important;
}

/* ==========================================================================
   PORTAL HOME / HUB DE APRENDIZAJE & SOLUCIONES TRIBUTARIAS
   ========================================================================== */
.portal-hero-section {
  background: radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: visible;
}

.portal-search-wrapper {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 9999px;
  padding: 0.5rem 0.85rem 0.5rem 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.portal-search-wrapper:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2), 0 12px 28px -4px rgba(0, 0, 0, 0.12);
}

.portal-search-input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.portal-search-input::placeholder {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.hub-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .hub-card:hover {
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.45);
  border-color: #0284c7;
}

.hub-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.hub-card-icon.blue {
  background-color: rgba(56, 189, 248, 0.12);
  color: #0284c7;
}

[data-bs-theme="dark"] .hub-card-icon.blue {
  color: #38bdf8;
}

.hub-card-icon.purple {
  background-color: rgba(168, 85, 247, 0.12);
  color: #9333ea;
}

[data-bs-theme="dark"] .hub-card-icon.purple {
  color: #c084fc;
}

.hub-card-icon.emerald {
  background-color: rgba(16, 185, 129, 0.12);
  color: #059669;
}

[data-bs-theme="dark"] .hub-card-icon.emerald {
  color: #34d399;
}

.hub-card-icon.amber {
  background-color: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

[data-bs-theme="dark"] .hub-card-icon.amber {
  color: #fbbf24;
}

.hub-card-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.hub-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.hub-chip-link:hover {
  border-color: #38bdf8;
  color: #0284c7;
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-1px);
}

[data-bs-theme="dark"] .hub-chip-link:hover {
  color: #38bdf8;
}

.metric-pill {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  text-align: center;
  font-family: var(--font-mono);
}

/* ==========================================================================
   WORKSPACE DE ESTUDIO TRIBUTARIO V2 & BLOC DE NOTAS FLOTANTE DRAGGABLE
   ========================================================================== */
.theme-workspace-layout-v2 {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 0.85rem;
  height: calc(100vh - 120px);
  min-height: 620px;
}

@media (max-width: 992px) {
  .theme-workspace-layout-v2 {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Tarjetas Compactas del Catálogo de Temáticas */
.topic-card-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.topic-card-compact:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .topic-card-compact:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border-color: #0284c7;
}

/* Árbol de Recursos del Workspace */
.tree-node-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.tree-node-item:hover {
  background: var(--bg-body-tertiary, rgba(0,0,0,0.04));
  border-color: var(--border-color);
}

.tree-node-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  color: #0284c7;
  font-weight: 600;
}

[data-bs-theme="dark"] .tree-node-item.active {
  color: #38bdf8;
}

/* Pestañas del Visor de Estudio */
.workspace-tabs-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px 0 8px;
  background: var(--bg-body-tertiary, rgba(0,0,0,0.03));
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.workspace-tabs-bar::-webkit-scrollbar {
  display: none;
}

.workspace-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  max-width: 220px;
  transition: all 0.15s ease;
}

.workspace-tab-btn:hover {
  background: rgba(0,0,0,0.03);
  color: var(--text-primary);
}

.workspace-tab-btn.active {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: #0284c7;
  font-weight: 600;
}

[data-bs-theme="dark"] .workspace-tab-btn.active {
  color: #38bdf8;
}

.workspace-tab-close {
  opacity: 0.6;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 50%;
  padding: 1px 4px;
}

.workspace-tab-close:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ==========================================================================
   BLOC DE NOTAS FLOTANTE / WIDGET TIPO CHAT (DRAGGABLE & RESIZABLE)
   ========================================================================== */
.floating-notes-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 440px;
  height: 520px;
  min-width: 320px;
  min-height: 280px;
  max-width: 92vw;
  max-height: 88vh;
  background: var(--bg-card);
  border: 1.5px solid #38bdf8;
  border-radius: 12px;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(56, 189, 248, 0.15);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
  transition: opacity 0.15s ease;
}

[data-bs-theme="dark"] .floating-notes-window {
  box-shadow: 0 20px 48px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(2, 132, 199, 0.3);
  border-color: #0284c7;
}

.floating-notes-window.minimized {
  display: none !important;
}

.floating-notes-window.maximized {
  top: 15px !important;
  left: 15px !important;
  right: 15px !important;
  bottom: 15px !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  resize: none !important;
}

.notes-drag-header {
  padding: 0.55rem 0.85rem;
  background: var(--bg-body-tertiary, #0f172a);
  border-bottom: 1px solid var(--border-color);
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.notes-drag-header:active {
  cursor: grabbing;
}

.notes-window-control-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 2px 6px;
  font-size: 0.78rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.notes-window-control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.notes-minimized-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1059;
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 9999px;
  background: #0f172a;
  color: #f8fafc;
  border: 1.5px solid #38bdf8;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notes-minimized-pill:hover {
  background: #0284c7;
  transform: translateY(-2px);
  color: #ffffff;
  box-shadow: 0 12px 28px -4px rgba(56, 189, 248, 0.35);
}

.notes-minimized-pill.visible {
  display: inline-flex !important;
}

.notes-editor-textarea {
  width: 100%;
  flex-grow: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.86rem;
  line-height: 1.55;
  resize: none;
  padding: 0.35rem 0;
}

.notes-editor-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.82rem;
}

/* Botón flotante Smart Citation */
#smartCitationTooltip {
  position: absolute;
  z-index: 1080;
  display: none;
  animation: fadeInDown 0.15s ease-out;
}

.smart-citation-bubble {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #38bdf8;
  border-radius: 9999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.smart-citation-bubble:hover {
  background: #0284c7;
  transform: translateY(-2px);
  color: #fff;
}

/* ==========================================================================
   DROPDOWN DE AUTOCOMPLETADO Y SUGERENCIAS INTELIGENTES DE BÚSQUEDA (BOLIVIX)
   ========================================================================== */
.tax-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card, #ffffff);
  color: var(--bs-body-color, #1e293b);
  border: 1px solid var(--panel-border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1075;
  max-height: 440px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
  text-align: left;
  animation: acFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-bs-theme="dark"] .tax-suggestions-dropdown {
  background: rgba(15, 23, 42, 0.96);
  border-color: #334155;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4);
}

@keyframes acFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ac-group-header {
  font-size: 0.68rem;
  font-family: var(--bs-font-monospace, monospace);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bs-secondary-color, #64748b);
  padding: 6px 14px 4px 14px;
  margin-top: 4px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ac-group-header:first-child {
  margin-top: 0;
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  text-decoration: none;
  color: inherit;
  border-left: 3.5px solid transparent;
}
.ac-item:hover, .ac-item.ac-active {
  background: rgba(14, 165, 233, 0.08);
  border-left-color: #0ea5e9;
  color: inherit;
}
[data-bs-theme="dark"] .ac-item:hover, [data-bs-theme="dark"] .ac-item.ac-active {
  background: rgba(56, 189, 248, 0.12);
  border-left-color: #38bdf8;
  color: inherit;
}

.ac-item-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.ac-item-icon {
  font-size: 1.15rem;
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
}

.ac-item-content {
  min-width: 0;
  flex: 1 1 auto;
}

.ac-item-title {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--bs-body-color, #0f172a);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-bs-theme="dark"] .ac-item-title {
  color: #f1f5f9;
}

.ac-item-sub {
  font-size: 0.72rem;
  color: var(--bs-secondary-color, #64748b);
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ac-badge {
  font-size: 0.65rem;
  font-family: var(--bs-font-monospace, monospace);
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 600;
}

.ac-enter-hint {
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: var(--bs-primary, #0ea5e9);
}
.ac-item:hover .ac-enter-hint, .ac-item.ac-active .ac-enter-hint {
  opacity: 1;
}

.ac-highlight {
  background: transparent;
  color: #0284c7;
  font-weight: 700;
  padding: 0;
}
[data-bs-theme="dark"] .ac-highlight {
  color: #38bdf8;
}

.ac-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--panel-border, #e2e8f0);
  margin-top: 4px;
  font-size: 0.72rem;
  font-family: var(--bs-font-monospace, monospace);
  color: var(--bs-secondary-color, #64748b);
  background: var(--bg-body-tertiary, #f8fafc);
  border-bottom-left-radius: 13px;
  border-bottom-right-radius: 13px;
}
[data-bs-theme="dark"] .ac-footer {
  border-color: #334155;
  background: rgba(15, 23, 42, 0.6);
}
.ac-footer-action {
  color: var(--bs-primary, #0ea5e9);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}
.ac-footer-action:hover {
  text-decoration: underline;
}

/* ==========================================================================
   ADMIN CONSOLE: MODERN SIDEBAR & EXPANDED WORKSPACE LAYOUT (BOLIVIX)
   ========================================================================== */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 48px);
  position: relative;
  width: 100%;
}

.admin-sidebar {
  width: 255px;
  flex-shrink: 0;
  background: var(--bg-card, #ffffff);
  border-right: 1px solid var(--panel-border, #e2e8f0);
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1025;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), left 0.25s ease;
}

[data-bs-theme="dark"] .admin-sidebar {
  background: #090f1d;
  border-color: #1e293b;
}

/* Scrollbar fino para el sidebar */
.admin-sidebar::-webkit-scrollbar {
  width: 4px;
}
.admin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 4px;
}
.admin-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

.admin-sidebar-header {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--panel-border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(14, 165, 233, 0.03);
}
[data-bs-theme="dark"] .admin-sidebar-header {
  border-color: #1e293b;
  background: rgba(15, 23, 42, 0.5);
}

.admin-sidebar-nav {
  padding: 0.75rem 0.65rem 1.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Botón Dashboard Directo Superior */
.admin-nav-dashboard-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  text-decoration: none;
  background: var(--bs-body-bg, #ffffff);
  border: 1px solid var(--panel-border, #e2e8f0);
  color: var(--bs-body-color, #0f172a);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
[data-bs-theme="dark"] .admin-nav-dashboard-btn {
  background: rgba(30, 41, 59, 0.55);
  border-color: #334155;
  color: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.admin-nav-dashboard-btn:hover {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.4);
  color: var(--bs-primary, #0ea5e9);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(14, 165, 233, 0.12);
}
.admin-nav-dashboard-btn.active {
  background: rgba(14, 165, 233, 0.14);
  border-color: #0284c7;
  color: #0284c7;
  border-left: 3.5px solid #0284c7;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.16);
}
[data-bs-theme="dark"] .admin-nav-dashboard-btn.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: #38bdf8;
  color: #38bdf8;
  border-left: 3.5px solid #38bdf8;
}

/* Grupo de Acordeón */
.admin-accordion-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.2rem;
}

/* Botón Encabezado de Acordeón Principal - Destacado y Notorio */
.admin-accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0.68rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border, #e2e8f0);
  background: #ffffff;
  color: #0f172a;
  text-decoration: none;
  font-family: var(--bs-font-sans-serif);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  user-select: none;
}
[data-bs-theme="dark"] .admin-accordion-btn {
  background: rgba(30, 41, 59, 0.55);
  border-color: #334155;
  color: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.admin-accordion-btn:hover {
  background: rgba(14, 165, 233, 0.06);
  border-color: rgba(14, 165, 233, 0.35);
  color: var(--bs-primary, #0ea5e9);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(14, 165, 233, 0.1);
}
[data-bs-theme="dark"] .admin-accordion-btn:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

/* Estado Expandido / Abierto del Acordeón */
.admin-accordion-btn:not(.collapsed) {
  background: rgba(14, 165, 233, 0.07);
  border-color: rgba(14, 165, 233, 0.45);
  border-left: 3.5px solid var(--bs-primary, #0ea5e9);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.08);
}
[data-bs-theme="dark"] .admin-accordion-btn:not(.collapsed) {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.45);
  border-left: 3.5px solid #38bdf8;
}

/* Grupo Activo (Página actual se encuentra dentro de este grupo) */
.admin-accordion-btn.active-group {
  border-color: rgba(14, 165, 233, 0.5);
}
[data-bs-theme="dark"] .admin-accordion-btn.active-group {
  border-color: rgba(56, 189, 248, 0.5);
}

/* Titular del Botón - Destacado y Claro */
.admin-nav-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
  display: inline-block;
  line-height: 1.25;
  transition: color 0.2s ease;
}
[data-bs-theme="dark"] .admin-nav-title {
  color: #f8fafc;
}
.admin-accordion-btn:hover .admin-nav-title,
.admin-accordion-btn:not(.collapsed) .admin-nav-title {
  color: #0284c7;
}
[data-bs-theme="dark"] .admin-accordion-btn:hover .admin-nav-title,
[data-bs-theme="dark"] .admin-accordion-btn:not(.collapsed) .admin-nav-title {
  color: #38bdf8;
}

/* Icono Chip para los Títulos */
.admin-nav-chip {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 0.94rem;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.admin-accordion-btn:hover .admin-nav-chip,
.admin-nav-dashboard-btn:hover .admin-nav-chip {
  transform: scale(1.1);
}

/* Flecha Chevron del Acordeón con Rotación Suave */
.admin-accordion-chevron {
  font-size: 0.8rem;
  color: #64748b;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}
.admin-accordion-btn:not(.collapsed) .admin-accordion-chevron {
  transform: rotate(180deg);
  color: var(--bs-primary, #0ea5e9);
}
[data-bs-theme="dark"] .admin-accordion-btn:not(.collapsed) .admin-accordion-chevron {
  color: #38bdf8;
}

/* Contenedor del Submenú Desplegado */
.admin-accordion-collapse {
  padding: 0.4rem 0 0.4rem 0.85rem;
  margin-left: 0.95rem;
  border-left: 2px solid rgba(14, 165, 233, 0.28);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
[data-bs-theme="dark"] .admin-accordion-collapse {
  border-left-color: rgba(56, 189, 248, 0.3);
}

/* Enlaces Hijos (Sub-items) */
.admin-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  transition: all 0.16s ease;
  position: relative;
}
[data-bs-theme="dark"] .admin-nav-link {
  color: #cbd5e1;
}
.admin-nav-link:hover {
  background: rgba(14, 165, 233, 0.08);
  color: #0284c7;
  padding-left: 0.9rem;
}
[data-bs-theme="dark"] .admin-nav-link:hover {
  background: rgba(56, 189, 248, 0.09);
  color: #ffffff;
}

.admin-nav-link.active {
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #0284c7;
}
[data-bs-theme="dark"] .admin-nav-link.active {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  box-shadow: inset 3px 0 0 #38bdf8;
}

.admin-nav-link-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-link-icon {
  font-size: 1.02rem;
  line-height: 1;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: var(--bs-secondary-color, #64748b);
  transition: color 0.14s ease;
}
.admin-nav-link:hover .admin-nav-link-icon {
  color: var(--bs-primary, #0ea5e9);
}
[data-bs-theme="dark"] .admin-nav-link:hover .admin-nav-link-icon {
  color: #38bdf8;
}
.admin-nav-link.active .admin-nav-link-icon {
  color: #0284c7;
}
[data-bs-theme="dark"] .admin-nav-link.active .admin-nav-link-icon {
  color: #38bdf8;
}

.admin-nav-badge {
  font-size: 0.65rem;
  font-family: var(--bs-font-monospace, monospace);
  padding: 1px 7px;
  border-radius: 9999px;
  font-weight: 700;
  flex-shrink: 0;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--panel-border, #e2e8f0);
  background: rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
[data-bs-theme="dark"] .admin-sidebar-footer {
  border-color: #1e293b;
  background: rgba(15, 23, 42, 0.4);
}

.admin-main {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg-body, #f8fafc);
  display: flex;
  flex-direction: column;
}
[data-bs-theme="dark"] .admin-main {
  background: #0b1120;
}

.admin-topbar-context {
  height: 46px;
  background: var(--bg-card, #ffffff);
  border-bottom: 1px solid var(--panel-border, #e2e8f0);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 48px;
  z-index: 1010;
}
[data-bs-theme="dark"] .admin-topbar-context {
  background: #0f172a;
  border-color: #1e293b;
}

.admin-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--bs-font-monospace, monospace);
  font-size: 0.78rem;
  color: var(--bs-secondary-color, #64748b);
  margin: 0;
}

.admin-breadcrumb a {
  color: inherit;
  text-decoration: none;
}
.admin-breadcrumb a:hover {
  color: var(--bs-primary, #0ea5e9);
}

.admin-content-inner {
  flex: 1 1 auto;
  min-width: 0;
}

/* Tarjetas KPI Modernas del Dashboard Admin */
.admin-kpi-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--panel-border, #e2e8f0);
  border-radius: 12px;
  padding: 1.15rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
  height: 100%;
}
[data-bs-theme="dark"] .admin-kpi-card {
  background: #0f172a;
  border-color: #1e293b;
}
.admin-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  border-color: rgba(14, 165, 233, 0.3);
}

.admin-kpi-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.admin-kpi-value {
  font-family: var(--bs-font-monospace, monospace);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--bs-body-color, #0f172a);
}
[data-bs-theme="dark"] .admin-kpi-value {
  color: #f8fafc;
}

.admin-kpi-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--bs-secondary-color, #64748b);
  margin-bottom: 2px;
}

/* Responsivo para Pantallas Móviles & Tablets */
.admin-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
}

@media (max-width: 991.98px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -270px;
    width: 265px;
    height: 100vh;
    z-index: 1050;
    box-shadow: none;
  }
  .admin-sidebar.show {
    left: 0;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
  .admin-backdrop.show {
    display: block;
  }
}

/* ==========================================================================
   17. CONTENEDOR DE TRAZABILIDAD Y ÁRBOL (PANEL DERECHO & MODAL)
   ========================================================================== */
.pane-tree-container {
  background-color: var(--bs-body-bg, #ffffff);
  border-radius: var(--radius-sm, 8px);
}

.tree-cards-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tree-cards-wrapper .normativa-card-item {
  background: var(--bs-tertiary-bg, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 12px 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tree-cards-wrapper .normativa-card-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  border-color: var(--accent-blue, #3b82f6);
}

[data-bs-theme="dark"] .tree-cards-wrapper .normativa-card-item {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(148, 163, 184, 0.18);
}

