/* ====================================================================
   AGRIFILE PRO - NUEVO DISEÑO EJECUTIVO SPLIT-SCREEN
   Arquitectura de 3 columnas fluidas:
   1. Compact Rail (Barra izquierda rápida con iconos de alta resolución)
   2. Center Stage (Área central enfocada en listados, mapa y finanzas)
   3. Quick Inspector (Panel lateral derecho de inspección instantánea en 1 clic)
   Paleta: Dark Slate Profundo (#080c10 / #0e141a) & Esmeralda Neón (#10b981)
   ==================================================================== */

:root {
  --bg-app: #080c10;
  --bg-rail: #06090d;
  --bg-stage: #0b1016;
  --bg-card: #0f171f;
  --bg-card-hover: #141e28;
  --bg-input: #121a22;

  --border-subtle: #1a2530;
  --border-hover: #273748;
  --border-active: #10b981;

  --neon-emerald: #10b981;
  --neon-emerald-glow: rgba(16, 185, 129, 0.22);
  --neon-emerald-soft: rgba(16, 185, 129, 0.1);
  --neon-emerald-text: #34d399;

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

  --status-amber: #f59e0b;
  --status-rose: #f43f5e;
  --status-cyan: #06b6d4;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --rail-width: 68px;
  --inspector-width: 380px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body.split-app-body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ================= SCROLLBARS MINIMALISTAS ================= */
/* Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: #000000;
  border-radius: 0;
}

::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 2px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}

::-webkit-scrollbar-corner {
  background: #000000;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #3a3a3a #000000;
}

/* ================= CONTENEDOR SPLIT-SCREEN ================= */
.split-layout-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* CUERPO HORIZONTAL INTERMEDIO (SIDEBAR + CONTENIDO) */
.main-horizontal-body {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
  min-height: 0;
}

/* 1. COMPACT RAIL (IZQUIERDA) */
.compact-rail {
  width: var(--rail-width);
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  flex-shrink: 0;
  z-index: 50;
  height: 100%;
}


.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  width: 100%;
  padding: 0 0.5rem;
}

.rail-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}

.rail-btn i {
  width: 20px;
  height: 20px;
}

.rail-btn span {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.rail-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.rail-btn.active {
  color: var(--neon-emerald-text);
  background: var(--neon-emerald-soft);
  border-color: rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 12px -2px var(--neon-emerald-glow);
}

.rail-footer {
  margin-top: auto;
}

.rail-user-avatar {
  background: #111a22;
  border: 1px solid var(--border-subtle);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.rail-user-avatar span {
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--neon-emerald-text);
}

.rail-user-avatar:hover {
  border-color: var(--neon-emerald);
  box-shadow: 0 0 12px var(--neon-emerald-glow);
}

/* 2. SECCIÓN DERECHA (CONTENIDO + INSPECTOR) */
.right-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

/* FILA DEL ÁREA DERECHA (CONTENIDO + INSPECTOR) */
.below-topbar {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-width: 0;
  height: 100%;
}

/* 2b. ÁREA CENTRAL (CENTER STAGE) */
.center-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-stage);
  min-width: 0;
}

.stage-topbar {
  min-height: 68px;
  height: 68px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-app);
  flex-shrink: 0;
}

.topbar-branding {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #fff;
}

.brand-tag {
  background: var(--neon-emerald);
  color: #042f20;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  box-shadow: 0 0 10px var(--neon-emerald-glow);
}

.brand-divider {
  color: var(--text-muted);
}

.brand-crumb {
  font-size: 0.84rem;
  color: var(--text-sub);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* USUARIO LOGEADO EN EL HEADER */
.topbar-user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
}

.topbar-user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--neon-emerald);
  color: #042f20;
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user-name {
  font-size: 0.76rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.topbar-user-email {
  font-size: 0.68rem;
  color: #8da2b5;
  white-space: nowrap;
  margin-top: 1px;
}

.topbar-user-meta {
  font-size: 0.67rem;
  color: var(--neon-emerald-text);
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
}

.topbar-user-meta .dot {
  color: var(--text-muted);
  margin: 0 2px;
}

.btn-topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  padding: 0.42rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 0.35rem;
  white-space: nowrap;
}

.btn-topbar-logout:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.6);
  color: #fff;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.3);
  transform: translateY(-1px);
}

.btn-topbar-logout i {
  width: 14px;
  height: 14px;
}

.quick-stats-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  color: var(--text-sub);
}

.stat-pill strong {
  color: #fff;
}

.stat-pill.highlight strong {
  color: var(--status-amber);
  font-family: var(--font-mono);
}

.btn-new-exp {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #042f20;
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--neon-emerald-glow);
  transition: all var(--transition);
}

.btn-new-exp:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ÁREA DE CONTENIDO DINÁMICO */
.stage-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.module-pane {
  display: none;
  height: 100%;
}

.module-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Control strip y buscador */
.control-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.pill-filters-row {
  display: flex;
  gap: 0.4rem;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-chip:hover {
  color: #fff;
  border-color: var(--border-hover);
}

.filter-chip.active {
  background: var(--neon-emerald-soft);
  border-color: var(--neon-emerald);
  color: var(--neon-emerald-text);
}

.search-field-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  width: 320px;
  transition: border-color var(--transition);
}

.search-field-wrap:focus-within {
  border-color: var(--neon-emerald);
  box-shadow: 0 0 0 1px var(--neon-emerald);
}

.search-field-wrap i {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-field-wrap input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.84rem;
  width: 100%;
  font-family: inherit;
}

