/* ==========================================================================
   FASE 5: PROTOTIPO INTERACTIVO DEL SISTEMA DE GESTIÓN ÁGIL PARA EL EOT
   SUBACHOQUE (CUNDINAMARCA) — REGLA 3/3 Y SCRUMBAN TERRITORIAL
   DISEÑO GOVTECH & CIVIC TECH DE ALTO NIVEL (LINEAR / VERCEL INSPIRED)
   ========================================================================== */

:root {
  --primary: #004d40;
  --primary-light: #00796b;
  --primary-subtle: #e6f4f1;
  --primary-dark: #002d25;
  --bg-slate: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-subtle: #edf2f7;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --amber: #d97706;
  --amber-subtle: #fef3c7;
  --emerald: #10b981;
  --emerald-subtle: #d1fae5;
  --crimson: #ef4444;
  --crimson-subtle: #fee2e2;
  --sky: #0284c7;
  --sky-subtle: #e0f2fe;
  --purple: #7c3aed;
  --purple-subtle: #ede9fe;

  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 77, 64, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-slate);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   HEADER Y BARRA INSTITUCIONAL SUPERIOR
   ========================================================================== */
.gov-topbar {
  background: linear-gradient(90deg, #00362c 0%, #004d40 45%, #00695c 100%);
  color: #ffffff;
  padding: 0.45rem 1.75rem;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 100;
}

.gov-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gov-pill-badge {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.gov-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
  animation: pulseLight 1.8s infinite;
}

@keyframes pulseLight {
  0% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.4; transform: scale(0.9); }
}

.gov-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-topbar-action {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-topbar-action:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Header principal */
.app-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-crest {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 77, 64, 0.2);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Navegación por Módulos */
.nav-tabs-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-slate);
  padding: 0.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.6);
}

.nav-tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.nav-badge-accent {
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   BANNER DE ALERTA: REZAGO HISTÓRICO DE 26 AÑOS
   ========================================================================== */
.historical-lag-ribbon {
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 50%, #fffbeb 100%);
  border-bottom: 1px solid #fde68a;
  padding: 0.55rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #92400e;
}

.historical-lag-ribbon .ribbon-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1720px;
  margin: 0 auto;
  width: 100%;
}

.lag-tag {
  background: #d97706;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ==========================================================================
   CONTENIDO PRINCIPAL Y CONTENEDOR DE PANTALLAS
   ========================================================================== */
.main-viewport {
  max-width: 1720px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem 1.75rem 3rem 1.75rem;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-pane.active {
  display: block;
}

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

/* ==========================================================================
   MÓDULO 1: DASHBOARD EJECUTIVO (DIRECTIVO & ALCALDÍA)
   ========================================================================== */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* KPI Cards */
.kpis-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.kpi-card.kpi-emerald::before { background: var(--emerald); }
.kpi-card.kpi-amber::before { background: var(--amber); }
.kpi-card.kpi-sky::before { background: var(--sky); }
.kpi-card.kpi-purple::before { background: var(--purple); }

.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.kpi-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.kpi-emerald .kpi-icon-badge { background: var(--emerald-subtle); color: var(--emerald); }
.kpi-amber .kpi-icon-badge { background: var(--amber-subtle); color: var(--amber); }
.kpi-sky .kpi-icon-badge { background: var(--sky-subtle); color: var(--sky); }
.kpi-purple .kpi-icon-badge { background: var(--purple-subtle); color: var(--purple); }

.kpi-value-container {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1;
}

.kpi-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-detail {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.kpi-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin-top: 0.85rem;
  overflow: hidden;
}

.kpi-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--emerald) 100%);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gráficas y Sprint Widget */
.charts-grid-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.75fr;
  gap: 1.25rem;
}

