:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --surface-strong: #111827;
  --text: #101828;
  --muted: #667085;
  --border: #dbe3ec;
  --border-strong: #c4ccd8;
  --primary: #d92d20;
  --primary-dark: #b42318;
  --blue: #1855d2;
  --blue-dark: #0b35a0;
  --green: #16a34a;
  --yellow: #d97706;
  --red-soft: #fff1f0;
  --blue-soft: #edf4ff;
  --green-soft: #edf9f0;
  --yellow-soft: #fff7e6;
  --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 20px 40px rgba(15, 23, 42, 0.08);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --sidebar-width: 236px;
  --sidebar-collapsed: 72px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

body {
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-height: 100vh;
  padding: 20px 18px;
  background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
  border-right: 1px solid var(--border);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.7);
  z-index: 20;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.content-scroll {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-container {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.sidebar-header,
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--primary) 0%, #f97316 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy small {
  color: var(--muted);
}

.sidebar-toggle,
.mobile-only {
  display: inline-flex;
  flex-direction: column;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

.sidebar-toggle span,
.mobile-only span {
  position: relative;
  width: 16px;
  height: 2px;
  background: var(--text);
  display: block;
}

.sidebar-toggle span + span,
.mobile-only span + span {
  margin-top: 5px;
}

.mobile-only {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 26px 0;
  overflow: auto;
}

.sidebar-section + .sidebar-section {
  margin-top: 24px;
}

.sidebar-label {
  display: block;
  padding: 0 12px 10px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 6px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #475467;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
  background: var(--red-soft);
  color: var(--primary);
  transform: translateX(2px);
}

.sidebar-link-button {
  font-weight: 600;
}

.session-button {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fff5f5;
  color: var(--primary-dark);
  font-weight: 700;
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(219, 227, 236, 0.8);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

.topbar-copy {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.05;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-footer {
  width: min(1380px, calc(100% - 40px));
  margin: auto auto 24px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-footer > div {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.card,
.glass-card,
.table-shell,
.callout,
.map-panel,
.rank-card,
.profile-section,
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card {
  padding: 24px;
}

.card h2,
.card h3,
.hero-card h2 {
  margin: 0 0 10px;
}

.section-grid {
  display: grid;
  gap: 24px;
}

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

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

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

.kpi-grid,
.cards-grid,
.chart-grid,
.table-grid,
.form-grid,
.profile-grid {
  display: grid;
  gap: 18px;
}

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

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

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

.table-grid {
  grid-template-columns: 1.8fr 1fr;
}

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

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

.profile-grid {
  grid-template-columns: 1.2fr 1fr;
}

.kpi-tile {
  display: grid;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.kpi-tile span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.kpi-tile strong {
  font-size: 1.8rem;
  line-height: 1;
}

.kpi-tile small {
  color: var(--muted);
}

.kpi-blue {
  background: var(--blue-soft);
}

.kpi-red {
  background: var(--red-soft);
}

.kpi-green {
  background: var(--green-soft);
}

.kpi-yellow {
  background: var(--yellow-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.badge.badge-neutral {
  background: #f3f4f6;
  color: #475467;
}

.badge.badge-danger {
  background: #fee4e2;
  color: var(--primary-dark);
}

.badge.badge-blue {
  background: var(--green-soft);
  color: var(--green);
}

.badge.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge.badge-yellow {
  background: #fef3c7;
  color: #b45309;
}

/* CUERPO DEL MODAL DE RESPUESTA AJAX (showResponseModal): TEXTO EN GRIS Y BARRAS LATERALES CON EL COLOR DEL BADGE SEGUN EL TIPO, PARA IDENTIFICAR DE UN VISTAZO SI FUE EXITO/ADVERTENCIA/ERROR */
#responseModalBody {
  color: #475467;
  min-height: 200px;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  padding-left: 14px;
  padding-right: 14px;
}

#responseModalBody.response-body-success {
  background: #dcfce7;
  border-left-color: #15803d;
  border-right-color: #15803d;
}

#responseModalBody.response-body-warning {
  background: #fef3c7;
  border-left-color: #b45309;
  border-right-color: #b45309;
}

#responseModalBody.response-body-danger {
  background: #fee4e2;
  border-left-color: var(--primary-dark);
  border-right-color: var(--primary-dark);
}

/* COLAPSABLES DE respuesta_errores_form (web/herramientas/util.py): CADA SECCION SE VE COMO UNA TARJETA
INDEPENDIENTE, MAS REDONDEADA QUE EL ACCORDION DE BOOTSTRAP POR DEFAULT (QUE SOLO REDONDEA EL PRIMER/ULTIMO ITEM) */
.accordion-errores {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.accordion-errores .accordion-item {
  border-radius: 14px !important;
  overflow: hidden;
  border: 1px solid #fde68a;
}

.accordion-errores .accordion-button {
  font-weight: 600;
  box-shadow: none !important;
}

.accordion-errores .accordion-button:focus {
  box-shadow: none;
}


.btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 12px 18px !important;
  border: 1px solid transparent !important;
  border-radius: 14px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease !important;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #ef4444 100%);
  color: #fff;
  box-shadow: 0 14px 32px rgba(217, 45, 32, 0.22);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-blue {
  background: linear-gradient(135deg, var(--blue) 0%, #2f7ef7 100%) !important;
  color: #fff !important;
}

.btn-success {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.field,
.field-inline {
  display: grid;
  gap: 8px;
}

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

.field label,
.fieldset-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #344054;
}

.field input,
.field select,
.field textarea,
.field .fake-input,
.field .fake-select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at top left, rgba(24, 85, 210, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(217, 45, 32, 0.14), transparent 24%),
    linear-gradient(180deg, #f9fbff 0%, #eef3f8 100%);
}

.login-card {
  width: min(460px, 100%);
  padding: 36px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 227, 236, 0.9);
  border-radius: 30px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-brand-mark {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--blue-dark) 0%, var(--blue) 48%, var(--primary) 100%);
  color: #fff;
  font-size: 2.3rem;
  font-weight: 800;
  box-shadow: 0 24px 50px rgba(24, 85, 210, 0.26);
}

.brand-mark-map {
  border-radius: 50%;
  /* !important: leaflet.css trae ".leaflet-marker-icon{display:block}" y se carga despues de gepp.css en
     el <head> (ver base.html) -- misma especificidad (1 clase), gana por orden y pisa el display:flex */
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--blue-dark) 0%, var(--blue) 48%, var(--primary) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0px 15px rgba(24, 85, 210, 0.26);
}

/* BADGE DE TENDENCIA (CRECIMIENTO/CAIDA/ESTABLE) EN LA ESQUINA SUPERIOR DERECHA DEL MARCADOR DE CLIENTE */
.brand-mark-tendencia {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
}

/* MARCADOR DE CLIENTE YA CAPTURADO (tipo_cliente === "C"): EL LOGO COMPLETO, SIN EL FONDO CIRCULAR AZUL DE
   .brand-mark-map (ESE SOLO APLICA A PROSPECTOS, VER repintarClientesConFiltro) */
.brand-mark-map-pepsi {
  position: relative;
  width: 20px;
  height: 20px;
}
.brand-mark-pepsi {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0.5px 1px rgba(16, 24, 40, 0.4));
}
/* EL MARCADOR DE PEPSI ES MUCHO MAS CHICO QUE EL "G" -- EL BADGE DE TENDENCIA SE ESCALA PROPORCIONAL PARA
   NO TAPARLO (18px SE VE DESPROPORCIONADO SOBRE UN MARCADOR DE 13px) */
.brand-mark-map-pepsi .brand-mark-tendencia {
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
}

.login-meta {
  text-align: center;
  color: var(--muted);
}

.login-actions {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.page-stack {
  display: grid;
  gap: 24px;
}

.user-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(246, 248, 251, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.avatar-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, #fb7185 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
}

.user-copy h2,
.user-summary strong {
  margin: 0;
}

.user-copy p,
.user-summary span {
  margin: 0;
  color: var(--muted);
}

.user-summary {
  display: grid;
  gap: 4px;
  justify-items: end;
  padding: 14px 16px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.goal-card,
.summary-banner,
.warning-card,
.success-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius-md);
}

.goal-card {
  background: linear-gradient(135deg, #fff 0%, #fff7f6 100%);
  border: 1px solid #fed7d4;
}

.summary-banner {
  background: linear-gradient(135deg, rgba(11, 53, 160, 0.98), rgba(24, 85, 210, 0.92));
  color: #fff;
}

.goal-meta,
.summary-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.progress-bar,
.progress-rail {
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-bar span,
.progress-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.progress-bar span {
  width: 72%;
  background: linear-gradient(90deg, var(--primary) 0%, #fb7185 100%);
}

.progress-rail span {
  background: linear-gradient(90deg, var(--blue-dark) 0%, var(--blue) 100%);
}

.quick-links {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-link {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.quick-link strong {
  font-size: 1rem;
}

.quick-link p {
  margin: 0;
  color: var(--muted);
}

.filter-bar,
.toolbar {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.filter-bar .field,
.toolbar .field {
  min-width: 180px;
  flex: 1 1 180px;
}

.filter-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #475467;
  font-weight: 700;
}

.filter-chip.is-active {
  background: var(--surface-strong);
  border-color: var(--surface-strong);
  color: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #475467;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}

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

.table-shell {
  overflow: hidden;
}

.table-shell-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 16px;
}

.table-shell-header + .data-table {
  border-top: 1px solid #edf2f7;
}

.card-list,
.stack-list,
.activity-list,
.rank-list,
.reason-list {
  display: grid;
  gap: 16px;
}

.pdv-card,
.result-row,
.ranking-row,
.timeline-row,
.reason-row {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.pdv-card-header,
.result-row-header,
.timeline-row-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.pdv-card-footer,
.inline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  min-height: 760px;
}

.map-stage {
  position: relative;
  overflow: hidden;
  min-height: 760px;
  border-radius: 28px;
  background:
    linear-gradient(140deg, rgba(11, 53, 160, 0.12), transparent 32%),
    radial-gradient(circle at 25% 32%, rgba(24, 85, 210, 0.16), transparent 18%),
    radial-gradient(circle at 78% 64%, rgba(217, 45, 32, 0.12), transparent 20%),
    linear-gradient(180deg, #f7fafc 0%, #ebf0f5 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.map-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(24, 85, 210, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 85, 210, 0.04) 1px, transparent 1px);
  background-size: 120px 120px;
}

.map-overlay-card {
  position: absolute;
  z-index: 2;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 227, 236, 0.84);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

.map-overlay-top {
  top: 22px;
  left: 22px;
}

.map-fab {
  position: absolute;
  left: 22px;
  bottom: 22px;
  display: flex;
  gap: 14px;
  z-index: 3;
}

.fab-main,
.fab-secondary {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #141b2d;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.fab-secondary {
  background: #fff;
  color: var(--blue);
  border: 1px solid #dbeafe;
}

.map-point {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 10px 16px rgba(15, 23, 42, 0.18);
  z-index: 2;
}

.map-point.high {
  background: #dc2626;
}

.map-point.medium {
  background: #eab308;
}

.map-point.low {
  background: #2563eb;
}

.map-sidepanel {
  display: grid;
  gap: 18px;
}

.panel-list {
  display: grid;
  gap: 14px;
}

.panel-item {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.panel-item strong,
.panel-item p {
  display: block;
}

.panel-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.detail-grid.single {
  grid-template-columns: 1fr;
}

.detail-block {
  padding: 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
}

.mini-map {
  min-height: 300px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 55% 42%, rgba(217, 45, 32, 0.18), transparent 9%),
    linear-gradient(135deg, rgba(24, 85, 210, 0.12), transparent 40%),
    linear-gradient(180deg, #eef4fb 0%, #dfe9f5 100%);
  position: relative;
  overflow: hidden;
}

.mini-map::after {
  content: "";
  position: absolute;
  inset: 20% 35%;
  background: radial-gradient(circle, rgba(217, 45, 32, 0.18), transparent 55%);
}

.checklist {
  display: grid;
  gap: 16px;
}

.checklist-item {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.checklist-item h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.choice-row,
.checkbox-row,
.radio-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.pill-option,
.checkbox-option {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-weight: 700;
}

.pill-option.is-active,
.checkbox-option.is-active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: #bfd3ff;
}

.pipeline-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  position: relative;
}

.pipeline-stepper::before {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  top: 19px;
  height: 3px;
  background: #d0d5dd;
}

.step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  z-index: 1;
}

.step span {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 3px solid #d0d5dd;
  background: #fff;
}

.step-done span {
  background: var(--green);
  border-color: var(--green);
}

.step-active span {
  border-color: var(--green);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.step small {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.warning-card {
  background: #fff8eb;
  border: 1px solid #fed7aa;
}

.success-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf3 100%);
  border: 1px solid #bbf7d0;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 100;
}

/* ACOTADO A .modal-shell: Bootstrap usa el MISMO nombre de clase (.modal-backdrop) para el fondo de
SUS PROPIOS modales (#modalVisita, #modalAlta, #modalPunteo, #modalNucleo, etc.) - sin este scope, esta
regla (con !important) tambien les pisaba position/z-index a esos backdrops de Bootstrap */
.modal-shell .modal-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.48) !important;
  backdrop-filter: blur(4px) !important;
  z-index: 0 !important;
}

.modal-card {
  position: relative;
  width: min(760px, calc(100% - 24px));
  margin: 6vh auto 0;
  background: #fff;
  border-radius: 26px;
  box-shadow: var(--shadow-md);
  /* .modal-shell es position:fixed (sin scroll de pagina) y no tenia max-height/overflow-y aqui:
     un contenido que crece (p.ej. el accordion de advertencias de respuesta_errores_form al abrir
     una seccion) simplemente se recortaba sin forma de verlo completo ni de hacer scroll. overflow-x
     se mantiene hidden (para las esquinas redondeadas), overflow-y pasa a scrollear. */
  max-height: calc(100dvh - 12vh);
  overflow-x: hidden;
  overflow-y: auto;
}

.modal-card-compact {
  width: min(460px, calc(100% - 24px));
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
}

.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border: 4px solid var(--green-soft);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  color: #fff;
}

.modal-header h2 {
  margin: 0;
}

.modal-header button:not(.btn-close) {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
}

/* .btn-close (Bootstrap) DIBUJA LA X COMO IMAGEN DE FONDO (background); NO SE PUEDE USAR EL SHORTHAND "background" ARRIBA O SE PIERDE EL ICONO */
.modal-header .btn-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.18);
  opacity: 1;
}

.modal-header-blue {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
}

.modal-body,
.modal-actions {
  padding: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
}

[data-lucide-name] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  vertical-align: middle;
  flex-shrink: 0;
}

[data-lucide-name] svg {
  display: block;
  flex: none;
}

.support-phone {
  margin-top: 20px;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
}

.upload-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.upload-tile {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 180px;
  padding: 24px 18px;
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-tile:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.upload-input {
  display: none;
}

.upload-filename {
  color: var(--muted);
  font-weight: 600;
}

.upload-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1.4rem;
  font-weight: 800;
}

.chart-card {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.chart-card h3,
.chart-card p {
  margin: 0;
}

.chart-card p {
  color: var(--muted);
}

.chart-bars,
.funnel-bars,
.trend-grid {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.chart-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
}

.bar-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.bar-blue { background: linear-gradient(90deg, #1d4ed8, #3b82f6); }
.bar-indigo { background: linear-gradient(90deg, #4338ca, #6366f1); }
.bar-yellow { background: linear-gradient(90deg, #ca8a04, #f59e0b); }
.bar-green { background: linear-gradient(90deg, #15803d, #22c55e); }
.bar-red { background: linear-gradient(90deg, #b91c1c, #ef4444); }

.donut-chart {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  margin: 30px auto 18px;
  background:
    conic-gradient(#22c55e 0 47%, #eab308 47% 79%, #ef4444 79% 100%);
  position: relative;
}

.donut-chart::after {
  content: "47%";
  position: absolute;
  inset: 28px;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 800;
}

.metric-triad {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  text-align: center;
}

.metric-triad strong {
  display: block;
  font-size: 1.65rem;
}

.trend-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  min-height: 280px;
}

.trend-column {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.trend-stack {
  width: 100%;
  min-height: 220px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 6px;
}

.trend-stack span {
  width: 20px;
  border-radius: 999px 999px 0 0;
  background: #93c5fd;
}

.trend-stack .altas {
  background: #86efac;
}

.ranking-table,
.mini-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table th,
.ranking-table td,
.mini-table th,
.mini-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
}

.ranking-table th,
.mini-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.reason-row {
  gap: 8px;
}

.reason-row-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  padding: 28px;
  background: linear-gradient(135deg, #fff 0%, #eef4ff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.profile-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue), var(--primary));
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
}

.settings-list {
  display: grid;
  gap: 14px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid #edf2f7;
}

.settings-row:last-child {
  border-bottom: 0;
}

.toggle {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #d0d5dd;
  position: relative;
  border: 0;
  padding: 0;
  cursor: pointer;
  appearance: none;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
}

.toggle.is-on {
  background: var(--blue);
}

.toggle.is-on::after {
  left: 25px;
}

.toggle:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 3px;
}

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

.brief-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 1.2fr 0.8fr;
}

.brief-points,
.chip-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.full-width {
  width: 100%;
}

@media (max-width: 1200px) {
  .kpi-grid,
  .quick-links,
  .split-4,
  .cards-grid.cards-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-layout,
  .table-grid,
  .profile-grid,
  .brief-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .app-sidebar {
    position: fixed;
    left: -100%;
    width: min(88vw, 320px);
    transition: left 0.25s ease;
  }

  body.sidebar-open .app-sidebar {
    left: 0;
  }

  .mobile-only {
    display: inline-flex;
  }

  .content-container,
  .app-footer {
    width: min(100% - 28px, 100%);
  }

  .kpi-grid,
  .quick-links,
  .cards-grid.cards-grid-2,
  .chart-grid,
  .ui-kit-grid,
  .upload-grid,
  .field-inline,
  .form-grid,
  .form-grid.form-grid-3,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .user-header,
  .profile-hero {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .content-container {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

  .login-card,
  .card,
  .chart-card,
  .modal-body,
  .modal-actions {
    padding: 20px;
  }

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

.app-shell {
  display: flex;
  min-height: 100dvh;
  background: #f4f6f9;
}

.app-backdrop {
  display: none;
}

.app-sidebar {
  position: relative;
  align-self: stretch;
  min-height: 100dvh;
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.98);
  border-right: 1px solid rgba(219, 227, 236, 0.92);
  box-shadow: 10px 0 40px rgba(15, 23, 42, 0.04);
  overflow: visible;
}

.app-sidebar-inner {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  height: 100dvh;
  padding: 14px 14px calc(20px + env(safe-area-inset-bottom, 0px));
}

.app-main {
  flex: 1;
  min-width: 0;
  min-height: 100dvh;
}

.content-scroll {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.content-container {
  width: min(1480px, calc(100% - 32px));
  padding: 18px 0 24px;
}

.sidebar-header {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 84px;
  padding: 10px 52px 18px 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
}

.brand-image {
  display: block;
  height: auto;
}

.brand-mini {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3368ff 0%, #e33629 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35);
  font-size: 0.96rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.brand-image-full {
  width: 76px;
}

.brand-image-compact {
  display: none;
  width: 34px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rail-toggle {
  position: absolute;
  top: 17px;
  right: -18px;
  width: 36px;
  height: 36px;
  border: 1px solid #dce4ee;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
}

.rail-toggle svg,
.topbar-back svg,
.sidebar-link-icon svg,
.map-action svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 960px) {
  .rail-toggle {
    display: none;
  }
}

.sidebar-nav {
  flex: 1 1 auto;
  padding: 10px 0 16px;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-section {
  display: grid;
  gap: 6px;
}

.sidebar-section + .sidebar-section {
  margin-top: 14px;
}

.sidebar-link,
.session-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  gap: 14px;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 15px;
  color: #344054;
  overflow: hidden;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.sidebar-link-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link:hover,
.sidebar-link-button:hover {
  background: #fff2f0;
  color: #e33629;
  transform: translateX(1px);
}

.sidebar-link.is-active {
  background: #fff2f0;
  color: #e33629;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 0 14px;
  display: grid;
  gap: 12px;
}

.sidebar-footer-links {
  display: grid;
  gap: 6px;
}

.session-button {
  border: 1px solid #ffd7d3;
  background: #fff5f4;
  color: #d92d20;
  font-weight: 800;
}

body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed);
}

body.sidebar-collapsed .app-sidebar-inner {
  padding: 12px 10px calc(18px + env(safe-area-inset-bottom, 0px));
}

body.sidebar-collapsed .sidebar-link-label {
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .session-button,
body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-header {
  min-height: 72px;
  padding: 22px 0 12px;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .session-button {
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0;
  margin-inline: auto;
  gap: 0;
  border-radius: 12px;
}

body.sidebar-collapsed .rail-toggle {
  width: 36px;
  height: 36px;
  top: -2px;
  right: -18px;
}

body.sidebar-collapsed .sidebar-label {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
}

body.sidebar-collapsed .rail-toggle svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  width: 100%;
  height: 32px;
  margin-inline: auto;
  overflow: visible;
  opacity: 1;
}

body.sidebar-collapsed .brand-image-full {
  display: none;
}

body.sidebar-collapsed .brand-image-compact {
  display: none;
}

body.sidebar-collapsed .brand-mini {
  display: inline-flex;
}

body.sidebar-collapsed .sidebar-nav {
  padding-top: 10px;
}

body.sidebar-collapsed .sidebar-section {
  gap: 10px;
}

body.sidebar-collapsed .sidebar-link-icon {
  margin-inline: auto;
}

body.sidebar-collapsed .sidebar-footer {
  padding-top: 18px;
  padding-bottom: 12px;
  gap: 12px;
}

body.sidebar-collapsed .sidebar-footer-links {
  gap: 10px;
}

body.sidebar-collapsed .sidebar-link:hover,
body.sidebar-collapsed .sidebar-link-button:hover,
body.sidebar-collapsed .session-button:hover {
  transform: none;
}

body.sidebar-collapsed .sidebar-link.is-active,
body.sidebar-collapsed .session-button {
  border-radius: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  gap: 20px;
  margin-bottom: 20px;
  padding: 18px 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(219, 227, 236, 0.8);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.topbar-copy {
  align-items: center;
}

.topbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #dce4ee;
  background: #fff;
  color: #475467;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.topbar h1 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  letter-spacing: -0.03em;
}

.page-subtitle {
  font-size: 0.96rem;
}

.full-width {
  width: 100%;
  max-width: none;
}

body[data-nav="geo"] .content-container.page-geo {
  width: 100%;
  padding: 0;
}

body[data-nav="geo"] .app-footer {
  display: none;
}

body[data-nav="geo"] .topbar {
  margin-bottom: 0;
  padding: 16px 24px 16px 28px;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.geo-map-shell {
  position: relative;
  min-height: calc(100dvh - 77px);
  overflow: hidden;
  background: #dfe7ef;
}

.geo-map-canvas,
.geo-map-wash {
  position: absolute;
  inset: 0;
}

.geo-map-canvas {
  z-index: 1;
}

.geo-map-wash {
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.22) 100%);
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font-family: "Manrope", sans-serif;
}

.leaflet-tile {
  filter: saturate(0.78) brightness(1.07) contrast(0.9);
}

.leaflet-control-attribution {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.78) !important;
  backdrop-filter: blur(8px);
}

.geo-right-rail {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: min(320px, calc(100vw - 128px));
  height: calc(100dvh - 106px);
  max-height: calc(100dvh - 106px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

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

.geo-kpi-card,
.geo-overlay-card {
  background: rgba(255, 255, 255, 0.96);
/*  border: 1px solid rgba(219, 227, 236, 0.88);*/
  border-radius: 20px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
  max-width: 100%;
  box-sizing: border-box;
}

.geo-kpi-card {
  min-height: 84px;
  padding: 14px 12px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 2px;
}

.geo-kpi-card span {
  color: #667085;
  font-weight: 700;
  font-size: 0.82rem;
}

.geo-kpi-card strong {
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.geo-kpi-card-soft-baja {
  background: rgba(255, 246, 245, 0.98);
}

.geo-kpi-card-soft-media {
  background: rgba(255, 251, 235, 0.98);
}

.geo-kpi-card-soft-alta {
  background: rgba(239, 255, 244, 0.98);
}

.geo-kpi-card-soft-total {
  background: rgba(23, 34, 59, 0.98);
  color: rgba(255, 255, 255, 0.96) !important;
  font-weight: 700;
  font-size: 0.82rem;}

.geo-overlay-card {
  padding: 14px 14px 12px;
}

.geo-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.geo-overlay-header h2 {
  margin: 0;
  font-size: 1rem;
}

.geo-list-link {
  color: #e33629;
  font-weight: 700;
  font-size: 0.84rem;
}

.geo-nuclei-card {
  min-height: 0;
  max-height: fit-content;
  overflow: auto;
  /* SIEMPRE la ultima fila (flexible) del grid de .geo-right-rail, sin importar cuantas
     tarjetas de capas/catalogos esten visibles antes que ella (ver grid-template-rows). */
  grid-row: -1;
}

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

.geo-nucleus-item {
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #ecf1f5;
}

.geo-nucleus-row,
.geo-nucleus-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.geo-nucleus-row strong {
  font-size: 0.96rem;
}

.geo-nucleus-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 6px;
}

/* PAREJA "ETIQUETA EN NEGRO" + BADGE DE COLOR, USADA EN LOS 4 BADGES DE CLASIFICACION DE CELDAS (VER badgesCeldas) */
.geo-nucleus-badge-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.geo-nucleus-badge-label {
  color: #101828;
  font-size: 0.78rem;
  font-weight: 700;
}

.geo-nucleus-meta {
  margin-top: 6px;
  color: #667085;
  font-size: 0.84rem;
}

.geo-map-actions {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
}

.geo-map-action-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-10px);
  pointer-events: none;
  transition: max-width 0.28s ease, opacity 0.2s ease, transform 0.28s ease;
}

.geo-map-actions.is-open .geo-map-action-panel {
  max-width: 120px;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.map-action {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(219, 227, 236, 0.92);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: #3b82f6;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.map-action [data-lucide-name],
.map-action .map-action-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.map-action [data-lucide-name] svg,
.map-action .map-action-icon {
  display: block;
  margin: 0 auto;
}

.map-action-icon-toggle {
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform 0.22s ease;
}

.geo-map-actions.is-open .map-action-icon-toggle {
  transform: rotate(45deg);
}

.map-action.is-dark,
.map-action.is-active {
  background: #17223b;
  color: #fff;
  border-color: rgba(23, 34, 59, 0.94);
}

.geo-overlay-card .filter-chip-row {
  gap: 8px;
}

.geo-overlay-card .filter-chip {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.geo-map-banner {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(23, 34, 59, 0.94);
  color: #fff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(12px);
}

.geo-map-banner[hidden] {
  display: none !important;
}

.geo-map-banner-icon,
.geo-map-banner-close,
.geo-detail-close,
.geo-evidence-drop-icon,
.geo-form-header button,
.geo-favorite-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.geo-map-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
}

.geo-map-banner-close,
.geo-detail-close,
.geo-form-header button,
.geo-favorite-chip {
  border: 0;
  cursor: pointer;
}

.geo-map-banner-close {
  width: 32px;
  height: 32px;
  margin-left: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.geo-modal-shell {
  z-index: 120;
}

.geo-modal-card {
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.22);
}

.geo-detail-card {
  width: min(430px, calc(100% - 24px));
  margin-top: 5vh;
  border-radius: 28px;
}

.geo-detail-hero {
  position: relative;
  padding: 20px 22px 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
}

.geo-detail-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
  font-weight: 700;
}

.geo-detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.geo-detail-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  font-size: 1.1rem;
  text-transform: lowercase;
}

.geo-brand-badge {
  position: relative;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: #fff;
}

.geo-brand-red,
.geo-brand-blue,
.geo-brand-white {
  position: absolute;
  inset-inline: -2px;
  height: 16px;
  border-radius: 999px;
}

.geo-brand-red {
  top: 4px;
  background: #ef4444;
  transform: rotate(-10deg);
}

.geo-brand-blue {
  bottom: 4px;
  background: #2563eb;
  transform: rotate(-10deg);
}

.geo-brand-white {
  top: 13px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  transform: rotate(-10deg);
}

.geo-detail-client {
  margin-top: 18px;
}

.geo-detail-client h2 {
  margin: 0;
  font-size: 1.62rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.geo-detail-mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.84rem;
  font-weight: 700;
}

/* VARIANTE APILADA: etiqueta chica arriba, valor abajo (ej. Potencial en la tarjeta de cliente) */
.geo-detail-mini-tag-stack {
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.1;
}

.geo-detail-mini-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.geo-favorite-chip {
  position: absolute;
  right: 20px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.geo-detail-body {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
  background: #f8fbff;
}

.geo-detail-info-grid {
  display: grid;
  gap: 12px;
}

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

.geo-detail-info-grid-address {
  grid-template-columns: minmax(0, 1.65fr) minmax(100px, 0.65fr);
}

.geo-detail-info-card {
  display: grid;
  gap: 8px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid #dce8f7;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.geo-detail-info-card-compact {
  align-content: start;
}

.geo-detail-info-card strong {
  font-size: 0.96rem;
  line-height: 1.35;
  word-break: break-word;
}

.geo-detail-info-card svg {
  color: #1d4ed8;
}

.geo-detail-label {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.geo-detail-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.geo-form-modal {
  border-radius: 28px;
}

.geo-form-modal-wide {
  width: min(860px, calc(100% - 24px));
}

.geo-form-modal-xl {
  width: min(980px, calc(100% - 24px));
}

.geo-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
}

.geo-form-header h2 {
  margin: 0;
  font-size: 1.32rem;
  letter-spacing: -0.03em;
  color: #fff;
}

.geo-form-header button:not(.btn-close) {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* .btn-close (Bootstrap) DIBUJA LA X COMO IMAGEN DE FONDO (background); NO SE PUEDE USAR EL SHORTHAND "background" ARRIBA O SE PIERDE EL ICONO */
.geo-form-header .btn-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.18);
  opacity: 1;
}

.geo-form-body {
  padding: 24px;
  background: #fff;
}

.geo-form-grid {
  display: grid;
  gap: 16px;
}

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

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

.geo-form-column {
  display: grid;
  gap: 16px;
  /* SIN ESTO, EL CONTENIDO MAS ANCHO DE LA COLUMNA (p.ej. el carrusel de evidencias
     de form_visita.html) fuerza el ancho minimo de TODO el track del grid via el
     "automatic minimum size" de los items, empujando tambien a la otra columna
     fuera de la pantalla en celular aunque .geo-form-grid-2 ya colapse a 1 columna. */
  min-width: 0;
}

.geo-form-field {
  display: grid;
  gap: 8px;
  /* mismo caso que .geo-form-column: sin esto, contenido ancho dentro del campo
     (p.ej. el carrusel de evidencias de form_visita.html) empuja el ancho minimo
     de este grid item mas alla del espacio disponible en celular. */
  min-width: 0;
}

.geo-form-field-span-2 {
  grid-column: span 2;
}

.geo-form-field > span {
  color: #344054;
  font-size: 0.86rem;
  font-weight: 800;
}

.geo-form-field input,
.geo-form-field select,
.geo-form-field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #d7e2ee;
  border-radius: 16px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.geo-form-field input:focus,
.geo-form-field select:focus,
.geo-form-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.geo-form-field input[readonly] {
  background: #f8fafc;
  color: #475467;
}

.geo-form-field textarea {
  resize: vertical;
  min-height: 120px;
}

.geo-form-section + .geo-form-section {
  margin-top: 24px;
}

.geo-form-section h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.geo-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px 24px;
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
  border-top: 1px solid #e5edf5;
}

.geo-evidence-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 28px 20px;
  border: 2px dashed #c7d7ea;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
  text-align: center;
  cursor: pointer;
}

.geo-evidence-drop input {
  display: none;
}

.geo-evidence-drop strong {
  font-size: 1rem;
}

.geo-evidence-drop small,
.geo-evidence-drop-name {
  color: #64748b;
}

.geo-evidence-drop-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
}

.geo-pending-card {
  width: min(460px, calc(100% - 24px));
  border-radius: 26px;
}

.geo-pending-copy {
  padding: 4px 24px 0;
  color: #475467;
  line-height: 1.65;
}

.geo-pending-copy strong {
  color: #0f172a;
}

.geo-step-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 6px;
  border-radius: 999px;
  background: #eff6ff;
}

.geo-step-tab {
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1d4ed8;
  font-weight: 800;
  cursor: pointer;
}

.geo-step-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.14);
}

.geo-step-panel {
  min-height: 360px;
}

.geo-punteo-coords {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid #d7e2ee;
  border-radius: 16px;
  background: #f8fbff;
  color: #1e3a8a;
  font-size: 0.92rem;
  font-weight: 700;
}

.geo-punteo-coords strong {
  color: #0f172a;
}

.geo-map-actions.is-open .geo-map-action-panel {
  max-width: 120px;
}

.geo-nucleus-item {
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.geo-nucleus-item:hover,
.geo-nucleus-item.is-active {
  border-color: #bfd5f7;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.geo-nucleus-item.is-active {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

@media (max-width: 1200px) {
  .geo-right-rail {
    width: min(300px, calc(100vw - 120px));
  }
}

@media (max-width: 960px) {
  .app-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    border: 0;
    background: rgba(15, 23, 42, 0.36);
    display: none;
  }

  body.sidebar-open .app-backdrop {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    left: -100%;
    width: min(88vw, 320px);
    min-height: 100dvh;
    transition: left 0.25s ease;
    z-index: 20;
    overflow: hidden;
  }

  body.sidebar-open .app-sidebar {
    left: 0;
  }

  .app-sidebar-inner {
    position: relative;
    min-height: 100dvh;
    height: 100dvh;
  }

  .content-container {
    width: min(100% - 20px, 100%);
  }

  body[data-nav="geo"] .content-container.page-geo {
    width: 100%;
  }

  .geo-map-shell {
    min-height: auto;
    padding-bottom: 18px;
  }

  .geo-map-canvas {
    position: relative;
    /* 75px = alto real del header en esta pagina (medido), 18px = padding-bottom
       de .geo-map-shell; con esto el shell llena exactamente el resto de la pantalla,
       sin dejar espacio en blanco abajo. */
    min-height: calc(100dvh - 93px);
  }

  .geo-map-wash {
    display: none;
  }

  .geo-right-rail {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    height: auto;
    max-height: none;
    margin: -88px 14px 0;
  }

  .geo-map-actions {
    left: 14px;
    bottom: 14px;
  }

  .geo-form-modal-wide,
  .geo-form-modal-xl {
    width: min(100% - 24px, 860px);
  }

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

  body.sidebar-collapsed .app-sidebar {
    width: min(88vw, 320px);
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 14px 16px;
  }

  .geo-right-rail {
    margin-inline: 10px;
  }

  .geo-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .geo-overlay-card {
    padding: 16px;
  }

  .geo-map-banner {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    justify-content: space-between;
  }

  .geo-map-actions {
    gap: 8px;
  }

  .geo-map-action-panel {
    gap: 8px;
  }

  .geo-map-actions.is-open .geo-map-action-panel {
    max-width: 112px;
  }

  .geo-detail-card,
  .geo-pending-card,
  .geo-form-modal-wide,
  .geo-form-modal-xl {
    width: calc(100% - 16px);
    margin-top: 2vh;
    border-radius: 22px;
  }

  .geo-detail-hero,
  .geo-form-header,
  .geo-form-body,
  .geo-form-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .geo-detail-info-grid-2,
  .geo-detail-info-grid-address,
  .geo-form-grid-2,
  .geo-form-grid-3 {
    grid-template-columns: 1fr;
  }

  .geo-form-field-span-2 {
    grid-column: auto;
  }

  .geo-step-tabs {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    border-radius: 18px;
  }

  .geo-step-panel {
    min-height: auto;
  }

  .geo-form-actions {
    flex-direction: column-reverse;
  }

  .geo-form-actions .btn {
    width: 100%;
  }

  .geo-punteo-coords {
    display: grid;
    justify-items: start;
  }
}