/* ================= TABLA PROFESIONAL DE EXPEDIENTES (EXACTO AGREX) ================= */
/* ================= TABLA PROFESIONAL DE EXPEDIENTES (PALETA OFICIAL AGRIFILE PRO) ================= */
.expedientes-table-container {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.agrex-exp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.agrex-exp-table thead tr {
  background: #090e14;
  border-bottom: 1px solid var(--border-subtle);
}

.agrex-exp-table th {
  padding: 0.95rem 1.4rem;
  color: var(--text-sub);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.agrex-exp-table th:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

.agrex-exp-table th span {
  vertical-align: middle;
}

.agrex-exp-table th i {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-left: 0.45rem;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.agrex-exp-table th:hover i {
  opacity: 1;
  color: var(--neon-emerald);
}

.agrex-table-row {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition);
}

.agrex-table-row:last-child {
  border-bottom: none;
}

.agrex-table-row:hover {
  background: var(--bg-card-hover);
}

.agrex-table-row.selected {
  background: linear-gradient(90deg, var(--neon-emerald-soft) 0%, var(--bg-card) 100%);
  border-color: var(--neon-emerald);
  box-shadow: inset 3px 0 0 var(--neon-emerald);
}

.agrex-table-row td {
  padding: 1.15rem 1.4rem;
  vertical-align: middle;
}

/* Columna Número de Expediente */
.col-exp-id {
  font-weight: 700;
  font-family: var(--font-mono);
  color: #ffffff;
  white-space: nowrap;
  font-size: 0.92rem;
}

.table-exp-code {
  color: #ffffff;
  font-family: var(--font-mono);
  background: #090e14;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  display: inline-block;
  letter-spacing: 0.3px;
}

/* Columna Propietario */
.col-prop .prop-cell-box {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.prop-nombre {
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.prop-operacion {
  color: var(--text-sub);
  font-size: 0.76rem;
  font-weight: 500;
}

/* Columna Fecha */
.col-fecha .fecha-aut-text {
  color: #cbd5e1;
  font-size: 0.86rem;
}

/* Columna Estado con Pastilla y Dot */
.col-estado {
  white-space: nowrap;
}

.agrex-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: #131b24;
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
}

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

.agrex-status-badge.status-borrador {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.25);
}

.agrex-status-badge.status-borrador .status-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.agrex-status-badge.status-aprobado {
  background: rgba(16, 185, 129, 0.12);
  color: var(--neon-emerald-text);
  border-color: rgba(16, 185, 129, 0.28);
}

.agrex-status-badge.status-aprobado .status-dot {
  background: var(--neon-emerald);
  box-shadow: 0 0 6px var(--neon-emerald-glow);
}

/* Columna Progreso */
.col-progreso {
  white-space: nowrap;
}

.agrex-prog-badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.12);
  color: var(--neon-emerald-text);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* LISTADO EN FEED DE EXPEDIENTES (COMPATIBILIDAD) */
.expedientes-feed {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.exp-feed-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.exp-code-pill {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  background: var(--bg-app);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-block;
  line-height: 1.2;
}

.exp-meta-main strong {
  display: block;
  font-size: 0.94rem;
  color: #fff;
  font-weight: 700;
}

.exp-meta-main span {
  font-size: 0.78rem;
  color: var(--text-sub);
}

.exp-feed-right {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.exp-process-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--neon-emerald-text);
  background: rgba(16, 185, 129, 0.08);
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.exp-feed-progress {
  width: 90px;
  text-align: right;
}

.exp-feed-progress span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 3px;
}

.progress-track-sm {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill-sm {
  height: 100%;
  background: var(--neon-emerald);
  border-radius: 99px;
}

/* 3. INSPECTOR LATERAL DERECHO (QUICK INSPECTOR) */
.quick-inspector {
  width: var(--inspector-width);
  background: var(--bg-app);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 40;
}

.inspector-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #06090d;
}

.inspector-eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--neon-emerald);
  display: block;
}

.inspector-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
  margin-top: 0.15rem;
}

.inspector-status-control {
  display: flex;
  align-items: center;
}

.insp-status-dropdown {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(27, 38, 29, 0.95);
  color: #d1d5db;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.35rem 1.6rem 0.35rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
  font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}

.insp-status-dropdown:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(35, 50, 38, 0.95);
}

.insp-status-dropdown.status-borrador {
  background-color: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

.insp-status-dropdown.status-aprobado {
  background-color: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.insp-status-dropdown option {
  background: #090e14;
  color: #fff;
  font-size: 0.82rem;
  padding: 0.5rem;
}

.badge-status-pill {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.inspector-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.inspector-progress-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1rem;
  border-radius: var(--radius-sm);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-sub);
  margin-bottom: 0.5rem;
}

.progress-labels strong {
  color: var(--neon-emerald-text);
  font-family: var(--font-mono);
  font-size: 1rem;
}

.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--neon-emerald);
  box-shadow: 0 0 10px var(--neon-emerald-glow);
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sec-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.data-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.data-block strong {
  color: #fff;
  font-size: 0.9rem;
}

.data-block span {
  font-size: 0.78rem;
  color: var(--text-sub);
}

.operacion-tag {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--neon-emerald-text);
  font-weight: 700;
}

.finance-split-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1rem;
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.finance-split-row small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.finance-split-row strong {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: #fff;
}

.text-amber { color: var(--status-amber) !important; }

.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.inspector-actions-top {
  margin-top: 0;
  margin-bottom: 0.25rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.btn-insp-action {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition);
}

.btn-insp-action.primary {
  background: var(--neon-emerald-soft);
  border: 1px solid var(--neon-emerald);
  color: #fff;
}

.btn-insp-action.primary:hover {
  background: var(--neon-emerald);
  color: #042f20;
}

.btn-insp-action.secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
}

.btn-insp-action.secondary:hover {
  border-color: var(--border-hover);
  color: #fff;
}

