* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}
#app { display: flex; flex-direction: row; height: 100%; }

/* ---------- Barra superior de navegación (estilo Trx) ---------- */
.sidebar-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 68px; min-height: 68px; width: 100%;
  background: linear-gradient(135deg, #0E86C4, #1EA0DA);
  color: #fff;
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  padding: 6px 14px;
  overflow-x: auto; overflow-y: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.sidebar-nav::-webkit-scrollbar { height: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 2px; }
.sb-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sb-logo a { display: flex; align-items: center; }
.sb-logo a img { height: 52px; width: auto; max-width: 220px; object-fit: contain; }
.sb-logo-div { width: 1px; height: 42px; background: rgba(255,255,255,.35); }
.sb-logo-sube { height: 44px !important; width: auto; max-width: 170px; object-fit: contain; }
.sb-titulo { font-size: 17px; color: #fff; white-space: nowrap; flex-shrink: 0; }
.sb-sub { font-size: 12px; color: #e8f4fc; white-space: nowrap; flex-shrink: 0; }
.sb-section { display: flex; flex-direction: row; align-items: center; gap: 6px; padding: 0 2px; flex-shrink: 0; }
.sb-nav-start { margin-left: 60px; }
.sb-section-label { display: none; }
.sb-link { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 6px; text-decoration: none; color: #fff; font-size: 12.5px; font-weight: 600; transition: all .14s; white-space: nowrap; background: rgba(255,255,255,.18); }
.sb-link:hover { background: rgba(255,255,255,.3); }
.sb-link.active { background: #fff; color: #0E86C4; }
.sb-link svg { flex-shrink: 0; }
.sb-submenu { position: relative; display: flex; flex-shrink: 0; }
.sb-submenu-btn { cursor: pointer; user-select: none; }
.sb-submenu-btn .sb-caret { transition: transform .18s; flex-shrink: 0; }
.sb-submenu.open > .sb-submenu-btn { background: #fff; color: #0E86C4; }
.sb-submenu.open > .sb-submenu-btn .sb-caret { transform: rotate(90deg); }
.sb-submenu-list { position: fixed; top: 60px; left: 0; display: none; flex-direction: row; align-items: center; gap: 6px; padding: 6px; border-radius: 10px; background: #0b6ea4; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 1100; }
.sb-submenu.open > .sb-submenu-list { display: flex; }
.sb-submenu-list .sb-link { background: rgba(255,255,255,.14); font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 7px; gap: 5px; }
.sb-submenu-list .sb-link:hover { background: rgba(255,255,255,.3); }
.sb-submenu-list .sb-link.active { background: #fff; color: #0E86C4; }
.sb-spacer { flex: 1; flex-shrink: 0; }
.sb-footer { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sb-user { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.sb-user:hover { background: rgba(255,255,255,.2); }
.sb-avatar { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.25); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 13px; font-weight: 600; color: #eaf6ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { font-size: 10px; color: rgba(255,255,255,.55); text-transform: capitalize; }
.sb-salir { display: flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.18); padding: 6px 12px; border-radius: 6px; white-space: nowrap; }
.sb-salir:hover { background: rgba(255,255,255,.3); }
.sb-user-dd { position: relative; }
.sb-user-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 900;
  background: #fff; color: #1a1a1a; border: 1px solid #dbe3ea; border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.16); min-width: 190px; padding: 6px;
}
.sb-user-menu[hidden] { display: none; }
.sb-user-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none;
  text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 12.5px; cursor: pointer;
  color: #1a1a1a; white-space: nowrap;
}
.sb-user-menu button:hover { background: #f0f4f8; }

/* ---------- Modal cambiar contraseña ---------- */
#cambiarPassModal .modal-box { max-width: 380px; }
.cp-body { padding: 20px; }
.cp-body label { display: block; font-size: 12px; margin: 12px 0 4px; color: #555; }
.cp-body input[type=password] {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd8e0; border-radius: 6px; font-size: 13px;
}
.cp-body #cpMsg { font-size: 12.5px; margin-top: 12px; min-height: 16px; }
.cp-body .cp-ok { color: #1e7e34; }
.cp-body .cp-err { color: #b3261e; }
.cp-body #cpGuardar {
  margin-top: 12px; width: 100%; background: #0E86C4; color: #fff; border: none;
  padding: 9px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.cp-body #cpGuardar:hover { background: #0a6fa3; }
.cp-body #cpGuardar:disabled { opacity: .6; cursor: default; }

/* ---------- Área principal (topbar + cuerpo) ---------- */
#mainArea { flex: 1; display: flex; flex-direction: column; min-width: 0; margin-left: 0; padding-top: 68px; }
#mainArea.main-area-mapa { height: 100vh; overflow: hidden; }

/* ---------- Botón hamburguesa (menú móvil) ---------- */
.btn-hamburger-mobile { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 0 4px; color: #1a1a1a; }
.btn-hamburger-mobile:hover { background: none; }
.btn-hamburger-flotante { display: none; }

/* ---------- Membrete superior móvil (menú + logos Gobierno/SUBE) ---------- */
/* Fuera del breakpoint queda oculto: en escritorio el membrete es la barra
   lateral celeste. Se posiciona fijo para poder vivir dentro de #app sin
   afectar el layout flex. */
#topbarMovil { display: none; }
#topbarMovil .btn-menu-top {
  background: none; border: none; font-size: 22px; line-height: 1;
  cursor: pointer; padding: 4px 8px; color: #fff; flex: 0 0 auto;
}
#topbarMovil .btn-menu-top:hover { background: rgba(255,255,255,.2); border-radius: 6px; }
#topbarMovil .tm-logo-gs { height: 34px; width: auto; display: block; }
#topbarMovil .tm-logo-sube { height: 30px; width: auto; display: block; margin-left: auto; }
#header {
  background: #ffffff;
  border-bottom: 1px solid #e2e2e2;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#header h1 { font-size: 16px; margin: 0; color: #1a1a1a; font-weight: 700; white-space: nowrap; }
#logo { height: 40px; width: auto; display: block; }

/* ---------- Control "Medir distancia" (debajo del de capas) ---------- */
.control-medir { background: #fff; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,.3); }
.boton-medir {
  font: inherit; font-size: 12px; font-weight: 700; color: #1a1a1a;
  background: #fff; border: 0; border-radius: 8px; padding: 7px 11px;
  cursor: pointer; white-space: nowrap; display: block; text-align: center;
}
.boton-medir:hover { background: #f2f4f6; }
.boton-medir.activo { background: #0E86C4; color: #fff; }
.medida-total {
  font-size: 12px; font-weight: 800; color: #0E86C4; text-align: center;
  padding: 0 11px 7px; white-space: nowrap;
}
.medida-total:empty { display: none; }
.medida-tip {
  background: rgba(14,134,196,.92); color: #fff; border: 0; border-radius: 5px;
  font-size: 11px; font-weight: 700; padding: 2px 6px; box-shadow: none;
}
.medida-tip::before { display: none; }

/* ---------- Topbar (solo membrete de Gobierno + usuario/salir) ---------- */
#topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e2e2;
  padding: 0 24px;
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
#topbar #logo { height: 36px; }
#topbar #logoSube { height: 36px; width: auto; display: block; }
.topbar-titulos { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-titulos h1 { margin: 0; font-size: 16px; color: #1a1a1a; font-weight: 700; }
.topbar-titulos span { font-size: 11.5px; color: #666; }

/* ---------- Cuerpo: barra lateral de filtros + mapa ---------- */
#body { flex: 0 0 auto; display: flex; min-height: 420px; }
#body.body-mapa { flex: 1 1 0%; min-height: 0; overflow: hidden; }
#sidebar {
  position: fixed; top: 68px; left: 0; bottom: 0; z-index: 900;
  width: 360px; min-width: 360px;
  background: #fafbfc;
  border-right: 1px solid #e2e2e2;
  padding: 18px 16px;
  overflow-y: auto;
}
.sidebar-title { font-size: 15px; margin: 0 0 16px; color: #1a1a1a; }
.filtro-grupo { margin-bottom: 16px; }
.filtro-grupo > label {
  display: block; font-size: 12px; font-weight: 700; color: #555;
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px;
}
.line-count-badge { font-weight: 400; text-transform: none; color: #0b6efd; }
.capa-check {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: #333;
  font-weight: 400; text-transform: none; letter-spacing: normal;
  padding: 4px 0; cursor: pointer;
}
.capa-check input { margin: 0; }
.filtro-grupo select, .filtro-grupo input[type=date], .filtro-grupo input[type=time] { width: 100%; }
.filtro-fila { display: flex; gap: 8px; }
.filtro-fila input { flex: 1; min-width: 0; }
.btn-buscar-tarjeta { flex: 0 0 auto; padding: 6px 14px; white-space: nowrap; }
.filtro-acciones { display: flex; gap: 8px; margin-bottom: 14px; }
.filtro-acciones button { flex: 1; }
.btn-zona { width: 100%; margin-bottom: 14px; text-align: center; }
.sidebar-counter { font-size: 12.5px; color: #555; padding-top: 6px; border-top: 1px solid #eee; }

/* ---------- Modal de carga (estilo Trx) ---------- */
#cargaModal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9999; display: flex; align-items: center; justify-content: center; }
#cargaModal[hidden] { display: none; }
.carga-box { background: #fff; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.3); padding: 24px 28px; width: 340px; text-align: center; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.carga-box .carga-titulo { font-size: 15px; font-weight: 700; color: #1a5276; margin-bottom: 14px; }
.carga-barra { height: 14px; background: #eaf0f5; border-radius: 7px; overflow: hidden; margin-bottom: 8px; }
.carga-barra-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #2a6f97, #48a0d0); border-radius: 7px; transition: width .2s ease; }
.carga-barra-fill.indet { width: 100%; animation: cargaIndet 1.4s ease-in-out infinite; }
@keyframes cargaIndet { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.carga-pct { font-size: 13px; font-weight: 700; color: #2c3e50; }

select, input[type=date], input[type=time], input[type=text] {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
button {
  padding: 7px 14px;
  border: 1px solid #0b6efd;
  border-radius: 6px;
  font-size: 13px;
  background: #0b6efd;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: #0958cc; }
#btnLimpiar { background: #fff; color: #0b6efd; }
#btnLimpiar:hover { background: #eef4ff; }
#counter { font-size: 12px; color: #666; white-space: nowrap; }
.spacer { flex: 1 1 auto; }
.user-tag { font-size: 12px; color: #444; white-space: nowrap; }
.btn-link {
  font-size: 12px;
  color: #0b6efd;
  text-decoration: none;
  border: 1px solid #0b6efd;
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
}
.btn-link:hover { background: #eef4ff; }
.btn-topbar {
  background: #fff; color: #0b6efd; border: 1px solid #0b6efd;
  border-radius: 6px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.btn-topbar:hover { background: #eef4ff; }
#mapWrap { position: relative; flex: 1 1 0%; min-height: 0; margin-left: 360px; }
#map { position: absolute; inset: 0; background: #ffffff; }
.leaflet-control-container .leaflet-top.leaflet-right { display: flex; flex-direction: column; align-items: flex-end; }
.leaflet-control-container .leaflet-top.leaflet-right .leaflet-control-zoom { order: 2; }
.leaflet-control-container .leaflet-top.leaflet-right .leaflet-control-layers { order: 3; }
.leaflet-control-container .leaflet-top.leaflet-right .leaflet-draw { order: 1; }
.leaflet-container { background: #ffffff !important; }

/* ---------- Selector de líneas (ahora fijo en la barra lateral) ---------- */
.lineas-drop { position: relative; }
.drop-toggle { width: 100%; background: #fff; color: #0b6efd; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; }
.drop-toggle:hover { background: #eef4ff; color: #0b6efd; }
.drop-caret { font-size: 11px; opacity: .8; }
.drop-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 610;
  background: #fff; border: 1px solid #dbe3ea; border-radius: 8px; padding: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.16);
}
.drop-pop[hidden] { display: none; }
.drop-pop .line-search { width: 100%; margin-bottom: 6px; }
.drop-pop .dropdown-actions { margin: 6px 0; }
.drop-pop .line-check-list { max-height: 40vh; background: #fff; padding: 6px; }
.drop-pop .line-check-row { gap: 7px; padding: 4px 5px; font-size: 12px; align-items: flex-start; }
.drop-pop .line-check-row .line-dot { flex-shrink: 0; margin-top: 2px; }
.drop-pop .line-check-row input { flex-shrink: 0; margin: 0; }
.drop-pop .line-check-row span:last-child { min-width: 0; line-height: 1.35; }
.drop-pop .line-check-row .cc-cod { flex-shrink: 0; font-weight: 700; color: #E8650A; }
.dropdown-actions { display: flex; gap: 6px; margin: 8px 0; }
.dropdown-actions button {
  flex: 1; font-size: 11px; padding: 5px; background: #fff; color: #0b6efd;
}
.line-check-list { max-height: 320px; overflow-y: auto; border: 1px solid #e2e2e2; border-radius: 6px; padding: 4px; background: #fff; }
.line-check-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; font-size: 12.5px; cursor: pointer; border-radius: 4px;
}
.line-check-row:hover { background: #f5f7fa; }
.line-check-row input { margin: 0; }
.line-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* ---------- Leyenda de colores por línea ---------- */
#legend {
  position: absolute; bottom: 20px; left: 10px; z-index: 500;
  background: rgba(255,255,255,0.95); border: 1px solid #ddd; border-radius: 8px;
  padding: 8px 10px; font-size: 12px; max-height: 200px; overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.legend-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.legend-nota { font-size: 11px; color: #777; font-style: italic; margin-top: 4px; }

/* ---------- Botón "Zona" (dibujar polígono) ---------- */
#btnZona { background: #fff; color: #0b6efd; }
#btnZona:hover { background: #eef4ff; }
#btnZona.activo { background: #0b6efd; color: #fff; }

/* ---------- Panel de resultados de zona ---------- */
#zonaPanel {
  position: absolute; top: 10px; right: 10px; z-index: 500;
  background: #fff; border: 1px solid #ddd; border-radius: 8px;
  width: 260px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.zona-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid #eee; font-size: 13px;
}
.zona-header button {
  background: #fff; border: 1px solid #d0d4da; border-radius: 6px; color: #444;
  cursor: pointer; font-size: 11.5px; font-weight: 700; padding: 4px 8px;
  white-space: nowrap;
}
.zona-header button:hover { background: #f3f4f6; border-color: #b9bec6; }
#zonaContenido { padding: 10px; font-size: 12.5px; }
.zona-total { font-weight: 700; margin-bottom: 6px; }
.zona-nota { color: #b3261e; font-size: 11px; margin-bottom: 6px; }
.zona-tabla { width: 100%; border-collapse: collapse; margin-top: 6px; }
.zona-tabla th, .zona-tabla td { text-align: left; padding: 3px 4px; border-bottom: 1px solid #f0f0f0; }

/* ---------- Cartel informativo (línea/fecha/horario/total filtrados) ---------- */
#infoCard {
  position: absolute; top: 10px; left: 10px; z-index: 500;
  background: rgba(255,255,255,0.97); border: 1px solid #ddd; border-radius: 8px;
  padding: 10px 14px; font-size: 12.5px; max-width: 320px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
#infoCard .info-linea { padding: 2px 0; color: #333; }
#infoCard .info-linea b { color: #555; }
#infoCard .info-total { margin-top: 6px; font-weight: 700; color: #e2620d; font-size: 13.5px; }
#infoCard .info-contratos { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #ddd; max-height: 250px; overflow-y: auto; }
#infoCard .info-contratos-titulo { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #555; margin-bottom: 4px; }
#infoCard .contrato-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12.5px; padding: 2px 0; color: #333; }
#infoCard .contrato-cant { font-weight: 700; color: #e2620d; white-space: nowrap; }

/* ---------- Modal de tabla de transacciones ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(20,20,30,0.5);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay[hidden] { display: none !important; }
.modal-box {
  background: #fff; border-radius: 10px; width: 92%; max-width: 1100px;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid #eee; font-size: 15px;
}
.modal-header button { background: none; border: none; color: #888; cursor: pointer; font-size: 16px; padding: 0; }
.modal-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  border-bottom: 1px solid #eee; font-size: 12.5px; color: #555;
}
.modal-toolbar button {
  background: #e2620d; border-color: #e2620d; font-size: 12.5px; padding: 7px 12px;
}
.modal-toolbar button:hover { background: #c9550a; }
.modal-tabla-wrap { flex: 1; overflow: auto; padding: 0 20px; }
.tabla-mensaje {
  margin: 20px; padding: 16px; background: #fff7ed; border: 1px solid #fcd9b6;
  border-radius: 8px; color: #9a4a0a; font-size: 13px; line-height: 1.5;
}
#tablaTransacciones { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#tablaTransacciones th {
  position: sticky; top: 0; background: #f7f8fa; text-align: left; padding: 8px 6px; border-bottom: 2px solid #e2e2e2;
}
#tablaTransacciones td { padding: 6px; border-bottom: 1px solid #f0f0f0; }
.modal-paginacion {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px; border-top: 1px solid #eee; font-size: 12.5px;
}
.modal-paginacion button { background: #fff; color: #0b6efd; padding: 6px 12px; font-size: 12.5px; }
.modal-paginacion button:disabled { opacity: 0.4; cursor: default; }

/* ---------- Listado de transacciones debajo del mapa ---------- */
/* ---------- Panel: listado de transacciones (debajo del mapa) ---------- */
#listadoPanel {
  background: #fff; border-top: 2px solid #E8650A;
  display: flex; flex-direction: column; flex: 1 1 0%; min-height: 0;
  overflow-y: auto; margin-left: 360px;
}
#listadoPanel[hidden] { display: none !important; }
.listado-bar {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  padding: 10px 20px; border-bottom: 1px solid #eee; font-size: 14px;
}
.listado-resumen { font-size: 12.5px; color: #555; }
.listado-bar .btn-topbar { padding: 6px 12px; font-size: 12.5px; }
.listado-bar .btn-cerrar { color: #888; font-size: 15px; border: none; background: none; }
.listado-bar .btn-cerrar:hover { background: #f5f7fa; color: #333; }
.listado-tabla-wrap { flex: 1; overflow: auto; padding: 0 20px; }
#tablaListado { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#tablaListado th {
  position: sticky; top: 0; background: #f7f8fa; text-align: left;
  padding: 8px 6px; border-bottom: 2px solid #e2e2e2;
}
#tablaListado td { padding: 6px; border-bottom: 1px solid #f0f0f0; }
#tablaListado tbody tr { cursor: pointer; }
#tablaListado tbody tr:hover { background: #eef4ff; }
#tablaListado tbody tr.listado-fila-activa { background: #fdf3ec; }
.listado-pag {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-shrink: 0; padding: 10px; border-top: 1px solid #eee; font-size: 12.5px;
}
.listado-pag button { background: #fff; color: #0b6efd; padding: 6px 12px; font-size: 12.5px; }
.listado-pag button:disabled { opacity: 0.4; cursor: default; }

/* ---------- Panel inferior: pestañas (tipo de contrato / tarifa | listado) ---------- */
.panel-tabs {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 8px 16px; border-bottom: 1px solid #eee;
}
.panel-tab {
  border: 1px solid transparent; background: none; color: #444;
  padding: 7px 14px; font-size: 13px; font-weight: 600; border-radius: 8px;
  cursor: pointer; white-space: nowrap;
}
.panel-tab:hover { background: #f5f7fa; color: #0b6efd; }
.panel-tab.activa { background: #e8650a; color: #fff; border-color: #e8650a; }
.panel-tabs .btn-topbar { padding: 6px 12px; font-size: 12.5px; }
.panel-tabs .btn-cerrar { color: #888; font-size: 15px; border: none; background: none; }
.panel-tabs .btn-cerrar:hover { background: #f5f7fa; color: #333; }
.vista-panel {
  flex: 1 1 0%; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.vista-panel[hidden] { display: none !important; }
.contratos-resumen-row {
  display: flex; align-items: baseline; gap: 12px; flex-shrink: 0;
  padding: 8px 20px; border-bottom: 1px solid #f5f5f5; font-size: 12.5px;
}
.contratos-resumen { font-size: 12.5px; color: #555; }
.contratos-nota { font-size: 11.5px; color: #999; font-style: italic; }
.contratos-tabla-wrap { flex: 1; overflow: auto; padding: 0 20px 12px; }
#tablaPorDia { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
#tablaPorDia .col-cant, #tablaPorDia .col-monto { text-align: right; white-space: nowrap; font-size: 12.5px; }
#tablaPorDia th {
  position: sticky; top: 0; background: #f7f8fa; text-align: left;
  padding: 8px 6px; border-bottom: 2px solid #e2e2e2;
}
#tablaPorDia td { padding: 6px; border-bottom: 1px solid #f0f0f0; }
#tablaPorDia .col-dist { text-align: left; width: 40%; }
#tablaPorDia .pbar-td { display: flex; align-items: center; gap: 10px; }
#tablaPorDia .pbar {
  position: relative; flex: 1; height: 12px; max-width: 340px;
  background: #f0f0f0; border-radius: 6px; overflow: hidden;
}
#tablaPorDia .pbar-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, #f9a825, #e8650a); border-radius: 6px;
}
#tablaPorDia .pbar-pct { font-size: 11.5px; color: #666; min-width: 46px; text-align: right; white-space: nowrap; }
#tablaContratos { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#tablaContratos th {
  position: sticky; top: 0; background: #f7f8fa; text-align: left;
  padding: 8px 6px; border-bottom: 2px solid #e2e2e2;
}
#tablaContratos td { padding: 6px; border-bottom: 1px solid #f0f0f0; }
#tablaContratos .col-cant, #tablaContratos .col-monto { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#tablaContratos tbody tr.rc-otras { background: #fafafa; color: #666; font-style: italic; }
#tablaContratos tbody tr:hover { background: #f7f8fa; }

/* ---------- Barra de acciones debajo del mapa ---------- */
#accionesBar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; padding: 10px 20px;
  border-top: 1px solid #e2e2e2; border-bottom: 2px solid #E8650A;
  flex-shrink: 0;
}
.acciones-titulo { font-size: 14px; color: #1a1a1a; }

/* ---------- Asistente IA (chat flotante) ---------- */
#btnAsistenteFab {
  position: fixed; left: 16px; bottom: 18px; z-index: 940;
  background: #0b6efd; color: #fff; border: none; border-radius: 30px;
  padding: 10px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
#btnAsistenteFab:hover { background: #0958cc; }
#asistentePanel {
  position: fixed; left: 16px; bottom: 66px; z-index: 940;
  width: 400px; max-width: calc(100vw - 100px); min-width: 320px;
  height: 560px; max-height: calc(100vh - 96px);
  background: #fff; border: 1px solid #e2e2e2; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden;
}
#asistentePanel[hidden] { display: none !important; }
.asistente-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #1A1D2E; color: #fff; flex-shrink: 0; }
.asistente-head b { font-size: 14px; }
.asistente-st { font-size: 11px; color: rgba(255,255,255,.55); flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#btnAsistenteCerrar { background: none; border: none; color: #fff; font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
#btnAsistenteCerrar:hover { background: rgba(255,255,255,.15); }
#asistenteMsgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #f6f7f9; }
.asistente-msj { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.45; white-space: pre-line; word-wrap: break-word; }
.asistente-msj.usuario { align-self: flex-end; background: #0b6efd; color: #fff; border-bottom-right-radius: 3px; }
.asistente-msj.ia { align-self: flex-start; background: #fff; border: 1px solid #e4e6ea; border-bottom-left-radius: 3px; color: #222; }
#asistenteChips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid #eee; background: #fff; flex-shrink: 0; }
.asistente-chip {
  background: #eef4ff; color: #0b6efd; border: 1px solid #cfe0ff; border-radius: 16px;
  padding: 5px 10px; font-size: 11.5px; cursor: pointer;
}
.asistente-chip:hover { background: #dbe9ff; }
.asistente-entrada { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #eee; background: #fff; flex-shrink: 0; }
#asistenteInput { flex: 1; font-size: 13px; }
#btnAsistenteEnviar { border-radius: 8px; }
.asistente-tabla { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11.5px; }
.asistente-tabla th { text-align: left; padding: 4px 6px; border-bottom: 2px solid #e2e2e2; background: #f7f8fa; }
.asistente-tabla td { padding: 4px 6px; border-bottom: 1px solid #f0f0f0; }
.asistente-tabla .num { text-align: right; white-space: nowrap; }
.asistente-tabla tr.otras { background: #fafafa; color: #666; font-style: italic; }
.asistente-aplicar { margin-top: 10px; background: #E8650A; border: 1px solid #E8650A; border-radius: 6px; color: #fff; font-size: 12px; padding: 7px 12px; cursor: pointer; }
.asistente-aplicar:hover { background: #cf5506; }

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #161b2e;
}
.login-box {
  background: #fff;
  border-radius: 14px;
  width: 460px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

.login-banner {
  background: #e2620d;
  padding: 42px 40px;
  text-align: center;
}
.login-logos { display: flex; align-items: center; justify-content: center; gap: 18px; }
.login-logo-gs { height: 40px; width: auto; max-width: 210px; object-fit: contain; }
.login-logo-sube { height: 38px; width: auto; max-width: 110px; object-fit: contain; }
.login-logo-div { width: 1px; height: 34px; background: rgba(255,255,255,.55); flex-shrink: 0; }

.login-form-area { padding: 30px 40px 40px; }
.login-form-area label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #667085; margin: 16px 0 6px;
}
.login-form-area label:first-of-type { margin-top: 0; }
.login-form-area input {
  width: 100%; padding: 11px 12px; border: 1px solid #dbe3ee; border-radius: 8px;
  background: #eef4ff; font-size: 14px;
}
.login-form-area button {
  width: 100%; margin-top: 24px; padding: 13px; font-size: 15px;
  background: #e2620d; border-color: #e2620d; border-radius: 8px;
}
.login-form-area button:hover { background: #c9550a; }
.login-form-area .alert-error { margin-bottom: 4px; }
.alert-error {
  background: #fdecea;
  color: #b3261e;
  border: 1px solid #f5c2c0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 10px;
}
.alert-ok {
  background: #e7f7ec;
  color: #1e7a34;
  border: 1px solid #bfe6c9;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

/* ---------- Importar ---------- */
.import-wrap { max-width: 720px; margin: 30px auto; padding: 0 16px; }
.import-wrap h1 { font-size: 20px; }
.import-wrap table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; }
.import-wrap th, .import-wrap td { border-bottom: 1px solid #eee; padding: 6px 8px; text-align: left; }
.card {
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

/* ---------- Encabezado exclusivo para impresión ---------- */
.solo-impresion { display: none; }

/* ---------- Usuarios / Importar (estilo cortes1) ---------- */
.page-content { width: 100%; max-width: 980px; margin: 26px auto 40px; padding: 0 20px; }
.success-box { background: #e7f7ec; color: #1e7a34; border: 1px solid #bfe6c9; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.error-box { background: #fdecea; color: #b3261e; border: 1px solid #f5c2c0; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.error-box ul { margin: 0; padding-left: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #eee; }
.card-header h2 { font-size: 15px; margin: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #e2e2e2; background: #f7f8fa; font-weight: 700; color: #444; white-space: nowrap; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.data-table tr:hover td { background: #fafbfc; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-admin { background: #fdf3ec; color: #E8650A; }
.badge-operador { background: #eef4ff; color: #0b6efd; }
.badge-consulta { background: #eaf7ec; color: #15803D; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 200px; }
.form-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #666; margin-bottom: 6px; }
.form-control { width: 100%; padding: 9px 11px; border: 1px solid #cfd6e4; border-radius: 8px; font-size: 13px; background: #fff; color: #1a1a1a; }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }
.btn-secondary { background: #fff; color: #0b6efd; }
.btn-secondary:hover { background: #eef4ff; }
.filter-select { border: 1px solid #cfd6e4; border-radius: 6px; padding: 4px 8px; font-size: 12px; background: #fff; }
.topbar-title { font-size: 16px; font-weight: 700; color: #1a1a1a; white-space: nowrap; }
.muted { color: #6B7280; }

/* ---------- Móvil: menú lateral deslizable ---------- */
@media (max-width: 900px) {
  .sidebar-nav {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px; min-width: 260px;
    right: auto;
    z-index: 1000; transform: translateX(-100%); transition: transform .3s ease-in-out;
    flex-direction: column; align-items: stretch; overflow-x: hidden; overflow-y: auto;
    box-shadow: 4px 0 12px rgba(0,0,0,.3);
  }
  .sb-logo { padding: 16px 18px 14px; height: auto; border-right: none; border-bottom: 1px solid rgba(255,255,255,.25); flex-wrap: wrap; }
  .sb-section { flex-direction: column; align-items: stretch; gap: 0; padding: 16px 10px 4px; }
  .sb-section + .sb-section { border-left: none; margin-left: 0; padding-left: 10px; }
  .sb-section-label { display: block; }
  .sb-link { padding: 9px 10px; margin-bottom: 2px; }
  .sb-submenu { flex-direction: column; align-items: stretch; }
  .sb-submenu-list { position: static; flex-direction: column; align-items: stretch; box-shadow: none; background: rgba(0,0,0,.16); margin: 0 0 4px 14px; min-width: 0; }
  .sb-spacer { flex: 0; min-height: 0; }
  .sb-footer { margin-left: 0; margin-top: auto; padding: 10px; border-top: 1px solid rgba(255,255,255,.25); }
  .sb-user { padding: 8px 10px; }
  #app.show-sidebar-mobile .sidebar-nav { transform: translateX(0); }
  #app.show-sidebar-mobile::after {
    content: ''; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,.4); z-index: 999;
  }
  #app.show-sidebar-mobile #mainArea { pointer-events: none; }
  .btn-hamburger-mobile { display: block; }
  /* El menú pasa a un membrete fijo arriba; el botón queda dentro de él y se
     ocultan los que estaban sueltos en cada página. */
  #topbarMovil {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 960;
    background: linear-gradient(135deg, #0E86C4, #1EA0DA);
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    padding: 6px 10px;
  }
  #mainArea, #mainArea.main-area-mapa { padding-top: 52px; }
  #accionesBar .btn-hamburger-mobile,
  .btn-hamburger-flotante { display: none !important; }
  /* En el drawer solo los botones: logos y subtítulo van al membrete de arriba.
     Se conserva el pie con usuario y "Salir". */
  .sidebar-nav .sb-logo,
  .sidebar-nav .sb-sub { display: none; }
  .sidebar-nav .sb-section { padding-top: 12px; }
  #app { height: auto; min-height: 100vh; }
  #mainArea, #mainArea.main-area-mapa { margin-left: 0; height: auto; overflow: visible; }
  #topbar { height: auto; min-height: 52px; padding: 8px 14px; flex-wrap: wrap; }
  #topbar #logo, #topbar #logoSube { height: 32px; }
  .user-tag { display: none; }
  #body, #body.body-mapa { flex: none; flex-direction: column; height: auto; min-height: 0; overflow: visible; }
  #sidebar { position: static; width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid #e2e2e2; }
  #mapWrap { height: 50vh; min-height: 50vh; flex: none; margin-left: 0; }
  #listadoPanel { flex: none; margin-left: 0; }
  #btnAsistenteFab { left: 12px; bottom: 12px; }
  #asistentePanel { left: 12px; right: 12px; bottom: 62px; width: auto; max-width: none; min-width: 0; height: 60vh; }
}

/* ---------- Impresión de la pantalla del mapa filtrado ---------- */
@media print {
  @page { size: landscape; margin: 10mm; }

  #topbar, #sidebar, #legend, .modal-overlay, .sidebar-nav, #listadoPanel, #accionesBar, #btnAsistenteFab, #asistentePanel { display: none !important; }

  #app, #body, #body.body-mapa, #mainArea { display: block; height: auto; overflow: visible; flex: none; min-height: 0; }
  #mainArea { margin-left: 0 !important; padding-top: 0 !important; }
  #mapWrap { height: 180mm; margin-left: 0 !important; margin-right: 0 !important; page-break-inside: avoid; }
  #map { position: absolute; inset: 0; }

  .solo-impresion {
    display: flex; align-items: center; gap: 14px;
    padding-bottom: 10px; margin-bottom: 8px; border-bottom: 2px solid #e2620d;
  }
  .solo-impresion .print-logos { display: flex; align-items: center; gap: 20px; }
  .solo-impresion img.logo-gs { height: 46px; width: auto; }
  .solo-impresion img.logo-sube { height: 42px; width: auto; }
  .solo-impresion > div:last-child { margin-left: auto; text-align: right; }
  .print-titulo { font-size: 16px; font-weight: 800; color: #1a1a1a; }
  .print-fecha { font-size: 11px; color: #666; margin-top: 2px; }

  #infoCard {
    position: absolute; top: 46px; left: 0; z-index: 500;
    box-shadow: none; border: 1px solid #ccc;
  }
  #zonaPanel { box-shadow: none; border: 1px solid #ccc; top: 46px !important; }
}
