/* ═══════════════════════════════════════════════════════════════════
   geomapgis — Visor de escritorio
   ═══════════════════════════════════════════════════════════════════ */

body.viewer { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Estructura ────────────────────────────────────────────────── */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: var(--panel-l-w) minmax(0, 1fr) var(--panel-r-w);
  min-height: 0;
  transition: grid-template-columns .24s cubic-bezier(.4, 0, .2, 1);
}
.workspace.l-off { grid-template-columns: 0 minmax(0, 1fr) var(--panel-r-w); }
.workspace.r-off { grid-template-columns: var(--panel-l-w) minmax(0, 1fr) 0; }
.workspace.l-off.r-off { grid-template-columns: 0 minmax(0, 1fr) 0; }

.panel-l { border-right: 1px solid var(--line); }
.panel-r { border-left: 1px solid var(--line); }
.workspace.l-off .panel-l, .workspace.r-off .panel-r {
  opacity: 0; pointer-events: none; border: 0; visibility: hidden;
}
.panel-l, .panel-r { transition: opacity .18s ease; }

/* ── Mapa ──────────────────────────────────────────────────────── */
.map-wrap { position: relative; min-width: 0; background: #E7E3DA; }
#map { position: absolute; inset: 0; }

.map-toggle {
  /* a media altura: arriba a la derecha están los botones de zoom */
  position: absolute; top: 50%; margin-top: -23px; z-index: 620;
  width: 26px; height: 46px;
  display: grid; place-items: center;
  background: var(--s-panel);
  border: 1px solid var(--line-strong);
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: var(--sh-2);
  transition: color .13s, background .13s;
}
.map-toggle:hover { color: var(--brand-600); background: var(--s-hover); }
.map-toggle.left  { left: 0;  border-left: 0;  border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.map-toggle.right { right: 0; border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.map-toggle svg { transition: transform .22s ease; }
.workspace.l-off .map-toggle.left svg,
.workspace.r-off .map-toggle.right svg { transform: rotate(180deg); }

.map-tools {
  position: absolute; left: 12px; bottom: 34px; z-index: 620;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.basemap-switch {
  display: flex; padding: 3px; gap: 2px;
  background: rgba(244,242,237,.96);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
}
.basemap-switch button {
  height: 26px; padding: 0 11px;
  border: 0; border-radius: 0; background: transparent;
  font-size: 11.5px; font-weight: 500; color: var(--ink-3); cursor: pointer;
  transition: background .13s, color .13s;
}
.basemap-switch button:hover { color: var(--ink-2); }
.basemap-switch button.on { background: var(--ink); color: var(--ink-inv); }

/* ── Leaflet, adaptado al sistema ──────────────────────────────── */
.leaflet-container { font-family: var(--font-body); background: #E7E3DA; }
.leaflet-bar, .leaflet-control-zoom {
  border: 1px solid var(--line-strong) !important;
  border-radius: var(--r-sm) !important;
  box-shadow: var(--sh-2) !important;
  overflow: hidden;
}
.leaflet-bar a, .leaflet-control-zoom a {
  width: 30px !important; height: 30px !important; line-height: 30px !important;
  color: var(--ink-2) !important; background: var(--s-panel) !important;
  border-bottom-color: var(--line) !important; font-size: 17px !important;
}
.leaflet-bar a:hover { background: var(--s-hover) !important; color: var(--brand-600) !important; }
.leaflet-control-attribution {
  background: rgba(244,242,237,.9) !important;
  font-size: 10.5px !important; color: var(--ink-3) !important;
  padding: 2px 7px !important; border-radius: var(--r-sm) 0 0 0;
}
.leaflet-control-scale-line {
  border-color: var(--ink-3) !important; color: var(--ink-2) !important;
  background: rgba(244,242,237,.9) !important; font-family: var(--font-mono); font-size: 10px !important;
}
.leaflet-popup-content-wrapper {
  border-radius: 0 !important; box-shadow: none !important; padding: 0 !important;
  background: var(--s-panel) !important; border: 1px solid var(--line-strong);
}
.leaflet-popup-tip { background: var(--s-panel) !important; }
.leaflet-popup-content { margin: 0 !important; font-size: 12.8px; min-width: 210px; }
.leaflet-popup-tip { box-shadow: var(--sh-2); }
.pop { padding: 12px 14px; }
.pop h4 { font-family: var(--font-display); font-size: 13.5px; margin-bottom: 3px; }
.pop .meta { color: var(--ink-3); font-size: 11.5px; }
.pop .row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }

/* ── Panel izquierdo ───────────────────────────────────────────── */
.legend-row { display: flex; align-items: flex-start; gap: 9px; padding: 5px 0; font-size: 12.3px; color: var(--ink-2); }
.legend-key { width: 15px; height: 15px; border-radius: 0; flex: 0 0 15px; margin-top: 1px; border: 1px solid rgba(0,0,0,.14); }
.legend-key.round { border-radius: 50%; }
.legend-row b { color: var(--ink); font-weight: 600; }

.opacity-row { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.opacity-row .t-label { flex: 0 0 auto; }
.opacity-row output { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); width: 32px; text-align: right; }

/* ── Panel derecho: alertas ────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s-panel);
}
.stat .v { font-family: var(--font-mono); font-size: 21px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.stat .k { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.stat.l3 { border-color: #EFC9C9; background: var(--lv3-bg); } .stat.l3 .v { color: #8E2222; }
.stat.l2 { border-color: #F0CFBB; background: var(--lv2-bg); } .stat.l2 .v { color: #96471B; }
.stat.l1 { border-color: #EDDAA9; background: var(--lv1-bg); } .stat.l1 .v { color: #8A6412; }

.alert-list { display: grid; gap: 7px; }
.alert-item {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 10px 11px 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s-panel);
  cursor: pointer;
  transition: border-color .13s, box-shadow .13s, transform .08s;
}
.alert-item:hover { border-color: var(--brand-600); }
.alert-item.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.alert-item .rail { align-self: stretch; border-radius: var(--r) 0 0 var(--r); }
.alert-item .rail.l1 { background: var(--lv1) } .alert-item .rail.l2 { background: var(--lv2) } .alert-item .rail.l3 { background: var(--lv3) }
.alert-item .ttl { font-size: 13px; font-weight: 500; color: var(--ink); }
.alert-item .ttl .id { font-family: var(--font-mono); color: var(--ink-3); font-weight: 500; margin-right: 5px; }
.alert-item .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.alert-item .vflag { font-size: 10px; color: var(--ok); margin-top: 3px; display: inline-flex; gap: 4px; align-items: center; }

/* ── Ficha de alerta ───────────────────────────────────────────── */
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding-bottom: 11px; margin-bottom: 11px; border-bottom: 1px solid var(--line);
}
.detail-head h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.15; letter-spacing: -.022em; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.events { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 6px; max-height: 128px; overflow-y: auto; }
.event { display: grid; grid-template-columns: 62px 1fr; gap: 9px; font-size: 11.5px; color: var(--ink-3); }
.event time { font-family: var(--font-mono); font-size: 10.5px; }

/* ── Gráfica ───────────────────────────────────────────────────── */
.chart-box { position: relative; height: 168px; margin-top: 10px; }
.chart-empty { display: grid; place-items: center; height: 168px; color: var(--ink-3); font-size: 12.3px; text-align: center; padding: 0 20px; }

/* ── Informes ──────────────────────────────────────────────────── */
.report-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: var(--r-sm);
  font-size: 12.5px; transition: background .12s;
}
.report-row:hover { background: var(--s-hover); }
.report-row .ic { color: var(--brand-600); flex: 0 0 auto; display: grid; place-items: center; }
.report-row .nm { flex: 1; min-width: 0; }
.report-row .dt { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

/* ── Barra de estado ───────────────────────────────────────────── */
.statusbar {
  height: var(--statusbar-h);
  flex: 0 0 var(--statusbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px;
  background: var(--s-panel);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.statusbar .sep { width: 1px; height: 13px; background: var(--line); }
.statusbar .push { margin-left: auto; }
.statusbar .coords { font-family: var(--font-mono); font-size: 11px; }
.dotlight { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: 0 0 7px; }
.dotlight.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.dotlight.busy { background: var(--warn); box-shadow: 0 0 0 3px #FCF0DC; }
.dotlight.err { background: var(--lv3); box-shadow: 0 0 0 3px var(--lv3-bg); }

/* ── Menú de usuario ───────────────────────────────────────────── */
.usermenu { position: relative; }
.usermenu-pop {
  position: absolute; right: 0; top: calc(100% + 7px);
  min-width: 194px;
  background: var(--s-panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-3);
  padding: 5px;
  z-index: 950;
  animation: rise .14s ease;
  color: var(--ink);
}
.topbar .usermenu-pop .t-label { color: var(--ink-3); }
.usermenu-pop .who { padding: 9px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.usermenu-pop .who b { display: block; font-size: 13px; }
.usermenu-pop a, .usermenu-pop button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); font-size: 12.8px;
  text-align: left; cursor: pointer; text-decoration: none;
}
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--s-hover); color: var(--ink); text-decoration: none; }

/* ── Adaptación a pantallas menores ────────────────────────────── */
@media (max-width: 1280px) {
  :root { --panel-l-w: 240px; --panel-r-w: 330px; }
}
@media (max-width: 1040px) {
  .workspace { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .panel-l, .panel-r {
    position: absolute; top: var(--topbar-h); bottom: var(--statusbar-h); z-index: 1100;   /* encima de los controles de Leaflet */
    width: min(88vw, 330px); box-shadow: var(--sh-3); visibility: visible; opacity: 1;
  }
  .panel-l { left: 0; } .panel-r { right: 0; }
  .workspace:not(.l-open) .panel-l { transform: translateX(-102%); opacity: 0; pointer-events: none; }
  .workspace:not(.r-open) .panel-r { transform: translateX(102%); opacity: 0; pointer-events: none; }
  .panel-l, .panel-r { transition: transform .22s ease, opacity .18s ease; }
  .brand-text, .topbar-link.ext { display: none; }
}
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 11px; }
  .brand-logo { height: 30px; }
  .kpis { display: none; }
}

/* ── Barra del tiempo de una alerta ────────────────────────────── */
#timebar-host {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 12px; z-index: 640;
  width: min(660px, calc(100% - 76px));
}
.timebar {
  background: rgba(244, 242, 237, .97);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  padding: 10px 13px 11px;
  animation: rise .18s ease;
}
.timebar.empty-bar { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.timebar code { font-family: var(--font-code); font-size: 11px; background: var(--s-sunken); padding: 1px 5px; border-radius: 0; }

.tb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.tb-layers { flex: 0 0 auto; }
.tb-layers button { padding: 0 10px; font-size: 11.5px; }
.tb-when { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.tb-when b { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.tb-ctl { flex: 0 0 auto; display: flex; gap: 2px; }
.tb-ctl .btn { width: 26px; height: 26px; font-size: 14px; }

/* Gráfico del índice en el polígono, alineado con la pista */
.tb-serie { position: relative; margin: 0 2px 2px; }
.tb-serie-tit { font-size: 11px; font-weight: 600; color: var(--ink-2); margin-bottom: 1px; }
.tb-serie-lienzo { position: relative; height: 78px; }
.tb-serie-vacia { padding: 4px 0 6px; }

/* Pista: una marca por fecha disponible */
.tb-track {
  position: relative;
  display: flex; align-items: center; gap: 2px;
  height: 26px;
  padding: 0 2px;
}
.tb-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; background: var(--line); border-radius: 2px;
}
.tb-tick {
  position: relative; flex: 1 1 0; min-width: 0; height: 26px;
  border: 0; background: none; cursor: pointer; padding: 0;
}
.tb-tick .pin {
  position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--nav);
  border: 2px solid var(--s-panel);
  transition: transform .12s, background .12s;
}
.tb-tick:hover .pin { transform: scale(1.35); }
.tb-tick.parcial  .pin { background: #9FB4C7; }     /* algo de nube   */
.tb-tick.nublada  .pin { background: #E2E8EF; }     /* escena tapada  */
.tb-tick.sin-capa .pin { background: #fff; border-color: var(--line-strong); }
.tb-tick.sin-imagen .pin { background: repeating-linear-gradient(45deg, #B8C4D2 0 2px, #fff 2px 4px); border-color: #fff; }
.tb-tick.deteccion .pin { box-shadow: 0 0 0 2px var(--lv3); }
.tb-tick.actual .pin {
  width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
  background: var(--ink); border-color: #fff;
  box-shadow: 0 0 0 2px var(--ink);
}

/* Meses bajo la pista: la etiqueta aparece en la primera fecha de cada mes */
.tb-meses { display: flex; gap: 2px; padding: 0 2px; height: 13px; margin-top: -2px; }
.tb-meses span { flex: 1 1 0; min-width: 0; overflow: visible; white-space: nowrap;
  font-size: 10.5px; line-height: 13px; color: var(--ink-3); text-transform: capitalize;
  text-indent: calc(50% - 5px); }
.tb-foot { margin-top: 7px; line-height: 1.45; min-height: 17px; }
.tb-leyenda { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; color: var(--ink-3); font-size: 11.5px; }
.tb-leyenda i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px;
  vertical-align: -1px; background: var(--nav); }
.tb-leyenda i.det { box-shadow: 0 0 0 2px var(--lv3); }
.tb-leyenda i.parcial { background: #9FB4C7; }
.tb-leyenda i.nublada { background: #E2E8EF; border: 1px solid var(--line-strong); }
.tb-leyenda i.sinimg { background: repeating-linear-gradient(45deg, #B8C4D2 0 2px, #fff 2px 4px); border: 1px solid var(--line-strong); }
.tb-leyenda i.sincapa { background: #fff; border: 1px solid var(--line-strong); }
.tb-foot .aviso { color: var(--warn); font-weight: 500; }

@media (max-width: 720px) {
  #timebar-host { width: calc(100% - 24px); bottom: 8px; }
  .tb-head { flex-wrap: wrap; gap: 8px; }
  .tb-when { order: 3; flex-basis: 100%; }
}

/* Rótulo al pasar sobre una zona o celda */
.leaflet-tooltip.tt-unidad {
  font-family: var(--font-body); font-size: 11.5px; font-weight: 500;
  color: var(--ink); background: rgba(244,242,237,.97);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  box-shadow: var(--sh-2); padding: 3px 8px;
}
.leaflet-tooltip.tt-unidad::before { display: none; }

/* ── Áreas del usuario ─────────────────────────────────────────── */
.area-name { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.area-actions, .area-new { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.area-new { padding-top: 11px; border-top: 1px dashed var(--line); }
.area-aviso { margin-top: 8px; padding: 6px 9px; font-size: 12px; color: var(--ink-2);
  background: var(--lv1-bg); border-left: 3px solid var(--lv1); }
.form-err { margin-top: 6px; font-size: 12.5px; color: var(--brand-600); }
.modal.modal-wide { width: min(600px, 100%); }
.modal-body { max-height: calc(100vh - 200px); overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 13px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.file-drop { display: flex; align-items: center; justify-content: center; min-height: 64px; margin-top: 12px;
  border: 1px dashed var(--line-strong); background: var(--s-input); cursor: pointer; font-size: 13px; color: var(--ink-2); }
.file-drop:hover { border-color: var(--brand-600); color: var(--ink); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.import-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.import-item { padding: 8px 10px; border: 1px solid var(--line); background: var(--s-input); font-size: 13px; }
.import-item.bad { background: var(--s-sunken); }
.import-head { display: flex; justify-content: space-between; gap: 10px; }
.import-head span { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }

/* Barra de instrucciones al dibujar o editar una forma */
.editbar {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 650;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 90px);
  padding: 9px 12px; background: var(--s-dark); color: var(--ink-inv); font-size: 13px;
}
.editbar .txt { flex: 1; min-width: 0; }
.editbar .btn { background: transparent; color: var(--ink-inv); border-color: var(--line-on-dark); }
.editbar .btn:hover { background: var(--ink-inv); color: var(--ink); }
.editbar .btn-primary { background: var(--brand); border-color: var(--brand); }

/* Pantalla de ingreso */
.gate { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 20px;
  background: rgba(244, 242, 237, .94); }
.gate-card { width: min(400px, 100%); display: grid; gap: 14px; padding: 28px 28px 24px;
  background: var(--s-app); border: 1px solid var(--line); }
.gate-logo { height: 34px; width: auto; justify-self: start; }
.gate-kicker { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .15em;
  text-transform: uppercase; color: var(--brand-600); margin-top: 6px; }
.gate-card h1 { font-size: 30px; font-weight: 600; margin: -4px 0 4px; }

/* ── Histórico a pedido ────────────────────────────────────────── */
.pedido { display: grid; gap: 7px; padding: 10px 11px; border: 1px solid var(--line); background: var(--s-input); }
.pedido .btn { justify-self: start; }
.pedido-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pedido-etapa { color: var(--ink-2); }
.pedido-barra { height: 6px; background: var(--s-sunken); overflow: hidden; position: relative; }
.pedido-barra span { display: block; height: 100%; background: var(--nav); transition: width .4s ease; }
.pedido-barra.indet span { position: absolute; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { from { left: -30% } to { left: 100% } }
label.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }

/* ── Imágenes del área y curva ─────────────────────────────────── */
.fotobar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 645;
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: rgba(244, 242, 237, .97); border: 1px solid var(--line-strong);
  max-width: calc(100% - 80px);
}
.fotobar .fb-capas { flex: 0 0 auto; }
.fotobar .fb-capas button { padding: 0 9px; }
.fotobar .fb-capas button:disabled { opacity: .35; cursor: not-allowed; }
.fotobar .fb-fecha { display: flex; flex-direction: column; min-width: 150px; line-height: 1.3; }
.fotobar .fb-fecha b { font-family: var(--font-mono); font-weight: 500; }
.chart-nota { margin-top: 4px; min-height: 16px; }
.sw-temp { display: inline-block; width: 14px; height: 9px; background: rgba(231, 227, 218, .9);
  border: 1px solid var(--line-strong); vertical-align: -1px; }
.modal.modal-xl { width: min(980px, 100%); }
.chart-grande { position: relative; height: min(440px, 60vh); }
.chart-box { height: 190px; }
.area-actions .btn-pdf { margin-left: auto; }
.leaflet-interactive:focus { outline: none; }   /* el navegador dibujaba un recuadro naranja al hacer clic */

/* ── Focos de calor ────────────────────────────────────────────── */
.foco-marca svg { display: block; fill: #9A3412; stroke: #fff; stroke-width: 1.4; paint-order: stroke; }
.foco-marca.cerca svg { opacity: .5; }
.focos-lista { display: grid; gap: 3px; max-height: 220px; overflow-y: auto; }
.foco-item { display: grid; grid-template-columns: 10px 1fr auto; gap: 7px; align-items: center; font-size: 12px; }
.focos-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 6px; }
.foco-info { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 1px 6px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); cursor: pointer; }
.foco-info:hover, .foco-info.on { border-color: var(--ink); color: var(--ink); }
.foco-detalle { margin: 4px 0 6px 17px; font-size: 11.5px; line-height: 1.45; color: var(--ink-2); display: grid; gap: 5px; }
.foco-detalle.hidden { display: none; }
.focos-pais { margin-top: 10px; display: grid; gap: 4px; }
.focos-pais-ctl { display: flex; gap: 6px; }
.focos-pais-ctl select, .focos-pais-ctl input { font: inherit; font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--line-strong);
  background: var(--s-card); color: var(--ink); min-width: 0; }
.legend-key.foco-pais-ley { background: #C2410C; border-radius: 50%; transform: scale(.6); }
.foco-item .t-num { font-size: 11.5px; }
.foco-ic { width: 8px; height: 8px; background: #9A3412; }
.foco-ic.cerca { opacity: .45; }
.foco-nota { margin-top: 6px; line-height: 1.4; }
.sw-foco { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 7px solid #9A3412; vertical-align: 0; }
.legend-key.foco-ley { background: #9A3412; border-radius: 50% 50% 50% 0; transform: rotate(-45deg) scale(.8); }
.tb-tick.foco::after { content: ""; position: absolute; left: 50%; top: 0; margin-left: -3px;
  border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 5px solid #9A3412; }
.tb-leyenda i.foco { width: 0; height: 0; border-radius: 0; background: none; border-left: 4px solid transparent;
  border-right: 4px solid transparent; border-top: 7px solid #9A3412; }
.agua-ic { width: 8px; height: 8px; background: #1F6FD1; border-radius: 50%; }
.quemado-ic { width: 8px; height: 8px; background: #D64A25; transform: rotate(45deg); }
.foco-item.quemado-item { align-items: start; }
.foco-item.quemado-item .quemado-ic { margin-top: 4px; }
.foco-acciones { display: inline-flex; gap: 4px; }
.en-eval { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; border: 1px solid var(--line-strong);
  padding: 0 5px; margin-left: 4px; color: var(--ink-2); }
.tabla-clases { border-collapse: collapse; margin-bottom: 4px; }
.tabla-clases td { padding: 1px 8px 1px 0; }
.tabla-clases i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; vertical-align: -1px; }
.quemado-pedir { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.quemado-pedir input { font: inherit; font-size: 12px; padding: 2px 4px; border: 1px solid var(--line-strong); background: var(--s-card); }

/* ── Mis áreas (panel izquierdo) ───────────────────────────────── */
.cartera-head { padding: 13px 15px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 9px; }
.cartera-head .section-head { margin-bottom: 0; }
.cartera-head .area-new { margin-top: 0; padding-top: 0; border-top: 0; }
.ca-buscar { width: 100%; font-size: 13px; }
.ca-filtros { display: flex; flex-wrap: wrap; gap: 5px; }
.ca-filtros .chip { cursor: pointer; }
.ca-filtros .chip b { font-weight: 600; color: var(--ink); }
.ca-filtros .chip.on { background: var(--ink); color: var(--ink-inv); border-color: var(--ink); }
.ca-filtros .chip.on b { color: var(--ink-inv); }
.ca-orden { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.ca-orden .select { height: 26px; font-size: 12px; width: auto; }
.ca-lista { flex: 1; min-height: 0; }
.ca-item { width: 100%; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 9px; align-items: center;
  padding: 9px 15px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left;
  cursor: pointer; font: inherit; color: var(--ink); }
.ca-item:hover { background: var(--s-hover); }
.ca-item.sel { background: var(--s-sunken); box-shadow: inset 3px 0 0 var(--brand-600); }
.ca-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; border: 1.5px solid var(--ink-3); }
.ca-dot.l1 { background: var(--lv1); border-color: var(--lv1); }
.ca-dot.l2 { background: var(--lv2); border-color: var(--lv2); }
.ca-dot.l3 { background: var(--lv3); border-color: var(--lv3); }
.ca-txt { display: grid; min-width: 0; }
.ca-nombre { font-size: 13.2px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-ins { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 120px; }
.ca-ins .badge { font-size: 10px; padding: 1px 6px; }
.ca-foco { font-family: var(--font-mono); font-size: 10.5px; color: #9A3412; padding-left: 11px; position: relative; }
.ca-foco::before { content: ""; position: absolute; left: 0; top: 3px; width: 7px; height: 7px; background: #9A3412; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.ca-proc, .ca-sin { font-family: var(--font-mono); font-size: 10px; letter-spacing: .03em; color: var(--ink-3); white-space: nowrap; }
.ca-proc { color: var(--nav, #0A62B0); }
.ca-sin.err { color: var(--brand-600); }

/* ── Control «Capas y leyenda» ─────────────────────────────────── */
.capas-ctl { position: absolute; top: 12px; left: 12px; z-index: 640; }
.capas-btn { display: inline-flex; align-items: center; gap: 7px; background: rgba(244,242,237,.97); }
.capas-btn.on { background: var(--ink); color: var(--ink-inv); border-color: var(--ink); }
.capas-pop { margin-top: 6px; width: 320px; max-height: calc(100vh - 210px); padding: 13px 15px;
  background: var(--s-panel); border: 1px solid var(--line-strong); box-shadow: 0 6px 24px rgba(8,17,20,.14); }
.capas-pop > .t-label:first-child { margin-bottom: 6px; }
.capas-sub { margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.legend-key.ley-area { background: rgba(42,58,63,.05); border: 1.3px solid #2A3A3F; }
.map-tools { z-index: 630; }

/* ── Ficha del área (panel derecho) ────────────────────────────── */
.ficha-vacia { padding: 16px 15px; }
.ficha-vacia p { margin: 6px 0 14px; line-height: 1.5; }
.cr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cr { display: grid; gap: 2px; padding: 10px 11px; border: 1px solid var(--line); background: var(--s-panel); text-align: left;
  font: inherit; color: var(--ink); }
button.cr { cursor: pointer; }
button.cr:hover { background: var(--s-hover); }
.cr b { font-family: var(--font-mono); font-size: 18px; font-weight: 500; }
.cr span { font-size: 11.5px; color: var(--ink-2); }
.cr:first-child { grid-column: 1 / -1; }
.cr.cero { opacity: .55; }
.ficha-area { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ficha-area.hidden { display: none; }
.ficha-head { padding: 13px 15px 11px; border-bottom: 1px solid var(--line); }
.fh-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.fh-txt { min-width: 0; }
.fh-acciones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 9px; }
.tabs button { flex: 1; padding: 10px 6px 9px; border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand-600); }
.tab-n { font-family: var(--font-mono); font-size: 10.5px; color: var(--brand-600); }
.tab-body { flex: 1; min-height: 0; }
.tab-pane.hidden { display: none; }
.tab-pane[data-pane="eventos"], .tab-pane[data-pane="datos"] { padding: 2px 15px 16px; }
.tab-pane[data-pane="datos"] { padding-top: 13px; }
#pedido-box:empty { display: none; }
#pedido-box { padding: 0 15px 12px; border-bottom: 1px solid var(--line); }
.sb-ayuda { display: none; }
@media (max-width: 480px) {
  .topbar-link.ayuda { display: none; }
  .sb-ayuda { display: inline; }
  .statusbar .coords { display: none; }
}

/* ── Pestañas del panel izquierdo y «Detectar» ─────────────────── */
.tabs-l { padding: 0 9px; flex: 0 0 auto; }
.l-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.l-pane.hidden { display: none; }
.det-form { display: grid; gap: 11px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.det-form .segmented { display: flex; }
.det-form .segmented button { flex: 1; }
.det-fechas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.det-fechas.hidden { display: none; }
#det-res { padding: 12px 15px 16px; }
.det-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 8px; }
.det-head .foco-info { margin-left: auto; }
.det-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; margin: 8px 0; }
.det-resumen .cr:first-child { grid-column: auto; }
.det-orden { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin: 8px 0 4px; }
.det-orden .select { height: 26px; font-size: 12px; width: auto; }
.det-lista { border-top: 1px solid var(--line); }
.det-item { width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 4px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.det-item:hover { background: var(--s-hover); }
.det-item.sel { background: var(--s-sunken); box-shadow: inset 3px 0 0 var(--brand-600); }
.det-ic { justify-self: center; width: calc(var(--r, 6px) * 2); height: calc(var(--r, 6px) * 2); border-radius: 50%;
  background: rgba(234,88,12,.45); border: 1.5px solid #7C2D12; }
.det-ic.agua { --r: 7px; background: rgba(31,111,209,.45); border-color: #0A3F7A; }
.det-ic.agua.vacio { background: transparent; border-color: var(--ink-3); }
.det-areas { font-size: 11.5px; color: var(--brand-600); }
.det-areas.err { color: var(--brand-600); }
.det-mas { margin-top: 8px; width: 100%; }
.capas-nota { margin: 6px 0 2px; line-height: 1.4; }
.legend-key.ley-incendio { background: rgba(234,88,12,.45); border: 1.5px solid #7C2D12; border-radius: 50%; }
.legend-key.ley-agua { background: rgba(31,111,209,.45); border: 1.5px solid #0A3F7A; border-radius: 50%; }

/* ── Filtros de falsos positivos en «Detectar» ─────────────────── */
.det-filtros { display: grid; gap: 4px; margin: 4px 0 6px; font-size: 12px; color: var(--ink-2); }
.det-filtros label { display: flex; align-items: center; gap: 6px; }
.det-filtros b { font-family: var(--font-mono); font-weight: 500; color: var(--ink-3); }
.det-conf .select { height: 24px; font-size: 11.5px; width: auto; margin-left: auto; }
.det-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .03em; padding: 0 5px; border: 1px solid #B85A27; color: #96471B; }
.tag.gris { border-color: var(--ink-3); color: var(--ink-2); background: var(--s-sunken); }
.tag.claro { border-color: var(--line-strong); color: var(--ink-3); }
.det-cicatriz { font-size: 11.5px; color: #7C2D12; }
.legend-key.ley-borde { background: transparent; border: 2.5px solid; }
.leaflet-p-cartera-pane.solo-borde path.leaflet-interactive { pointer-events: visibleStroke; }
.det-imagen { margin: 6px 0 2px; padding: 8px 10px; border-left: 3px solid var(--brand-600); background: var(--s-sunken); }
.det-imagen .btn { margin-top: 6px; }

/* Temporada por cultivo */
.cv-cab { margin: 10px 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cv-cab .select { width: auto; }
.cv-resumen { margin: 6px 0 10px; padding: 8px 10px; border-left: 3px solid var(--brand-600); background: var(--s-sunken); }
.cv-resumen p { margin: 0 0 6px; font-size: 13px; line-height: 1.4; }
.cv-resumen p:last-child { margin-bottom: 0; }
.cv-graf { position: relative; height: 230px; margin-top: 4px; }
.cv-leyenda { margin: 4px 0 10px; }
.cv-tabla { width: 100%; border-collapse: collapse; font-size: 12px; }
.cv-tabla th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 11px; padding: 4px 4px; border-bottom: 1px solid var(--line); }
.cv-tabla td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cv-tabla tbody tr { cursor: pointer; }
.cv-tabla tbody tr:hover { background: var(--s-hover); }
.cv-lote { font-weight: 500; }
.cv-dif { display: inline-block; font-size: 10.5px; padding: 0 5px; border-radius: 3px; white-space: nowrap; }
.cv-dif.antes { background: #E3EEF5; color: #1F5F8B; }
.cv-dif.despues { background: var(--lv2-bg); color: #9A4A1E; }
.cv-dif.igual { background: var(--s-sunken); color: var(--ink-2); }
.cv-nota { margin-top: 10px; line-height: 1.4; }
.tabs-l [data-ltab] { flex: 1; }
#cv-res { padding: 0 15px 16px; }
.cv-graf-cab { display: flex; justify-content: flex-end; }