/* FOOTER DISCRETO */
.split-footer {
  padding: 0.35rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  line-height: 1.2;
  color: var(--text-muted);
  background: var(--bg-app);
  flex-shrink: 0;
}

.split-footer a {
  color: var(--neon-emerald-text);
  text-decoration: none;
  font-weight: 600;
}

/* ================= MAPA INTEGRADO ================= */
.integrated-map-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}

.map-controls-inline {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #090e13;
  gap: 1rem;
}

.map-coords-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  width: 320px;
}

.map-coords-search i {
  width: 15px;
  height: 15px;
  color: var(--neon-emerald);
}

.map-coords-search input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  width: 100%;
}

.btn-subtle-go {
  background: var(--neon-emerald);
  color: #042f20;
  border: none;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
}

.map-layer-toggles {
  display: flex;
  gap: 0.4rem;
}

.layer-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.layer-pill.active {
  background: var(--neon-emerald-soft);
  border-color: var(--neon-emerald);
  color: var(--neon-emerald-text);
}

.kml-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.split-map-viewport {
  flex: 1;
  width: 100%;
  background: #090d12;
}

/* Modo oscuro optimizado para Google Maps */
.map-dark-tiles .leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) contrast(110%) saturate(60%) brightness(88%);
}

/* Leaflet Dark Theme Overrides */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

.leaflet-popup-content {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.4;
  color: #cbd5e1 !important;
}

.leaflet-popup-content strong {
  color: #34d399 !important;
  font-family: var(--font-mono);
}

.leaflet-container a.leaflet-popup-close-button {
  color: #94a3b8 !important;
}

.leaflet-bar a {
  background-color: #0f172a !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

.leaflet-bar a:hover {
  background-color: #1e293b !important;
  color: #34d399 !important;
}

.leaflet-container .leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.75) !important;
  color: #64748b !important;
  font-size: 10px;
}
.leaflet-container .leaflet-control-attribution a {
  color: #94a3b8 !important;
}

/* ================= FINANZAS MÓDULO ================= */
.finanzas-grid-shell {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.finance-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.finance-metric-card span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.finance-metric-card strong {
  font-size: 1.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

.finance-metric-card.success strong { color: var(--neon-emerald-text); }
.finance-metric-card.warning strong { color: var(--status-amber); }

.finance-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.split-data-table thead tr {
  background: #080c10;
  border-bottom: 1px solid var(--border-subtle);
}

.split-data-table th {
  padding: 0.9rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.split-data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-sub);
}

.split-data-table tbody tr:hover td {
  background: var(--bg-card-hover);
}

/* ================= DOCUMENTOS ================= */
.split-doc-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.doc-selector-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.split-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  outline: none;
}

.doc-pills-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-opt-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  color: var(--text-sub);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.doc-opt-btn:hover {
  border-color: var(--border-hover);
  color: #fff;
}

.doc-opt-btn.active {
  background: var(--neon-emerald-soft);
  border-color: var(--neon-emerald);
  color: #fff;
}

.btn-print-action {
  width: 100%;
  margin-top: 1.25rem;
  background: var(--neon-emerald);
  color: #042f20;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
}

.doc-preview-viewport {
  background: #03070a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.official-sheet {
  background: #fff;
  color: #111;
  width: 100%;
  max-width: 215mm;
  min-height: 279mm;
  padding: 20mm;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  font-family: 'Times New Roman', serif;
  font-size: 11pt;
  line-height: 1.6;
  box-sizing: border-box;
}

/* ================= MÓDULO: PERFIL PROFESIONAL & DATOS DE LA EMPRESA (EXACTO AGREX) ================= */
.empresa-profile-shell {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 3rem;
  box-sizing: border-box;
}

.empresa-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.empresa-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--neon-emerald);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.25rem;
}

.empresa-title {
  font-size: 2.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.empresa-sub {
  font-size: 0.84rem;
  color: var(--text-sub);
  margin-top: 0.25rem;
  margin-bottom: 1rem;
}

.btn-subtle-lock {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition);
}

.btn-subtle-lock:hover {
  border-color: var(--border-hover);
  color: #fff;
}

.btn-subtle-lock i {
  width: 14px;
  height: 14px;
  color: var(--status-amber);
}

/* TABS INTERNAS DE EMPRESA (PERFIL VS DOCS VS USUARIOS) */
.empresa-internal-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.75rem 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-sizing: border-box;
  flex-wrap: wrap;
}

.emp-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  flex: 1 1 200px;
  text-align: center;
}

.emp-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
}

.emp-tab-btn.active {
  background: var(--bg-card);
  border-color: var(--neon-emerald);
  color: var(--neon-emerald-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 12px -2px var(--neon-emerald-glow);
}

.emp-tab-btn i {
  width: 15px;
  height: 15px;
}

.emp-subtab-content {
  display: none;
}

.emp-subtab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

/* SUBTAB USUARIOS */
.usuarios-panel-shell {
  display: flex;
  flex-direction: column;
}

.usuarios-top-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.usuarios-sec-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.usuarios-sec-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.usuarios-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .usuarios-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* SUBTAB API & WEBHOOKS */
.api-panel-shell {
  display: flex;
  flex-direction: column;
}

.api-top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.api-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .api-stats-grid {
    grid-template-columns: 1fr;
  }
}

.api-sec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.api-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.api-block-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.api-block-title i {
  width: 18px;
  height: 18px;
  color: var(--neon-emerald);
}

.api-block-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.api-block-sub code {
  background: rgba(0, 0, 0, 0.4);
  color: var(--neon-emerald-text);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.api-keys-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.api-key-item {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition);
}

.api-key-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.api-key-info {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}

.api-key-name-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.api-key-name-row strong {
  font-size: 0.88rem;
  color: #fff;
}

.api-badge-live {
  background: rgba(16, 185, 129, 0.15);
  color: var(--neon-emerald-text);
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
}