@media (max-width: 1280px) {
  .charts-grid-row {
    grid-template-columns: 1fr;
  }
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title-bar h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-wrapper {
  position: relative;
  flex: 1;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sprint Activo Card */
.sprint-active-card {
  background: linear-gradient(145deg, #003e33 0%, #004d40 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.sprint-active-card .sprint-badge {
  background: #f59e0b;
  color: #78350f;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sprint-active-card h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.75rem 0 0.5rem 0;
  line-height: 1.3;
}

.sprint-active-card p {
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 1rem;
}

.sprint-metrics-list {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.sprint-metric-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sprint-metric-item span:first-child {
  color: #94a3b8;
}

.sprint-metric-item span:last-child {
  font-weight: 700;
  color: #ffffff;
}

/* ==========================================================================
   MÓDULO 2: TABLERO SCRUMBAN TERRITORIAL
   ========================================================================== */
.scrumban-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  background: var(--surface);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.scrumban-legend {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.dot-sig { background-color: #0284c7; }
.legend-dot.dot-dts { background-color: #f59e0b; }
.legend-dot.dot-art { background-color: #10b981; }

.scrumban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(290px, 1fr));
  gap: 1.15rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}

.kanban-column {
  background: #f1f5f9;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 580px;
  transition: var(--transition);
}

.kanban-column.column-drag-over {
  background: #e2e8f0;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(0, 121, 107, 0.2);
}

.kanban-column-header {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.kanban-col-title-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.col-indicator-stripe {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stripe-backlog { background: #64748b; }
.stripe-priorizado { background: #d97706; }
.stripe-proceso { background: #0284c7; }
.stripe-validacion { background: #7c3aed; }
.stripe-cerrado { background: #10b981; }

.kanban-col-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.kanban-wip-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: #e2e8f0;
  color: var(--text-muted);
}

.kanban-wip-badge.wip-exceeded {
  background: #fee2e2;
  color: #b91c1c;
}

.kanban-card-list {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

/* Tarjeta Scrumban Territorial */
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: var(--transition);
  position: relative;
  user-select: none;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.is-dragging {
  opacity: 0.45;
  transform: scale(0.97);
  box-shadow: var(--shadow-lg);
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.kanban-card.card-reproceso-shake {
  animation: shakeWarning 0.5s cubic-bezier(.36,.07,.19,.97) both;
  border-color: var(--crimson) !important;
}

@keyframes shakeWarning {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.card-id-code {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--primary);
  background: var(--primary-subtle);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.badge-prioridad {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.prio-critica { background: #fee2e2; color: #b91c1c; }
.prio-alta { background: #ffedd5; color: #c2410c; }
.prio-media { background: #fef3c7; color: #b45309; }
.prio-baja { background: #f1f5f9; color: #475569; }

.card-headline {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.45rem;
}

.card-metadata-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Semáforo micro 3/3 en la tarjeta */
.semaforo-33-row {
  background: var(--bg-slate);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.semaforo-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
}

.sem-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.sem-ok { background-color: var(--emerald); box-shadow: 0 0 5px rgba(16, 185, 129, 0.4); }
.sem-warn { background-color: var(--amber); box-shadow: 0 0 5px rgba(217, 119, 6, 0.4); }
.sem-err { background-color: var(--crimson); box-shadow: 0 0 5px rgba(239, 68, 68, 0.5); }
.sem-wait { background-color: #94a3b8; }

.card-footer-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.55rem;
  margin-top: 0.2rem;
}

.card-responsible {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-card-micro {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-card-micro:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==========================================================================
   MÓDULO 3: SIMULADOR INTERACTIVO DE LA REGLA DE ORO 3/3
   ========================================================================== */
.simulator-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.simulator-top-selector-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.obs-selector-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.obs-selector-box label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
}

.select-govtech {
  width: 100%;
  max-width: 520px;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-slate);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.select-govtech:focus {
  border-color: var(--primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 77, 64, 0.12);
}

/* Banner de Discrepancia Pulsante */
.discrepancy-banner {
  background: #fef2f2;
  border: 2px dashed #ef4444;
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: pulseDiscrepancy 2s infinite ease-in-out;
}

@keyframes pulseDiscrepancy {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.discrepancy-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: #b91c1c;
}

.discrepancy-icon {
  width: 42px;
  height: 42px;
  background: #fee2e2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #ef4444;
}

.discrepancy-text h4 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.discrepancy-text p {
  font-size: 0.8rem;
  color: #991b1b;
}

/* Las 3 Dimensiones Territoriales */
.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .dimensions-grid {
    grid-template-columns: 1fr;
  }
}

.dim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: var(--transition);
}

.dim-card.dim-sig { border-top: 4px solid #0284c7; }
.dim-card.dim-dts { border-top: 4px solid #f59e0b; }
.dim-card.dim-art { border-top: 4px solid #10b981; }

.dim-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dim-badge-number {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

.dim-sig .dim-badge-number { background: #e0f2fe; color: #0369a1; }
.dim-dts .dim-badge-number { background: #fef3c7; color: #b45309; }
.dim-art .dim-badge-number { background: #d1fae5; color: #047857; }

.dim-status-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-full);
}

.tag-aprobado { background: #d1fae5; color: #065f46; }
.tag-reproceso { background: #fee2e2; color: #991b1b; }
.tag-pendiente { background: #fef3c7; color: #92400e; }

.dim-fields-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.field-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.field-value-box {
  background: var(--bg-slate);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-main);
  font-family: monospace;
}

.field-input-ha {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-main);
  outline: none;
}

.field-input-ha:focus {
  border-color: var(--primary);
}

.checkbox-toggle-container {
  background: var(--bg-slate);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.checkbox-toggle-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-toggle-container span {
  font-size: 0.8rem;
  font-weight: 600;
}

/* Panel de Veredicto Automatizado */
.verdict-panel-card {
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  transition: var(--transition);
}

.verdict-valid {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  color: #ffffff;
  border: 1px solid #10b981;
}

.verdict-invalid {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
  color: #ffffff;
  border: 1px solid #ef4444;
}

.verdict-left {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.verdict-symbol {
  font-size: 2.2rem;
  line-height: 1;
}

.verdict-text-box h3 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.verdict-text-box p {
  font-size: 0.85rem;
  opacity: 0.92;
  line-height: 1.45;
  max-width: 680px;
}

.verdict-actions-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  white-space: nowrap;
}

.btn-simulate-fix {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-simulate-fix:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.btn-sign-acta {
  background: #10b981;
  color: #ffffff;
  border: none;
  padding: 0.85rem 1.65rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: var(--transition);
}

.btn-sign-acta:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-sign-acta:disabled {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================================
   MÓDULO 4: EXPEDIENTE ÚNICO Y MEMORIA INSTITUCIONAL
   ========================================================================== */
.memory-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-input-box {
  position: relative;
  flex: 1;
  min-width: 320px;
}

.search-input-box input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.65rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  outline: none;
}

.search-input-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 77, 64, 0.1);
}

.search-icon-pos {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-chips-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chip-filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.chip-filter-btn:hover {
  border-color: #cbd5e1;
  color: var(--text-main);
}

.chip-filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.data-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-responsive {
  overflow-x: auto;
}

.gov-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.gov-data-table th {
  background: var(--bg-slate);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

.gov-data-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.gov-data-table tr:last-child td {
  border-bottom: none;
}

.gov-data-table tr:hover td {
  background-color: #f8fafc;
}

.hash-pill {
  font-family: monospace;
  font-size: 0.72rem;
  background: var(--bg-slate);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: #0369a1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.hash-pill:hover {
  background: #e0f2fe;
}

/* ==========================================================================
   MODALES Y ALERTAS DE REGLA 3/3
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: modalBackdropFade 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

@keyframes modalBackdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 650px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header-danger {
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 100%);
  color: #ffffff;
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-success {
  background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
  color: #ffffff;
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-default {
  background: var(--bg-slate);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.reprocess-cause-list {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reprocess-cause-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #991b1b;
}

.modal-footer {
  padding: 1rem 1.75rem;
  background: var(--bg-slate);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-modal-close {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-modal-action {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 300px;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   ACTA BILATERAL DE CONCERTACIÓN - FORMATO DE IMPRESIÓN OFICIAL
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
  }
  .gov-topbar, .app-header, .historical-lag-ribbon, .nav-tabs-wrapper, .modal-overlay, .toast-container, .btn-topbar-action {
    display: none !important;
  }
  .main-viewport {
    padding: 0 !important;
  }
  .printable-acta {
    display: block !important;
    padding: 2cm !important;
    font-size: 11pt !important;
    color: #000000 !important;
  }
}

.printable-acta {
  display: none;
}