.api-badge-sandbox {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
}

.api-key-display-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.api-key-code {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  color: #a5f3fc;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  word-break: break-all;
}

.btn-subtle-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-subtle-copy:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-subtle-copy i {
  width: 13px;
  height: 13px;
}

.api-key-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.api-key-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.api-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .api-dual-grid {
    grid-template-columns: 1fr;
  }
}

.webhook-endpoint-box {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.webhook-ep-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.badge-http-post {
  background: #3b82f6;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
}

.webhook-url {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #e2e8f0;
  word-break: break-all;
}

.webhook-events-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ev-tag {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--neon-emerald-text);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.btn-subtle-config,
.btn-subtle-docs {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-subtle-config:hover,
.btn-subtle-docs:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-subtle-config i,
.btn-subtle-docs i {
  width: 14px;
  height: 14px;
}

.code-terminal-box {
  background: #03070a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  overflow-x: auto;
}

.code-terminal-box pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #94a3b8;
}

.code-terminal-box .tok-cmd {
  color: #38bdf8;
  font-weight: 700;
}

.code-terminal-box .tok-str {
  color: #34d399;
}

.empresa-header-right {
  text-align: right;
}

.perfil-doc-label {
  font-size: 0.76rem;
  color: var(--text-sub);
  display: block;
}

.perfil-doc-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.empresa-form-flow {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.empresa-sec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.empresa-sec-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.25rem;
}

/* Banner de información protegida */
.protected-info-banner {
  background: #121820;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.banner-icon-lock {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.banner-icon-lock i {
  width: 17px;
  height: 17px;
}

.banner-body strong {
  display: block;
  font-size: 0.88rem;
  color: #fff;
}

.banner-body p {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin: 0.25rem 0 0.75rem;
  line-height: 1.4;
}

.btn-solicitar-corr {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.btn-solicitar-corr:hover {
  border-color: var(--border-hover);
}

/* Grillas de campos */
.fields-2col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.fields-3col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.fields-4col-grid {
  display: grid;
  grid-template-columns: 100px 140px 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.emp-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.emp-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
}

.emp-field input,
.emp-field select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.emp-field input[readonly] {
  color: #e2e8f0;
  background: #0d1319;
}

.emp-field input:focus,
.emp-field select:focus {
  border-color: var(--neon-emerald);
}

.field-sub-note {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.field-sub-note strong {
  color: #fff;
}

/* Tarjeta de Firma Digital */
.firma-card-highlight {
  border-color: rgba(16, 185, 129, 0.3);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.04) 0%, var(--bg-card) 60%);
}

.firma-card-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.35rem;
}

.firma-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--neon-emerald-soft);
  color: var(--neon-emerald-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.firma-icon-box i {
  width: 20px;
  height: 20px;
}

.firma-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.badge-opcional {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.firma-desc {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin-top: 0.15rem;
}

.firma-upload-container {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.firma-uploader-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
}

.btn-subtle-file {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-subtle-file:hover {
  border-color: var(--border-hover);
}

.file-name-display {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.firma-preview-box {
  background: #080c10;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signature-canvas-mock svg {
  display: block;
}

.firma-format-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.firma-format-hint i {
  width: 14px;
  height: 14px;
  color: var(--neon-emerald);
}

.checkbox-simple-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-sub);
  cursor: pointer;
}

.checkbox-simple-row input {
  accent-color: var(--neon-emerald);
}

.empresa-action-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-save-profile {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #042f20;
  border: none;
  font-weight: 800;
  font-size: 0.86rem;
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--neon-emerald-glow);
  transition: all var(--transition);
}

.btn-save-profile:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .fields-2col-grid,
  .fields-3col-grid,
  .fields-4col-grid,
  .firma-upload-container {
    grid-template-columns: 1fr;
  }
}

/* ================= MODAL ================= */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  animation: zoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head h3 {
  color: #fff;
  font-size: 1.15rem;
}

.modal-head p {
  font-size: 0.78rem;
  color: var(--text-sub);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-form-grid {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-item label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-sub);
}

.form-item input,
.form-item select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.55rem 0.85rem;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
}

.form-item input:focus,
.form-item select:focus {
  border-color: var(--neon-emerald);
}

.modal-actions {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #090e13;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-submit {
  background: var(--neon-emerald);
  border: none;
  color: #042f20;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-submit:hover {
  background: #34d399;
}

/* ===== MODAL EDITAR EXPEDIENTE (GRANDE) ===== */
.modal-dialog-lg {
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-edit-sections {
  overflow-y: auto;
  flex: 1;
  padding: 0.25rem 0;
}

.modal-edit-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--neon-emerald-text);
  text-transform: uppercase;
  padding: 0.9rem 1.5rem 0.3rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.25rem;
}

.modal-edit-section-title:first-child {
  border-top: none;
  margin-top: 0;
}

.modal-edit-section-title svg {
  width: 13px;
  height: 13px;
  stroke: var(--neon-emerald);
}

.modal-form-grid-3 {
  padding: 0.6rem 1.5rem 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.85rem;
}

/* ===== BOTONES INSPECTOR ===== */
.inspector-actions-top .btn-insp-action {
  padding: 0.45rem 0.4rem;
  font-size: 0.72rem;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.inspector-actions-top .btn-insp-action svg {
  width: 13px;
  height: 13px;
}

.btn-insp-action {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all var(--transition);
  font-family: inherit;
  border: none;
}

.btn-insp-action svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-insp-action.primary {
  background: var(--neon-emerald);
  color: #042f20;
}

.btn-insp-action.primary:hover {
  background: #34d399;
}

.btn-insp-action.secondary {
  background: rgba(16, 185, 129, 0.1);
  color: var(--neon-emerald-text);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.btn-insp-action.secondary:hover {
  background: rgba(16, 185, 129, 0.2);
}

.btn-insp-action.edit {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.btn-insp-action.edit:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
}

/* USER POPOVER */
.user-float-popover {
  display: none;
  position: fixed;
  bottom: 60px;
  left: 78px;
  z-index: 100;
}

.user-float-popover.show {
  display: block;
}

.user-pop-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  width: 240px;
}

.pop-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--neon-emerald);
  color: #042f20;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.user-pop-card h4 {
  font-size: 0.84rem;
  color: #fff;
}

.user-pop-card span {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
}

.pop-meta {
  font-size: 0.72rem;
  color: var(--neon-emerald-text);
  margin: 0.65rem 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-logout-pop {
  width: 100%;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--status-rose);
  padding: 0.4rem;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

/* TOAST */
.split-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--neon-emerald);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.7);
  display: none;
  z-index: 999;
}

/* FOOTER DISCRETO */
.split-footer {
  padding: 0.25rem 1.5rem;
  min-height: auto;
  line-height: 1.2;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-app);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.split-footer a {
  color: var(--neon-emerald-text);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.split-footer a:hover {
  text-decoration: underline;
  color: #fff;
}

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

@media (max-width: 1100px) {
  .quick-inspector { width: 320px; }
  .finanzas-grid-shell { grid-template-columns: 1fr; }
  .dashboard-split-panels { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .quick-inspector { display: none; }
  .split-doc-layout { grid-template-columns: 1fr; }
  .agrex-metric-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ================= ESTILOS DASHBOARD EJECUTIVO (EXACTO AGREX) ================= */
.agrex-metric-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.metric-card-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  user-select: none;
}

.metric-card-pill:hover {
  background: #111720;
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.metric-card-pill.active {
  background: #0d161a;
  border-color: var(--neon-emerald);
  box-shadow: 0 0 0 1px var(--neon-emerald), 0 4px 20px rgba(16, 185, 129, 0.15);
}

.card-icon-slot {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.08);
  color: var(--neon-emerald-text);
  flex-shrink: 0;
}

.card-icon-slot i {
  width: 20px;
  height: 20px;
}

.metric-card-pill.active .card-icon-slot {
  background: rgba(16, 185, 129, 0.18);
  color: var(--neon-emerald);
}

.card-metric-data {
  display: flex;
  flex-direction: column;
}

.metric-number {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
}

.metric-card-pill.active .metric-number {
  color: var(--neon-emerald-text);
}

.metric-card-pill.active .metric-label {
  color: #cbd5e1;
}

/* DOS PANELES SPLIT DEL DASHBOARD */
.dashboard-split-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.dash-feed-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-box-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #090e14;
}

.box-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.box-title-group i {
  width: 22px;
  height: 22px;
  color: var(--neon-emerald);
}

.box-title-group h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.box-title-group span {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.1rem;
}

.btn-box-action {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-box-action:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--neon-emerald);
  color: var(--neon-emerald-text);
}

.btn-box-action i {
  width: 14px;
  height: 14px;
}

.dash-items-list {
  display: flex;
  flex-direction: column;
  divide-y: 1px solid var(--border-subtle);
}

.dash-item-row {
  padding: 1rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition);
}

.dash-item-row:last-child {
  border-bottom: none;
}

.dash-item-row:hover {
  background: rgba(255, 255, 255, 0.03);
  padding-left: 1.55rem;
}

.dash-item-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.draft-pill {
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.dash-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dash-item-info strong {
  font-size: 0.84rem;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-item-info span {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.dash-item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.badge-mini-op {
  background: #131b24;
  border: 1px solid var(--border-subtle);
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

.dash-date-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Elementos de Borradores */
.draft-highlight:hover {
  background: rgba(245, 158, 11, 0.03);
}

.dash-prog-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prog-txt {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #f59e0b;
}

.dash-prog-track {
  width: 60px;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.dash-prog-fill {
  height: 100%;
  background: #f59e0b;
  border-radius: 99px;
}

.badge-draft-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 2px 8px;
  border-radius: 9999px;
}

/* ================= ESTILOS NUEVA SOLICITUD DE AUTORIZACIÓN (EXACTO AGREX) ================= */
.agrex-form-container {
  max-width: 980px;
  margin: 0 auto;
  padding-bottom: 5rem;
}

.agrex-form-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1.5rem;
}

.link-volver-dash {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--neon-emerald-text);
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-decoration: none;
  transition: all var(--transition);
}

.link-volver-dash:hover {
  color: var(--neon-emerald);
  transform: translateX(-3px);
}

.link-volver-dash i {
  width: 14px;
  height: 14px;
}

.form-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--neon-emerald);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: block;
}

.form-main-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin: 0.25rem 0;
}

.form-lead-desc {
  font-size: 0.84rem;
  color: var(--text-sub);
  max-width: 650px;
}

.completeness-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  min-width: 240px;
}

.comp-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.comp-badge-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.comp-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.comp-bar-fill {
  height: 100%;
  background: var(--neon-emerald);
  border-radius: 99px;
}

.comp-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
}

/* CARDS DE SECCIÓN NUMERADAS */
.agrex-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.85rem;
  margin-bottom: 1.75rem;
  position: relative;
}

.sec-badge-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sec-number-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--neon-emerald);
  color: var(--neon-emerald-text);
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sec-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sec-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* GRID DE CAMPOS */
.form-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
}

.col-span-2 {
  grid-column: span 2;
}

.form-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cell-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #cbd5e1;
}

.cell-input,
.cell-select,
.cell-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.6rem 0.85rem;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.cell-input:focus,
.cell-select:focus,
.cell-textarea:focus {
  border-color: var(--neon-emerald);
  box-shadow: 0 0 0 1px var(--neon-emerald);
}

.cell-textarea {
  resize: vertical;
}

/* RADIO PILLS SELECTOR PARA NATURALEZA DE OPERACIÓN */
.radio-pill-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.radio-pill-item {
  position: relative;
  cursor: pointer;
}

.radio-pill-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill-item span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #111720;
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  padding: 0.5rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all var(--transition);
}

.radio-pill-item span i {
  width: 13px;
  height: 13px;
  opacity: 0;
  transition: opacity var(--transition);
}

.radio-pill-item input:checked + span {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--neon-emerald);
  color: #fff;
}

.radio-pill-item input:checked + span i {
  opacity: 1;
  color: var(--neon-emerald);
}

/* SUB-ENTIDAD / BOX DE TITULAR O PARCELA */
.sub-entity-box {
  background: #090e14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.entity-box-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.entity-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--neon-emerald-text);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.entity-role-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-subtle-add {
  background: transparent;
  border: 1px dashed var(--border-subtle);
  color: var(--text-sub);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-subtle-add:hover {
  border-color: var(--neon-emerald);
  color: var(--neon-emerald-text);
}

.btn-subtle-add i {
  width: 14px;
  height: 14px;
}

/* PANEL DESTACADO CRS (WGS84) */
.crs-highlight-panel {
  background: #0a1118;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.crs-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.crs-panel-header i {
  width: 22px;
  height: 22px;
  color: var(--neon-emerald);
}

.crs-panel-header strong {
  font-size: 0.84rem;
  color: #fff;
  display: block;
}

.crs-panel-header span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.crs-selector-row {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.crs-pill-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: #cbd5e1;
  cursor: pointer;
}

.coords-inputs-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

/* LEGAL CHECKLIST */
.legal-checklist-box {
  background: #11151c;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.checklist-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.checklist-title-row i {
  width: 20px;
  height: 20px;
  color: var(--status-amber);
}

.checklist-title-row h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fef3c7;
}

.checklist-items-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #cbd5e1;
  cursor: pointer;
}

/* BOTONES INFERIORES: AL FINAL DE LA PÁGINA (EXACTO AGREX) */
.agrex-form-bottom-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #10141a;
  border: 1px solid var(--border-subtle);
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-md);
  position: static;
  margin-top: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: none;
}

.autosave-notice-block {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.autosave-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.autosave-desc {
  font-size: 0.78rem;
  color: #64748b;
}

.agrex-actions-cluster {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-agrex-action {
  background: #121820;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-agrex-action:hover {
  background: #1a222c;
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-agrex-action.btn-cancel {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.btn-agrex-action.btn-cancel:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Botón Revisar con borde rojo según captura */
.btn-agrex-action.btn-revisar-outline {
  background: transparent;
  border: 1px solid #7f1d1d;
  color: #f87171;
  font-weight: 500;
}

.btn-agrex-action.btn-revisar-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #fca5a5;
}

/* Botón Guardar y revisar solicitud */
.btn-agrex-action.btn-primary-review {
  background: #121820;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
}

.btn-agrex-action.btn-primary-review:hover {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 800px) {
  .form-fields-grid { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .coords-inputs-row { grid-template-columns: 1fr 1fr; }
  .checklist-items-grid { grid-template-columns: 1fr; }
  .agrex-form-bottom-actions { flex-direction: column; gap: 0.75rem; }
  .right-buttons-flow { width: 100%; justify-content: flex-end; }
}

/* Control strip actions (buscador + nuevo expediente) dentro del modulo Expedientes */
.control-strip-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-create-in-exp {
  background: var(--neon-emerald);
  border: none;
  color: #042f20;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn-create-in-exp:hover {
  background: var(--neon-emerald-hover);
  transform: translateY(-1px);
}

.btn-create-in-exp i {
  width: 15px;
  height: 15px;
}

/* ================= ESTILOS DIRECTORIO DE CLIENTES ================= */
.clientes-container {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 3rem;
}

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

.btn-primary-create-client {
  background: var(--neon-emerald);
  border: none;
  color: #042f20;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 0 15px var(--neon-emerald-glow);
  transition: all var(--transition);
}

.btn-primary-create-client:hover {
  background: var(--neon-emerald-hover);
  transform: translateY(-1px);
}

.btn-primary-create-client i {
  width: 16px;
  height: 16px;
}

.clientes-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.client-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
}

.client-stat-card.highlight {
  border-color: rgba(16, 185, 129, 0.35);
  background: #0b1419;
}

.client-stat-card .stat-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.client-stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
  margin: 0.25rem 0;
  line-height: 1.1;
}

.client-stat-card.highlight .stat-value {
  color: var(--neon-emerald-text);
}

.client-stat-card .stat-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .clientes-stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 550px) {
  .clientes-stats-strip {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SISTEMA DE DISEÑO 100% RESPONSIVE (MÓVIL, TABLET, LAPTOP, DESKTOP)
   ========================================================================== */

/* 1. TABLETS GRANDES Y LAPTOPS (<= 1200px) */
@media (max-width: 1200px) {
  .agrex-metric-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .fields-4col-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fields-3col-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 2. TABLETS REGULARES (<= 992px) */
@media (max-width: 992px) {
  .quick-inspector {
    display: none !important;
  }

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

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

  .doc-selector-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .finanzas-grid-shell {
    grid-template-columns: repeat(2, 1fr);
  }

  .empresa-view-header {
    flex-direction: column;
    gap: 1.25rem;
  }

  .empresa-header-right {
    text-align: left;
  }

  .agrex-form-header {
    flex-direction: column;
  }
}

/* 3. MÓVILES Y PANTALLAS PEQUEÑAS (<= 768px) */
@media (max-width: 768px) {
  /* Contenedor general que permite scroll natural en móviles */
  body.split-app-body {
    height: auto;
    overflow-y: auto;
  }

  .split-layout-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding-bottom: 70px; /* Espacio para barra de navegación móvil inferior */
  }

  /* BARRA LATERAL CONVERTIDA EN BARRA DE NAVEGACIÓN INFERIOR FIJA TIPO APP MÓVIL */
  .compact-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 64px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 0.5rem;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
    background: #090e14;
    z-index: 999;
  }

  .rail-footer {
    display: none;
  }

  .rail-nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    padding: 0;
    gap: 0;
  }

  .rail-btn {
    padding: 0.35rem 0.2rem;
    gap: 0.15rem;
  }

  .rail-btn i {
    width: 18px;
    height: 18px;
  }

  .rail-btn span {
    font-size: 0.6rem;
  }

  /* ÁREA CENTRAL */
  .center-stage {
    height: auto;
    overflow: visible;
  }

  .stage-topbar {
    height: auto;
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .topbar-branding {
    font-size: 0.95rem;
  }

  .quick-stats-strip {
    display: none;
  }

  .topbar-user-profile {
    padding: 0.25rem 0.5rem;
    gap: 0.5rem;
  }

  .topbar-user-email,
  .topbar-user-meta {
    display: none;
  }

  .btn-topbar-logout span {
    display: none;
  }

  .btn-topbar-logout {
    padding: 0.4rem 0.55rem;
  }

  .stage-content {
    padding: 1rem;
    height: auto;
    overflow-y: visible;
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* MÉTRICAS DASHBOARD EN 2 COLUMNAS */
  .agrex-metric-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .metric-card-pill {
    padding: 0.75rem 0.85rem;
    gap: 0.65rem;
  }

  .metric-number {
    font-size: 1.15rem;
  }

  .metric-label {
    font-size: 0.65rem;
  }

  /* CONTROL STRIP (BUSCADOR Y BOTÓN NUEVO) */
  .control-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .pill-filters-row {
    overflow-x: auto;
    padding-bottom: 0.35rem;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .control-strip-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field-wrap {
    width: 100%;
  }

  .btn-create-in-exp {
    justify-content: center;
    width: 100%;
    padding: 0.65rem 1rem;
  }

  /* TABLAS CON SCROLL HORIZONTAL SUAVE */
  .finance-table-card,
  .expedientes-table-container,
  .expedientes-feed-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .split-data-table,
  .agrex-exp-table {
    min-width: 650px;
  }

  .finanzas-grid-shell {
    grid-template-columns: 1fr;
  }

  /* FORMULARIO DE NUEVA SOLICITUD */
  .form-fields-grid,
  .fields-2col-grid,
  .fields-3col-grid,
  .fields-4col-grid {
    grid-template-columns: 1fr !important;
  }

  .col-span-2 {
    grid-column: span 1 !important;
  }

  .coords-inputs-row {
    grid-template-columns: 1fr 1fr;
  }

  .checklist-items-grid {
    grid-template-columns: 1fr;
  }

  .crs-selector-row {
    flex-direction: column;
    gap: 0.6rem;
  }

  .agrex-form-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-main-title {
    font-size: 1.6rem;
  }

  .completeness-widget {
    width: 100%;
    min-width: unset;
  }

  .agrex-section-card {
    padding: 1.25rem 1rem;
  }

  /* BARRA INFERIOR DE ACCIONES APILADA */
  .agrex-form-bottom-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    padding: 1rem;
  }

  .agrex-actions-cluster {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .btn-agrex-action {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 0.75rem 1rem;
  }

  /* FOOTER */
  .split-footer {
    justify-content: flex-end;
    text-align: right;
    padding: 0.25rem 1rem;
  }
}

/* 4. PANTALLAS ULTRA PEQUEÑAS (<= 480px) */
@media (max-width: 480px) {
  .agrex-metric-strip {
    grid-template-columns: 1fr;
  }

  .coords-inputs-row {
    grid-template-columns: 1fr;
  }

  .dash-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  .dash-item-right {
    width: 100%;
    justify-content: space-between;
  }

  .exp-feed-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .exp-feed-right {
    width: 100%;
    justify-content: space-between;
  }
}



/* ===== TAB 5 NOTARIO - HELPER CLASSES ===== */
.cell-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: var(--text-muted, #64748b);
  font-style: italic;
}

.cell-section-divider {
  width: 100%;
  height: 1px;
  background: var(--border, rgba(255,255,255,0.08));
  margin-bottom: 0.85rem;
}

.radio-inline-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.87rem;
  color: var(--text-primary, #f1f5f9);
  cursor: pointer;
  font-weight: 500;
}

.radio-inline-item input[type="radio"] {
  accent-color: var(--neon-emerald, #10b981);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ===== HEADER & FOOTER A TODO EL ANCHO (100vw) ===== */
.stage-topbar {
  width: 100%;
  flex-shrink: 0;
  z-index: 60;
  box-sizing: border-box;
}

.split-footer {
  width: 100%;
  height: 38px;
  background: var(--bg-app, #0a0f0d);
  border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  font-size: 0.74rem;
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
  box-sizing: border-box;
  z-index: 60;
}

.split-footer-left {
  display: flex;
  align-items: center;
}

.split-footer-right {
  display: flex;
  align-items: center;
}

.footer-version-tag {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.split-footer a {
  color: var(--neon-emerald, #10b981);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition, 0.2s);
}

.split-footer a:hover {
  text-decoration: underline;
  color: #34d399;
}

/* ==========================================================================
   ESTILOS DEDICADOS: MÓDULO INTEGRACIÓN WHATSAPP API & COLA ANTI-BAN
   ========================================================================== */

.whatsapp-module-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 3.5rem;
}

.badge-wa-active {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-xs, 4px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-wa-active i {
  width: 13px;
  height: 13px;
}

.badge-wa-queue {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs, 4px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.25s ease;
}

.badge-wa-queue.pulse {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

.badge-role-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  letter-spacing: 0.05em;
}

.badge-role-tag.client {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

.badge-role-tag.admin {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.badge-role-tag i {
  width: 12px;
  height: 12px;
}

.wa-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}

.wa-form-grid .full-width {
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  .wa-form-grid {
    grid-template-columns: 1fr;
  }
}

.wa-input-pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.wa-input-pwd-wrap input {
  padding-right: 2.75rem !important;
  width: 100%;
}

.btn-toggle-token-eye {
  position: absolute;
  right: 0.65rem;
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-toggle-token-eye:hover {
  color: #fff;
}

.btn-toggle-token-eye i {
  width: 16px;
  height: 16px;
}

.wa-field-hint {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 0.35rem;
  display: block;
}

.wa-field-hint code {
  background: rgba(0, 0, 0, 0.35);
  color: #38bdf8;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
}

/* CARDS DE PLANTILLAS */
.wa-templates-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.wa-template-card {
  background: rgba(14, 22, 18, 0.75);
  border: 1px solid var(--border-subtle, #1a2a1a);
  border-radius: var(--radius-md, 8px);
  padding: 1.15rem;
  transition: all 0.25s ease;
  position: relative;
}

.wa-template-card:hover {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.wa-template-card.is-disabled {
  opacity: 0.55;
  background: rgba(10, 15, 12, 0.45);
  border-color: rgba(255, 255, 255, 0.05);
}

.wa-template-card.is-disabled:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.wa-template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.wa-template-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.wa-template-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
}

.wa-template-code {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--neon-emerald, #10b981);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.wa-template-desc {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.wa-template-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.wa-toggle-status-text {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.03em;
}

/* TOGGLE SWITCH ESTILIZADO */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  cursor: pointer;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #27272a;
  border: 1px solid #3f3f46;
  transition: 0.25s;
  border-radius: 22px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #a1a1aa;
  transition: 0.25s;
  border-radius: 50%;
}

.switch-toggle input:checked + .slider-toggle {
  background-color: var(--neon-emerald, #10b981);
  border-color: #34d399;
}

.switch-toggle input:checked + .slider-toggle:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

.wa-label-micro {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-sub, #cbd5e1);
  display: block;
  margin-bottom: 0.35rem;
}

.wa-textarea {
  width: 100%;
  background: #03070a;
  border: 1px solid var(--border-subtle, #1a2a1a);
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm, 6px);
  resize: vertical;
  transition: border-color 0.2s, opacity 0.2s;
}

.wa-textarea:focus {
  outline: none;
  border-color: var(--neon-emerald, #10b981);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.wa-textarea:disabled {
  background: #070d0b;
  color: #64748b;
  cursor: not-allowed;
  opacity: 0.7;
}

.wa-vars-toolbar {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wa-vars-caption {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.wa-vars-caption i {
  width: 12px;
  height: 12px;
}

.wa-vars-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-var-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  color: #38bdf8;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-var-pill:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
}

.btn-var-pill:active {
  transform: translateY(0);
}

/* BARRA FLOTANTE DE GUARDADO */
.wa-save-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(14, 22, 18, 0.95);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-md, 8px);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  gap: 1rem;
}

.wa-save-bar-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.wa-save-bar-info i {
  width: 16px;
  height: 16px;
  color: var(--neon-emerald, #10b981);
}

.wa-save-bar-info code {
  color: #38bdf8;
  font-family: var(--font-mono, monospace);
}

/* ==========================================================================
   MODAL DE CLIENTE PROFESIONAL - 3 TABS (DETALLE, EXPEDIENTES, COBROS)
   ========================================================================== */
.modal-cliente-hub {
  max-width: 950px;
  width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.client-avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md, 8px);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.4));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.client-modal-tabs-bar {
  display: flex;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.7);
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.client-modal-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.client-modal-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.client-modal-tab-btn.active {
  background: var(--bg-card);
  border-color: var(--neon-emerald);
  color: var(--neon-emerald-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 12px -2px var(--neon-emerald-glow);
}

.client-modal-tab-btn i {
  width: 15px;
  height: 15px;
}

.tab-badge-counter {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: var(--font-mono);
}

.tab-badge-counter.amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.client-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.client-subtab-panel {
  display: none;
}

.client-subtab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

/* CARDS DE INFORMACIÓN DE CLIENTE */
.client-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.client-detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.client-detail-card .detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.client-detail-card .detail-label i {
  width: 13px;
  height: 13px;
  color: var(--neon-emerald);
}

.client-detail-card .detail-value {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
  word-break: break-word;
}

.client-detail-card .detail-hint {
  font-size: 0.72rem;
  color: var(--text-sub);
}

/* STRIP FINANCIERO DEL CLIENTE */
.client-financial-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  padding: 1rem;
}

@media (max-width: 768px) {
  .client-financial-summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

.cfin-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cfin-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.cfin-value {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

.client-quick-actions-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

/* TOPBAR DE SUBTABS */
.client-tab-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.client-table-scroll-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  background: rgba(0, 0, 0, 0.2);
}

/* DRAWER MINI DE REGISTRO DE PAGO */
.mcd-pay-drawer {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md, 8px);
  padding: 1rem;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.2s ease-in-out;
}

.pay-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(16, 185, 129, 0.15);
}

.btn-close-mini {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
}

.btn-close-mini:hover {
  color: #fff;
}

.btn-close-mini i {
  width: 14px;
  height: 14px;
}

.split-data-table tr.clickable-row:hover {
  background: rgba(255, 255, 255, 0.04);
}