html { height: 100%; }
/* ============================================================
   GEORECICLA SDSS V1 — Diseño Institucional
   Administración Pública y Educativa
   Paleta: azul institucional + verde gestión + gris neutro
   Tipografía: Inter (cuerpo) + JetBrains Mono (datos)
   Modo claro por defecto | scroll nativo en panel lateral
   ============================================================ */

/* ── VARIABLES MODO CLARO (defecto institucional) ────────── */
:root {
  --bg:       #f4f6f8;
  --surface:  #ffffff;
  --surface2: #f8fafc;
  --surface3: #eef2f7;
  --border:   #d0d9e5;
  --border2:  #e4eaf2;

  --text:     #1e2c3d;
  --muted:    #5c7085;
  --dim:      #8fa3b5;

  /* Azul institucional */
  --blue:     #1d4ed8;
  --blue2:    #1e40af;
  --blue3:    #dbeafe;
  --blueHov:  #eff6ff;

  /* Verde gestión RCD */
  --green:    #16a34a;
  --green2:   #15803d;
  --green3:   #dcfce7;
  --greenDim: rgba(22,163,74,.08);

  /* Acento ámbar */
  --amber:    #b45309;
  --amberBg:  #fef3c7;

  /* Acento rojo */
  --red:      #dc2626;
  --redBg:    #fee2e2;

  /* Colores capas */
  --col-agreca: #1d4ed8;
  --col-sira:   #16a34a;
  --col-pl:     #b45309;

  --left-w:   500px;
  --r:        6px;
  --rl:       8px;
  --shadow:   0 1px 4px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
  --shadow2:  0 4px 16px rgba(0,0,0,.1);

  /* IDE-Andalucía blue — el azul de la imagen */
  --ideBlue:       #1a6fa0;
  --ideBlueHov:    #155d87;
  --ideBlueLight:  #e8f4f9;
}

/* ── VARIABLES MODO OSCURO (trabajo nocturno) ────────────── */
body.dark-mode {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #1c2229;
  --surface3: #21262d;
  --border:   #30363d;
  --border2:  #21262d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --dim:      #484f58;
  --blue:     #58a6ff;
  --blue2:    #388bfd;
  --blue3:    rgba(56,139,253,.15);
  --blueHov:  rgba(56,139,253,.08);
  --green:    #3fb950;
  --green2:   #238636;
  --green3:   rgba(63,185,80,.15);
  --greenDim: rgba(63,185,80,.08);
  --amber:    #d29922;
  --amberBg:  rgba(210,153,34,.15);
  --red:      #f85149;
  --redBg:    rgba(248,81,73,.12);
  --col-agreca: #58a6ff;
  --col-sira:   #3fb950;
  --col-pl:     #d29922;
  --shadow:   0 1px 4px rgba(0,0,0,.4);
  --shadow2:  0 4px 20px rgba(0,0,0,.5);
  --ideBlue:       #1d6fa8;
  --ideBlueHov:    #1a5f90;
  --ideBlueLight:  #0d2a3d;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

/* ── MAPA ───────────────────────────────────────────────── */
/* map rule consolidated below */
/* Modo claro: mapa natural */
.leaflet-tile { filter: none; }
body.dark-mode .leaflet-tile { filter: brightness(.75) saturate(.5) hue-rotate(165deg); }
.leaflet-container { background: var(--bg); }

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  font-weight: 600 !important;
}
.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--rl) !important;
  box-shadow: var(--shadow2) !important;
  color: var(--text) !important;
}
.leaflet-popup-tip { background: var(--surface) !important; }
.leaflet-popup-content { font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.6; }
.leaflet-control-layers {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--rl) !important;
  color: var(--text) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 12px !important;
  box-shadow: var(--shadow) !important;
}

/* Clusters */
.marker-cluster-small  { background-color: rgba(29,78,216,.2); }
.marker-cluster-small div  { background-color: rgba(29,78,216,.5); color: white; }
.marker-cluster-medium { background-color: rgba(22,163,74,.2); }
.marker-cluster-medium div { background-color: rgba(22,163,74,.5); color: white; }
.marker-cluster-large  { background-color: rgba(180,83,9,.2); }
.marker-cluster-large div  { background-color: rgba(180,83,9,.5); color: white; }
.marker-cluster div { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }

/* ── LEYENDA MAPA ───────────────────────────────────────── */
#mapLegend {
  position: fixed;
  top: 52px;
  right: 8px;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 8px 10px;
  font-size: 10px;
  box-shadow: var(--shadow);
  width: 150px;
}
.legendTitle { color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: 10px; font-weight: 600; margin-bottom: 8px; }
.legendItem { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; color: var(--text); font-size: 11px; }
.legendDot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legendDot.agreca { background: var(--col-agreca); }
.legendDot.sira   { background: var(--col-sira); }
.legendDot.pl     { background: var(--col-pl); }
.legendDot.obra   { background: var(--green); border: 2px solid white; }
.legendSep { height: 1px; background: var(--border2); margin: 6px 0; }
.legendTile { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ── TOOLTIP ────────────────────────────────────────────── */
.hoverTip {
  position: fixed; z-index: 999;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 8px 12px;
  font-size: 11px; pointer-events: none; display: none;
  max-width: 240px; line-height: 1.5;
  box-shadow: var(--shadow2); color: var(--text);
}
.hoverTip.visible { display: block; }
.hoverTip b { color: var(--blue); }

/* ══════════════════════════════════════════════════════════
   V1 — LAYOUT ACORDEÓN
   Menú lateral con contenido desplegable + mapa fijo derecha
   Inspirado en imagen de referencia IDEAndalucía
══════════════════════════════════════════════════════════ */

/* ── SHELL ───────────────────────────────────────────────── */
#appShell {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 48px;
  background: var(--ideBlue);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
  z-index: 100;
}
.tbBtnMenu {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.12); border: none; border-radius: 4px;
  color: white; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s; flex-shrink: 0;
}
.tbBtnMenu:hover { background: rgba(255,255,255,.22); }
#brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#brandIconSvg { flex-shrink: 0; }
#brandText { display: flex; flex-direction: column; }
#brandTitle { font-size: 14px; font-weight: 700; color: white; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; }
#brandSub   { font-size: 9px; color: rgba(255,255,255,.7); font-family: 'JetBrains Mono',monospace; white-space: nowrap; }
.vBadge {
  display: inline-block; background: rgba(255,255,255,.22); color: white;
  font-size: 8px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  font-family: 'JetBrains Mono',monospace; vertical-align: middle; margin-left: 3px;
}
#topbarCenter { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.tileSelectTop {
  flex: 1; max-width: 240px; padding: 5px 8px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  border-radius: 4px; color: white; font-size: 11px; outline: none; cursor: pointer;
}
.tileSelectTop option, .tileSelectTop optgroup { background: var(--surface); color: var(--text); }
#topbarActions { display: flex; gap: 4px; flex-shrink: 0; }
.tbBtn {
  height: 32px; min-width: 32px; padding: 0 8px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px; color: rgba(255,255,255,.85); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; gap: 5px; transition: background .12s; white-space: nowrap;
}
.tbBtn:hover { background: rgba(255,255,255,.22); color: white; }
.tbBtn.danger:hover { background: rgba(239,68,68,.35); border-color: rgba(239,68,68,.5); }
.tbBtnLabel { font-size: 10px; font-weight: 700; letter-spacing: .04em; }

/* ── APP BODY ────────────────────────────────────────────── */
#appBody {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}

/* ── SIDEBAR ACORDEÓN ────────────────────────────────────── */
#sideLeft {
  width: var(--left-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 2px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width .22s ease;
  z-index: 10;
}
body.menuCollapsed #sideLeft { width: 0 !important; overflow: hidden; border: none; }

/* Cabecera menú */
#menuHeader {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 44px;
  background: var(--ideBlue); color: white; flex-shrink: 0;
}
.menuHeaderIcon { font-size: 14px; opacity: .75; }
#menuTitle { font-size: 13px; font-weight: 600; color: white; letter-spacing: .02em; }

/* Lista acordeón — scroll completo */
.menuList {
  list-style: none; padding: 0;
  overflow-y: auto; overflow-x: hidden;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.menuList::-webkit-scrollbar { width: 5px; }
.menuList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── ÍTEM DEL MENÚ (cabecera acordeón) ──────────────────── */
.menuItem {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 14px;
  cursor: pointer;
  font-size: 13px; font-weight: 400; color: var(--text);
  border-left: 3px solid transparent;
  transition: background .1s, color .1s, border-color .1s;
  user-select: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
}
.menuIcon {
  width: 20px; text-align: center; font-size: 15px;
  flex-shrink: 0; color: #6b8fa8; transition: color .1s;
}
.menuItemLabel { flex: 1; line-height: 1.35; }
.menuArrow {
  font-size: 13px; color: var(--dim); flex-shrink: 0;
  transition: transform .2s ease, color .15s;
}

/* Hover */
.menuItem:hover {
  background: #f0f7fc;
  color: var(--ideBlue);
  border-left-color: var(--ideBlue);
}
.menuItem:hover .menuIcon { color: var(--ideBlue); }

/* ACTIVO — como en la imagen */
.menuItem.active {
  background: #e8f4f9;
  color: var(--ideBlue);
  border-left-color: var(--ideBlue);
  font-weight: 600;
}
.menuItem.active .menuIcon { color: var(--ideBlue); }
.menuItem.active .menuArrow {
  transform: rotate(90deg);
  color: var(--ideBlue);
}
/* Cuando está abierto la flecha apunta abajo */
.menuItem.open .menuArrow {
  transform: rotate(90deg);
}

/* ── CUERPO ACORDEÓN ─────────────────────────────────────── */
.accordionBody {
  display: none;
  background: var(--surface2);
  border-left: 3px solid var(--ideBlue);
  border-bottom: 2px solid var(--border);
}
.accordionBody.accordionOpen {
  display: block;
}
.accContent {
  padding: 12px 14px 16px;
}

/* Secciones dentro del acordeón */
.accContent .section {
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 14px;
  box-shadow: var(--shadow);
}
.accContent .tabScroll {
  /* No scroll propio — el scroll es del menuList */
  overflow: visible;
  padding: 0;
  flex: unset;
}

/* ── PANEL MAPA (derecha, fijo) ──────────────────────────── */
#mapPanel {
  flex: 1; position: relative; overflow: hidden; min-width: 0;
}
#map {
  position: absolute; inset: 0; z-index: 1;
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.menuDivider {
  height: 1px; background: var(--border); margin: 0;
  border: none; list-style: none;
}

/* Ítems utilidad */
.menuItemUtil { color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border2); }
.menuItemUtil .menuIcon { font-size: 14px; color: var(--muted); }
.menuItemUtil:hover { color: var(--text); background: var(--blueHov); border-left-color: transparent; }
.menuItemDanger:hover { color: var(--red); background: var(--redBg); border-left-color: var(--red); }

/* Badge */
.menuBadge {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
  background: #e8f4f9; color: var(--ideBlue);
  font-family: 'JetBrains Mono',monospace; letter-spacing: .03em; flex-shrink: 0;
}

/* Leyenda mapa */
#mapLegend {
  position: absolute; top: 56px; right: 10px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 10px 14px;
  font-size: 11px; box-shadow: var(--shadow);
}

/* ORS indicator */
#orsIndicator { position: absolute; top: 10px; right: 20px; z-index: 20; }

/* Mapbox floating */
.mapboxContainer { position: absolute; z-index: 20; }

/* Responsive — menú como overlay en pantallas pequeñas */
@media (max-width: 700px) {
  #sideLeft {
    position: absolute; top: 0; left: 0; bottom: 0;
    z-index: 50; box-shadow: 4px 0 20px rgba(0,0,0,.2);
  }
  body:not(.menuOpen) #sideLeft { width: 0 !important; overflow: hidden; }
  body.menuOpen #sideLeft { width: 360px !important; }
}

/* Dark mode */
body.dark-mode #menuHeader { background: #155d87; }
body.dark-mode .menuItem { background: var(--surface); }
body.dark-mode .menuItem:hover { background: rgba(26,111,160,.12); }
body.dark-mode .menuItem.active { background: rgba(26,111,160,.18); }
body.dark-mode /* accordion dark bg handled above */
body.dark-mode .menuBadge { background: rgba(26,111,160,.2); }

/* Loading bar */
#loadingBar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg,#1d4ed8,#4ade80);
  z-index: 999998; transition: width .3s ease; pointer-events: none;
}

/* Offline banner */
#offlineBanner {
  position: fixed; top: 48px; left: 0; right: 0; z-index: 99999;
}



/* ── SECCIONES ──────────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.sectionHead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.snum {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--blue);
  background: var(--blue3);
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 600;
  flex-shrink: 0;
}
.slabel {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
  flex: 1;
}
.sectionHeadActions {
  display: flex;
  gap: 5px;
  margin-left: auto;
  flex-wrap: wrap;
}
.ml-auto { margin-left: auto; }

/* ── FORMULARIOS ────────────────────────────────────────── */
.formGroup { margin-bottom: 10px; }
.formGroup.half { flex: 1; min-width: 0; }
.formGroup.span2 { grid-column: span 2; }

.formLabel {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: .01em;
}

.formInput {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.formInput:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,.1);
  background: var(--surface);
}
.formInput::placeholder { color: var(--dim); }
.formInput.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.formInput option { background: var(--surface2); }

.formHint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.coordRow { display: flex; gap: 8px; margin-bottom: 0; }
.paramGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inputRow { display: flex; gap: 6px; align-items: center; }
.inputRow input { flex: 1; }
.inputUnit { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }
.checkboxInline { width: auto !important; margin-right: 5px; accent-color: var(--blue); }

/* ── SLIDER ─────────────────────────────────────────────── */
.sliderGroup { display: flex; gap: 8px; align-items: center; }
.slider {
  flex: 1;
  height: 4px;
  accent-color: var(--blue);
  cursor: pointer;
  width: auto !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.sliderNum { width: 70px !important; flex-shrink: 0; }

/* ── BOTONES ────────────────────────────────────────────── */
.btnGroup { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }

.btnPrimary {
  padding: 8px 14px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--r);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btnPrimary:hover { background: var(--blue2); }

.btnSecondary {
  padding: 8px 12px;
  background: var(--blueHov);
  color: var(--blue);
  border: 1px solid rgba(29,78,216,.25);
  border-radius: var(--r);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btnSecondary.compact { padding: 7px 10px; }
.btnSecondary:hover { background: var(--blue3); }
.btnSecondary.active { background: var(--blue); color: white; }

.btnGhost {
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.btnGhost:hover { color: var(--text); border-color: var(--dim); }

.iconBtn {
  width: 32px; height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.iconBtn:hover { color: var(--text); border-color: var(--dim); background: var(--blueHov); }
.iconBtn.danger:hover { color: var(--red); border-color: var(--red); background: var(--redBg); }

/* Close button (✕) in modals — bigger and clearly red on hover */
#modalPlantaHead .iconBtn,
#modalLERHead .iconBtn,
#modalHead .iconBtn {
  width: 36px; height: 36px; font-size: 16px; font-weight: 700;
  border-radius: 50%;
}
#modalPlantaHead .iconBtn:hover,
#modalLERHead .iconBtn:hover,
#modalHead .iconBtn:hover {
  color: var(--red); background: var(--redBg); border-color: var(--red);
}

/* Botón de herramienta pequeño */
.btnTool {
  padding: 4px 9px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btnTool:hover { color: var(--blue); border-color: var(--blue); background: var(--blueHov); }

/* ── CHIPS ──────────────────────────────────────────────── */
.chipRow { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  color: var(--muted);
}
.chip input { display: none; }
.chip:has(input:checked) { border-color: currentColor; }
.chip.agreca { color: var(--col-agreca); }
.chip.agreca:has(input:checked) { background: rgba(29,78,216,.08); }
.chip.sira   { color: var(--col-sira); }
.chip.sira:has(input:checked)   { background: rgba(22,163,74,.08); }
.chip.pl     { color: var(--col-pl); }
.chip.pl:has(input:checked)     { background: rgba(180,83,9,.08); }

/* ── SUGERENCIAS ────────────────────────────────────────── */
.sugBox {
  display: none; border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  margin-top: 4px; background: var(--surface);
  box-shadow: var(--shadow2); position: relative; z-index: 100;
}
.sugItem {
  padding: 9px 11px; cursor: pointer;
  border-bottom: 1px solid var(--border2);
  transition: background .1s;
}
.sugItem:last-child { border-bottom: none; }
.sugItem:hover { background: var(--blueHov); }
.sugItem .sugTitle { font-size: 12px; font-weight: 500; color: var(--text); }
.sugItem .sugSub { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

/* ── GEO REVERSE ────────────────────────────────────────── */
.geoRev {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--green);
  margin: 5px 0 0; min-height: 14px;
}

/* ── FICHA DE OBRA ──────────────────────────────────────── */
.fichaObra {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
  background: var(--surface2);
}
.fichaHead {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--blue3);
  border-bottom: 1px solid var(--border);
}
.fichaBadge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 700;
  color: var(--blue2);
  text-transform: uppercase; letter-spacing: .08em;
}
.fichaHint { font-size: 10px; color: var(--muted); }
.fichaGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.fichaRow {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border2);
  border-right: 1px solid var(--border2);
}
.fichaRow:nth-child(even) { border-right: none; }
.fichaRow:nth-last-child(-n+2) { border-bottom: none; }
.fichaRow.span2 { grid-column: span 2; border-right: none; }
.fichaLabel {
  font-size: 10px; font-weight: 500; color: var(--muted);
  margin-bottom: 4px; display: block; text-transform: uppercase; letter-spacing: .04em;
}
.fichaRow .formInput { background: transparent; border: none; border-bottom: 1px solid var(--border2); border-radius: 0; padding: 2px 0; font-size: 12px; }
.fichaRow .formInput:focus { border-bottom-color: var(--blue); box-shadow: none; }

/* ── DETAILS/SUMMARY ────────────────────────────────────── */
details { margin-top: 8px; }
summary {
  font-size: 11px; color: var(--muted); font-weight: 500;
  cursor: pointer; padding: 5px 0; list-style: none;
  display: flex; align-items: center; gap: 5px;
}
summary::marker, summary::-webkit-details-marker { display: none; }
summary::before { content: '▸'; color: var(--blue); font-size: 10px; transition: transform .15s; }
details[open] summary::before { transform: rotate(90deg); }
.toggleRow {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--muted); cursor: pointer;
}
.toggleRow input { width: auto; accent-color: var(--blue); }

/* ── ETA BOX ────────────────────────────────────────────── */
.etaBox {
  background: var(--green3);
  border: 1px solid rgba(22,163,74,.2);
  border-radius: var(--r);
  padding: 8px 11px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--green2);
  margin-bottom: 10px;
  min-height: 32px;
  display: flex; align-items: center;
}
.costBox {
  background: var(--blue3);
  border: 1px solid rgba(29,78,216,.15);
  border-radius: var(--r);
  padding: 7px 11px;
  font-size: 11px; color: var(--blue2);
  margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── BOTÓN CALCULAR ─────────────────────────────────────── */
.btnRun {
  width: 100%; padding: 11px;
  background: var(--blue);
  color: white;
  border: none; border-radius: var(--rl);
  font-family: 'Inter', sans-serif;
  font-weight: 700; font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: -.01em;
  transition: background .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(29,78,216,.3);
}
.btnRun:hover { background: var(--blue2); box-shadow: 0 4px 16px rgba(29,78,216,.4); }
.btnRun.running { background: var(--blueHov); color: var(--blue); border: 1px solid rgba(29,78,216,.3); box-shadow: none; }

/* ── PROGRESO ───────────────────────────────────────────── */
#progressWrap { margin: 9px 0; }
#progressTrack { height: 4px; background: var(--border2); border-radius: 999px; overflow: hidden; }
#progressFill { height: 100%; width: 0; background: var(--blue); border-radius: 999px; transition: width .25s ease; }
#progressText { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ── SECCIÓN EXPORTACIÓN ────────────────────────────────── */
.exportSection { margin-top: 12px; }
.exportLabel { font-size: 11px; font-weight: 500; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.exportRow { display: flex; gap: 5px; flex-wrap: wrap; }

.btnExport {
  flex: 1; min-width: 0;
  padding: 6px 8px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 500;
  cursor: pointer;
  text-align: center; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; white-space: nowrap;
}
.btnExport:hover { color: var(--text); border-color: var(--dim); background: var(--surface3); }
.btnExport.nav  { color: var(--blue); border-color: rgba(29,78,216,.2); }
.btnExport.nav:hover  { background: var(--blueHov); }
.btnExport.nav2 { color: var(--amber); border-color: rgba(180,83,9,.2); }
.btnExport.nav2:hover { background: var(--amberBg); }
.btnExport.nav3 { color: var(--green); border-color: rgba(22,163,74,.2); }
.btnExport.nav3:hover { background: var(--green3); }
.btnExport.stop { color: var(--red); border-color: rgba(220,38,38,.2); }
.btnExport.stop:hover { background: var(--redBg); }

/* Tarifa inline en sección 05 */
.tarifaRow {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
}
.tarifaInput { width: 80px !important; flex-shrink: 0; }

/* ── TABLAS ─────────────────────────────────────────────── */
.tableWrap {
  overflow: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
  max-height: 280px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.rankWrap { max-height: 340px; }
.tblData {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.tblData th {
  padding: 7px 10px;
  text-align: left;
  background: var(--surface3);
  color: var(--muted);
  position: sticky; top: 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  z-index: 1;
}
.tblData td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}
.tblData input { padding: 3px 6px; font-size: 10px; border-radius: 4px; }
.tblRanking tbody tr { cursor: pointer; transition: background .1s; }
.tblRanking tbody tr:hover { background: var(--blueHov); }
.tblRanking tbody tr.selected { background: var(--blue3); }
.tblRanking tbody tr.compareA { background: rgba(29,78,216,.07) !important; }
.tblRanking tbody tr.compareB { background: rgba(220,38,38,.06) !important; }
.tableHint { font-size: 10px; color: var(--muted); text-align: center; margin-top: 6px; line-height: 1.5; }
.tableHint kbd {
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px; font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}

/* Ranking sortable */
.tblRanking th[data-col] { cursor: pointer; user-select: none; }
.tblRanking th[data-col]:hover { color: var(--blue); }
.tblRanking th.sorted-asc::after  { content: ' ↑'; color: var(--blue); }
.tblRanking th.sorted-desc::after { content: ' ↓'; color: var(--blue); }

/* Rank search */
.rankSearchInput {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  font-family: 'Inter', sans-serif;
  outline: none;
  width: 100px;
}
.rankSearchInput:focus { border-color: var(--blue); }

/* ── HISTORIAL ──────────────────────────────────────────── */
#histList { display: flex; flex-direction: column; gap: 6px; }
.histCard {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 9px 12px;
  cursor: pointer;
  transition: all .15s;
  font-size: 11px;
}
.histCard:hover { border-color: var(--blue); background: var(--blueHov); }
.histCard .histTop { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.histCard .histSub { color: var(--muted); font-size: 10px; font-family: 'JetBrains Mono', monospace; }

/* ── KPI GRID ───────────────────────────────────────────── */
#kpiGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpiCard {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 12px;
}
.kpiCard.cle { grid-column: span 2; }
.kpiLabel {
  font-size: 10px; font-weight: 500;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 6px;
}
.kpiValue {
  font-size: 22px; font-weight: 700;
  color: var(--blue);
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}
.kpiCard.cle .kpiValue { color: var(--green2); }
.kpiSub { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; margin-top: 5px; line-height: 1.4; }
.cleTrack { position: relative; height: 6px; background: var(--border); border-radius: 999px; margin: 10px 0 6px; overflow: visible; }
.cleGrad { position: absolute; inset: 0; border-radius: 999px; background: linear-gradient(90deg, #16a34a, #d97706, #dc2626); }
.clePin { position: absolute; top: -5px; width: 3px; height: 16px; background: var(--text); border-radius: 2px; left: 0; transition: left .4s ease; }

/* ── KPI TEXT ───────────────────────────────────────────── */
#kpisText {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--muted);
  line-height: 1.7;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 8px 10px;
  margin-bottom: 10px;
}
#kpisText b { color: var(--text); }

/* ── SEMÁFORO ───────────────────────────────────────────── */
#semaforoGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.semaforoItem {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
}
.semaforoDot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.semaforoLabel { font-size: 11px; color: var(--text); flex: 1; }
.semaforoVal { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; color: var(--text); }
.sem-verde    { background: #16a34a; }
.sem-amarillo { background: #d97706; }
.sem-rojo     { background: #dc2626; }
.sem-gris     { background: var(--dim); }

/* ── SCATTER / CHARTS ───────────────────────────────────── */
.formHint { font-family: 'Inter', sans-serif; font-size: 11px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
#scatterWrap { position: relative; height: 270px; }
#scatterWrap canvas { width: 100% !important; height: 100% !important; }
.chartCard {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 10px;
  margin-bottom: 8px;
}
.chartLabel { font-size: 11px; font-weight: 500; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .03em; }
.chartCard canvas { width: 100% !important; height: 130px !important; }

/* ── LER SELECTOR ───────────────────────────────────────── */
.lerBadge {
  display: inline-block;
  background: var(--green3);
  color: var(--green2);
  font-size: 10px; font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  margin-left: 5px;
  border: 1px solid rgba(22,163,74,.2);
}
.lerCards { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; max-height: 220px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.lerCard {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all .12s;
  font-size: 11px;
}
.lerCard:hover { border-color: var(--blue); background: var(--blueHov); }
.lerCard.lerActive { border-color: var(--blue); background: var(--blue3); }
.lerCardNum { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--dim); width: 16px; flex-shrink: 0; text-align: right; }
.lerCodeBadge { font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700; color: white; padding: 2px 6px; border-radius: 3px; flex-shrink: 0; }
.lerCardInfo { flex: 1; min-width: 0; }
.lerCardTitle { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lerCardSub { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lerOpBadge { font-size: 9px; font-family: 'JetBrains Mono', monospace; font-weight: 600; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.lerBadgeNew { font-size: 9px; background: var(--green3); color: var(--green2); padding: 1px 5px; border-radius: 3px; border: 1px solid rgba(22,163,74,.2); font-weight: 700; flex-shrink: 0; }
.lerInfoBtn { width: 18px; height: 18px; background: var(--surface3); border: 1px solid var(--border); border-radius: 50%; font-size: 10px; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }
.lerInfoBtn:hover { background: var(--blue); color: white; border-color: var(--blue); }

.lerSelectedBar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 8px 10px;
  background: var(--green3);
  border: 1px solid rgba(22,163,74,.2);
  border-radius: var(--r);
}
.lerSelCode { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; color: var(--green2); flex-shrink: 0; }
.lerSelName { font-size: 12px; font-weight: 500; color: var(--text); flex: 1; }
.lerSelOp { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }

.emptyMsg {
  font-size: 11px; color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  text-align: center;
  line-height: 1.6;
  background: var(--surface2);
}

/* ── PRESETS ────────────────────────────────────────────── */
.presetsPanel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  margin-bottom: 12px;
}
.presetsTitle {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 8px;
}
.presetsGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.presetBtn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.presetBtn:hover { border-color: var(--blue); background: var(--blueHov); }
.presetIcon { font-size: 14px; color: var(--blue); flex-shrink: 0; }
.presetName { font-size: 11px; font-weight: 600; color: var(--text); }
.presetDesc { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

/* ── COMPARADOR A/B ─────────────────────────────────────── */
.comparadorTable { width: 100%; border-collapse: collapse; font-size: 11px; }
.comparadorTable th { padding: 6px 8px; font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.comparadorTable th.label { color: var(--muted); background: var(--surface2); }
.comparadorTable th.colA { color: var(--blue); background: rgba(29,78,216,.06); }
.comparadorTable th.colB { color: var(--red); background: rgba(220,38,38,.05); }
.comparadorTable td { padding: 5px 8px; border-bottom: 1px solid var(--border2); }
.comparadorTable td.label { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.comparadorTable td.valA, .comparadorTable td.valB { text-align: right; font-family: 'JetBrains Mono', monospace; }
.comparadorTable td.better { color: var(--green2); font-weight: 700; }
.comparadorTable td.worse  { color: var(--red); }
.comparadorBadge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 9px; font-weight: 700; margin-left: 4px; }
.badgeA { background: rgba(29,78,216,.1); color: var(--blue); }
.badgeB { background: rgba(220,38,38,.1); color: var(--red); }

/* ── TOAST ──────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 20px;
  left: calc(var(--left-w) / 2);
  transform: translateX(-50%) translateY(70px);
  background: var(--text);
  color: var(--surface);
  border-radius: var(--rl);
  padding: 9px 18px;
  font-size: 12px; font-weight: 500;
  z-index: 9998;
  transition: transform .28s ease;
  pointer-events: none;
  box-shadow: var(--shadow2);
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ── STATS FLOTANTE ─────────────────────────────────────── */
#statsFloat {
  position: fixed;
  bottom: 14px; right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--muted);
  z-index: 900; display: none;
  line-height: 1.7; min-width: 190px;
  box-shadow: var(--shadow2);
}
#statsFloat.visible { display: block; }
#statsFloat b { color: var(--blue); }

/* ── MODAL ──────────────────────────────────────────────── */
#modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#modal.hidden { display: none; }
#modalBox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  width: min(520px, 96vw);
  overflow: hidden;
  box-shadow: var(--shadow2);
}
#modalHead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px;
  background: var(--surface2);
}
#modalBody { padding: 16px; max-height: 70vh; overflow-y: auto; }
.helpStep { display: flex; gap: 12px; margin-bottom: 12px; align-items: flex-start; }
.helpN {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--blue); background: var(--blue3);
  padding: 2px 7px; border-radius: 3px; flex-shrink: 0; margin-top: 2px;
  font-weight: 600;
}
.helpStep div { font-size: 12px; line-height: 1.6; color: var(--text); }
.helpStep strong { color: var(--blue); }
.helpNote {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--amber);
  background: var(--amberBg);
  border: 1px solid rgba(180,83,9,.2);
  border-radius: var(--r); padding: 9px 11px; margin-top: 6px;
}
.helpNote code { font-family: 'JetBrains Mono', monospace; }

/* ── MODAL LER ──────────────────────────────────────────── */
#modalLER { position:fixed;inset:0;background:rgba(0,0,0,.5);backdrop-filter:blur(3px);z-index:10001;display:flex;align-items:center;justify-content:center;padding:20px; }
#modalLER.hidden { display:none; }
#modalLERBox { background:var(--surface);border:1px solid var(--border);border-radius:var(--rl);width:min(480px,96vw);overflow:hidden;box-shadow:var(--shadow2);display:flex;flex-direction:column;max-height:90vh; }
#modalLERHead { display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--border);background:var(--surface2); }
.modalLERTitle { display:flex;align-items:center;gap:10px; }
#modalLERBody { padding:14px 16px;overflow-y:auto;flex:1;font-size:12px;line-height:1.6; }
#modalLERFooter { padding:12px 16px;border-top:1px solid var(--border);background:var(--surface2); }
.lerDetailRow { display:flex;justify-content:space-between;align-items:flex-start;padding:5px 0;border-bottom:1px solid var(--border2); }
.lerDetailLabel { font-size:10px;color:var(--muted);font-weight:500;text-transform:uppercase;letter-spacing:.04em;flex-shrink:0;min-width:140px; }
.lerDetailValue { font-size:12px;color:var(--text);text-align:right;font-weight:500; }
.lerObsBox { display:flex;gap:8px;padding:8px 10px;background:var(--amberBg);border:1px solid rgba(180,83,9,.2);border-radius:var(--r);margin-top:10px;font-size:11px;color:var(--amber);line-height:1.5; }
.rdTable { width:100%;border-collapse:collapse;font-size:11px;margin-top:6px; }
.rdTable th { padding:5px 8px;background:var(--surface3);border-bottom:1px solid var(--border);font-size:10px;font-weight:600;text-align:left; }
.rdTable td { padding:5px 8px;border-bottom:1px solid var(--border2); }

/* ── MODAL PLANTA ───────────────────────────────────────── */
#modalPlanta { position:fixed;inset:0;background:rgba(0,0,0,.5);backdrop-filter:blur(3px);z-index:10001;display:flex;align-items:center;justify-content:center;padding:20px; }
#modalPlanta.hidden { display:none; }
#modalPlantaBox { background:var(--surface);border:1px solid var(--border);border-radius:var(--rl);width:min(460px,96vw);overflow:hidden;box-shadow:var(--shadow2);display:flex;flex-direction:column;max-height:90vh; }
#modalPlantaHead { display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--border);background:var(--surface2);font-weight:600;font-size:13px; }
#modalPlantaBody { padding:14px 16px;overflow-y:auto;flex:1;font-size:12px;line-height:1.6; }
#modalPlantaFooter { padding:12px 16px;border-top:1px solid var(--border);background:var(--surface2);display:flex;gap:8px; }
#modalPlantaFooter a { flex:1;text-align:center;text-decoration:none; }

/* ── INFORME ────────────────────────────────────────────── */
#informeContent { font-size: 12px; line-height: 1.7; color: var(--text); }
.informeSection { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border2); }
.informeSection:last-child { border-bottom: none; }
.informeH { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 2px solid var(--blue3); }
.informeRow { display:flex;justify-content:space-between;padding:4px 0;border-bottom:1px solid var(--border2); }
.informeKey { color:var(--muted);font-size:11px;font-weight:500; }
.informeVal { font-size:11px;font-weight:600;color:var(--text);text-align:right; }
.informeConcl { padding:12px;background:var(--green3);border:1px solid rgba(22,163,74,.2);border-radius:var(--r);margin-top:8px;font-size:11px;line-height:1.7;color:var(--text); }

/* ── 3D CANVAS ──────────────────────────────────────────── */
#canvas3DWrap { width:100%;height:300px;position:relative;background:var(--surface2);border-radius:var(--r);overflow:hidden;border:1px solid var(--border); }
#canvas3D { width:100%;height:100%;cursor:grab;display:block; }
#canvas3D:active { cursor:grabbing; }
#canvas3DEmpty { position:absolute;inset:0;display:flex;align-items:center;justify-content:center; }
.legend3DGrid { display:flex;gap:14px;flex-wrap:wrap;padding:6px; }
.legend3DItem { display:flex;align-items:center;gap:6px;font-size:11px;color:var(--muted); }
.legend3DDot { width:11px;height:11px;border-radius:2px; }

/* ── PDF ────────────────────────────────────────────────── */
#pdfSheet {
  position:fixed;left:-99999px;top:0;
  width:794px;padding:24px;background:white;color:#1e2c3d;
  font-family:Arial,sans-serif;font-size:12px;
}
.pdfHeader { display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px;padding-bottom:12px;border-bottom:3px solid #1d4ed8; }
.pdfHeaderLeft { display:flex;align-items:flex-start;gap:12px; }
.pdfLogo { font-size:16px;font-weight:700;color:#1d4ed8;white-space:nowrap;margin-top:2px; }
.pdfHeader h2 { font-size:16px;margin:0 0 4px;color:#1e2c3d; }
.pdfMeta { font-size:10px;color:#5c7085; }
.pdfBadge { padding:3px 10px;background:#dbeafe;border:1px solid #1d4ed8;border-radius:4px;font-size:11px;color:#1d4ed8;font-weight:700;white-space:nowrap; }
.pdfBox { border:1px solid #d0d9e5;border-radius:6px;padding:12px;margin:8px 0; }
.pdfGrid4 { display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:10px; }
.pdfSub { font-size:10px;color:#5c7085;margin-bottom:5px;text-transform:uppercase;letter-spacing:.04em;font-weight:600; }
.pdfImg { width:100%;border:1px solid #e4eaf2;border-radius:4px; }
.pdfTable { width:100%;border-collapse:collapse;font-size:10px;margin-top:6px; }
.pdfTable th { background:#f4f7fb;padding:5px 8px;text-align:left;border-bottom:2px solid #1d4ed8;color:#1d4ed8;font-weight:600; }
.pdfTable td { padding:4px 8px;border-bottom:1px solid #eef2f7; }

/* ── RESPONSIVE: panel más estrecho en pantallas pequeñas ── */
@media (max-width: 900px) {
  :root { --left-w: 360px; }
}
/* old split-panel responsive removed */

/* ══════════════════════════════════════════════════════
   V1 — NUEVOS COMPONENTES
══════════════════════════════════════════════════════ */
.tileSelect {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px; height: 28px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface2); color: var(--text); cursor: pointer;
}
.tileSelect:focus { outline: none; border-color: var(--blue); }
#btnCatastro { font-size: 10px !important; font-weight: 700; letter-spacing: .04em; padding: 0 8px; }
#btnCatastro.active { background: var(--blue); color: white; border-color: var(--blue); }
.catastroResult { margin-top: 6px; font-size: 11px; min-height: 18px; line-height: 1.5; }
.catastroResult .catOk     { color: #16a34a; }
.catastroResult .catError  { color: #dc2626; }
.catastroResult .catPending{ color: var(--muted); }
.catastroResult .catWarn   { color: #d97706; }
.catastroCard { margin-top: 10px; padding: 10px 12px; background: #f0fdf4; border: 1px solid #d1fae5; border-radius: 6px; }
body.dark-mode .catastroCard { background: #052e16; border-color: #166534; }
#isoResult { margin-top: 8px; font-size: 11px; }
.multiLerPicker { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.multiLerRow { display: flex; align-items: center; gap: 8px; }
.multiLerIdx { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; background: var(--blue); color: white; border-radius: 4px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.multiLerTable { border: 1px solid var(--border); border-radius: 6px; padding: 12px; background: var(--surface2); }
.multiLerSelect { flex: 1; font-size: 11px; }
.multiLerMasa   { font-size: 11px; }
.cuencaStats { margin: 10px 0; }
.cuencaGrid  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cuencaItem  { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.cuencaName  { font-size: 12px; font-weight: 600; margin-bottom: 3px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cuencaCount { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.cuencaBar   { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 5px; }
.cuencaBarFill { height: 100%; border-radius: 2px; transition: width .4s; }
.cuencaTipos { font-size: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════
   V1 — ANÁLISIS VISUAL Y NUEVOS COMPONENTES
══════════════════════════════════════════════════════ */

/* Resumen ejecutivo análisis */
.analysisSummary { margin-bottom: 4px; }
.summaryGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 500px) { .summaryGrid { grid-template-columns: repeat(2, 1fr); } }
.summaryCard {
  border-radius: var(--r);
  padding: 12px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.summaryCard.blue   { background: #dbeafe; border-color: #93c5fd; }
.summaryCard.green  { background: #dcfce7; border-color: #86efac; }
.summaryCard.amber  { background: #fef3c7; border-color: #fcd34d; }
.summaryCard.purple { background: #ede9fe; border-color: #c4b5fd; }
body.dark-mode .summaryCard.blue   { background: #1e3a5f; border-color: #1d4ed8; }
body.dark-mode .summaryCard.green  { background: #14302a; border-color: #16a34a; }
body.dark-mode .summaryCard.amber  { background: #2d1e06; border-color: #d97706; }
body.dark-mode .summaryCard.purple { background: #2e1a5e; border-color: #7c3aed; }
.summaryVal {
  font-size: 22px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}
.summaryLbl {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Donut + legend dual layout */
.donutGrid {
  display: flex;
  align-items: center;
  gap: 14px;
}
.donutLegend { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.donutLegItem { font-size: 11px; color: var(--text); display: flex; align-items: center; }

/* Dual chart row */
.chartDualRow {
  display: flex;
  gap: 8px;
}
@media (max-width: 600px) { .chartDualRow { flex-direction: column; } }

/* Tile select optgroup styling */
.tileSelect optgroup { font-weight: 700; font-size: 10px; color: var(--muted); }
.tileSelect option   { font-size: 11px; }

/* LER multi-select chips */
.lerChips { display: flex; flex-wrap: wrap; gap: 6px; }
.lerChip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  background: #dbeafe; color: #1d4ed8;
  font-size: 10px; font-weight: 600; font-family: 'JetBrains Mono', monospace;
  border: 1px solid #93c5fd; cursor: default;
}
.lerChip .lerChipX { cursor: pointer; opacity: .6; font-size: 11px; }
.lerChip .lerChipX:hover { opacity: 1; }
body.dark-mode .lerChip { background: #1e3a5f; color: #93c5fd; border-color: #1d4ed8; }

/* LER cards multi mode */
.lerCardsMulti .lerCard { cursor: pointer; }
.lerCardsMulti .lerCard.lerCardChecked {
  border-color: #16a34a !important;
  background: #f0fdf4 !important;
}
body.dark-mode .lerCardsMulti .lerCard.lerCardChecked {
  border-color: #16a34a !important;
  background: #052e16 !important;
}
.lerCardCheckMark {
  position: absolute; top: 6px; right: 6px;
  width: 16px; height: 16px;
  background: #16a34a; color: white;
  border-radius: 50%; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* 3D Controls */
.canvas3DCtrl {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 6px 10px; font-size: 11px;
}
#canvas3DControls {
  position: absolute; top: 8px; left: 8px; z-index: 400;
}

/* ══════════════════════════════════════════════════════
   V1 — COMPONENTES NUEVOS
══════════════════════════════════════════════════════ */

/* SDSS tooltip badge */
.sdssAbbr {
  cursor: help;
  border-bottom: 1px dotted var(--muted);
  font-weight: 600;
  color: var(--blue);
}

/* Lang button */
#btnLang { font-size: 10px !important; font-weight: 700; letter-spacing: .04em; padding: 0 6px; }

/* LER multi-select V1 */
.lerCardMulti { cursor: pointer; }
.lerCardMulti:hover { border-color: var(--blue) !important; background: var(--surface2) !important; }
.lerCardChecked { border-color: #16a34a !important; background: #f0fdf4 !important; }
body.dark-mode .lerCardChecked { background: #052e16 !important; border-color: #16a34a !important; }

.lerCardCheckbox {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
}
.lerCardCheckbox input { display: none; }
.lerCheckMark {
  width: 18px; height: 18px; border-radius: 4px;
  border: 2px solid var(--border);
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #16a34a;
  flex-shrink: 0; transition: background .15s, border-color .15s;
}
.lerCardChecked .lerCheckMark { background: #dcfce7; border-color: #16a34a; }
body.dark-mode .lerCardChecked .lerCheckMark { background: #14302a; }

.lerCardRight { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.lerPrimaryBadge {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: #1d4ed8; color: white; border-radius: 3px; padding: 1px 5px;
}
.lerChipPrimary { background: #1d4ed8 !important; color: white !important; border-color: #1d4ed8 !important; }
.lerChipPrimaryMark { font-size: 9px; }

/* isoProvider select */
#isoProvider { font-size: 11px; }
#isoProvider optgroup { font-weight: 700; }

/* donut fixed layout */
.donutWrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 200px;
  padding: 8px 0;
}
.donutCanvasWrap {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  position: relative;
}
.donutLegend { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 100px; }
.donutLegItem { font-size: 12px; display: flex; align-items: center; gap: 6px; color: var(--text); }

/* RCD table improved */
#tblRCD input { width: 54px; font-size: 11px; padding: 2px 4px; }

/* catResult class compat */
.catResult .catOk, .catResult .catError, .catResult .catPending, .catResult .catWarn,
.catastroResult .catOk  { color: #16a34a; }
.catastroResult .catError { color: #dc2626; }
.catastroResult .catPending { color: var(--muted); }
.catastroResult .catWarn { color: #d97706; }

/* ══════════════════════════════════════════════════════
   V1 · LOGO GEORECICLA + TIPO OBRA RADIO BUTTONS
══════════════════════════════════════════════════════ */

/* Logo strip entre topbar y tabs */

/* ── IFC Drop Zone ─────────────────────────────────────── */
.ifcDropZone {
  border: 2px dashed var(--border);
  border-radius: var(--r);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface2);
}
.ifcDropZone:hover, .ifcDropZone.dragover {
  border-color: var(--blue);
  background: #dbeafe22;
}
.ifcDropIcon { font-size: 32px; line-height: 1; margin-bottom: 8px; }
.ifcDropText { font-size: 13px; color: var(--text); font-weight: 500; }
.ifcDropSub  { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* ── IFC Status bar ───────────────────────────────────── */
.ifcStatus {
  padding: 8px 12px;
  border-radius: var(--r);
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  border-left: 3px solid transparent;
}
.ifcStatus-ok      { background: #dcfce7; border-color: #16a34a; color: #15803d; }
.ifcStatus-pending { background: #dbeafe; border-color: #1d4ed8; color: #1d4ed8; }
.ifcStatus-warn    { background: #fef9c3; border-color: #ca8a04; color: #854d0e; }
body.dark-mode .ifcStatus-ok      { background: #14532d44; color: #86efac; }
body.dark-mode .ifcStatus-pending { background: #1e3a5f44; color: #93c5fd; }
body.dark-mode .ifcStatus-warn    { background: #78350f44; color: #fde68a; }

/* ── BIM KPI Grid ─────────────────────────────────────── */
.bimKpiGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media(max-width:520px){ .bimKpiGrid{ grid-template-columns: 1fr 1fr; } }
.bimKpiCard {
  background: var(--surface);
  border-radius: var(--r);
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
}
.bimKpiN     { font-size: 18px; font-weight: 800; color: var(--blue); line-height: 1.1; }
.bimKpiLabel { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ── BIM Geo Panel ─────────────────────────────────────── */
.bimGeoPanel {
  background: var(--surface2);
  border-radius: var(--r);
  padding: 10px;
  margin-top: 4px;
}

/* ── BIM LER Table ─────────────────────────────────────── */
.bimLERTable {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
}
.bimLERTable table { width: 100%; min-width: 560px; }
.bimLERAlert { background: #fff7ed !important; }
body.dark-mode .bimLERAlert { background: #78350f22 !important; }

/* ── BIM Viewer ───────────────────────────────────────── */
.bimViewerToolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.bimToolBtn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.bimViewerInfo {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
}
#bimCanvasWrap {
  width: 100%;
  height: 340px;
  position: relative;
  background: #0f1723;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border);
}
#bimCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#bimCanvas:active { cursor: grabbing; }
#bimCanvasEmpty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.bimTooltip {
  position: absolute;
  background: rgba(0,0,0,.85);
  color: #fff;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  pointer-events: none;
  z-index: 10;
}
.bimLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
}
.bimLegItem {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--muted);
  text-transform: capitalize;
}
.bimLegDot {
  width: 12px; height: 12px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

/* ── BIM Export Grid ──────────────────────────────────── */
.exportGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media(max-width:440px){ .exportGrid{ grid-template-columns: 1fr; } }
.exportCard {
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exportCardIcon  { font-size: 22px; }
.exportCardTitle { font-size: 13px; font-weight: 700; color: var(--text); }
.exportCardDesc  { font-size: 10.5px; color: var(--muted); line-height: 1.4; flex: 1; }

/* ── Mapbox GL container ──────────────────────────────── */
.mapboxContainer {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 520px;
  height: 380px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
}
@media(max-width:600px){
  .mapboxContainer { right:8px; bottom:8px; width:calc(100vw - 16px); height:300px; }
}
.mapboxHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--navy, #0d1b2a);
  flex-shrink: 0;
  gap: 8px;
  cursor: move;
  user-select: none;
}
.mapboxTitle {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: .02em;
}
.mapboxInfo {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 9px;
  color: rgba(255,255,255,.55);
  background: rgba(0,0,0,.4);
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 10;
}

/* Draggable Mapbox container */
.mapboxContainer[data-dragging="true"] { opacity: .92; }

/* ── PWA install button highlight ─────────────────────── */
.iconBtn[title*="Instalar"] {
  background: #16a34a22 !important;
  border-color: #16a34a !important;
  color: #16a34a !important;
  animation: pulseGreen 2s infinite;
}
@keyframes pulseGreen {
  0%,100% { box-shadow: 0 0 0 0 #16a34a44; }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

/* ── BIM tab on tab nav ───────────────────────────────── */
.tab[data-tab="BIM"] { color: var(--blue); }
.tab[data-tab="BIM"].active { color: var(--blue); }

/* ── Offline Banner ─────────────────────────────────── */
.offlineBanner {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99999;
  background: #d97706;
  color: white;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ══════════════════════════════════════════════════════
   V1 · SISTEMAS DE COORDENADAS CRS
══════════════════════════════════════════════════════ */

/* ── Selector CRS (panel encima de los inputs) ──────── */
.crsPanel {
  margin-bottom: 10px;
}

.crsGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  margin-bottom: 6px;
}

.crsBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  min-width: 72px;
}
.crsBtn:hover {
  border-color: var(--blue);
  background: var(--surface2);
}
.crsBtn.active {
  border-color: var(--blue);
  background: #dbeafe44;
  box-shadow: 0 0 0 2px #1d4ed833;
}
body.dark-mode .crsBtn.active {
  background: #1e3a5f55;
}
.crsBtnFlag  { font-size: 14px; line-height: 1; }
.crsBtnName  { font-size: 11px; font-weight: 700; color: var(--text); }
.crsBtnEpsg  { font-size: 9px;  color: var(--muted); font-family: monospace; }

.crsHint {
  font-size: 11px;
  color: var(--muted);
  padding: 5px 8px;
  background: var(--surface2);
  border-radius: 4px;
  border-left: 3px solid var(--blue);
  margin-top: 4px;
  line-height: 1.45;
}

/* ── Conversion preview (equiv. en otros sistemas) ──── */
.crsConvPreview {
  margin-top: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  font-size: 11px;
}
.crsPreviewTitle {
  font-weight: 700;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
}
.crsPreviewRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.crsPreviewRow:last-child { border-bottom: none; }
.crsPreviewLabel { color: var(--muted); flex-shrink: 0; min-width: 80px; }
.crsPreviewVal   { color: var(--text); text-align: right; }

/* ── Tab CRS — conversor interactivo ────────────────── */
.subsectionHead {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.crsConvGrid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: end;
}
@media(max-width:520px){ .crsConvGrid{ grid-template-columns: 1fr; } }

.crsConvArrow {
  font-size: 20px;
  color: var(--blue);
  text-align: center;
  padding-bottom: 6px;
  font-weight: 700;
}

.crsConvResult {
  margin-top: 12px;
}
.crsConvResultBox {
  background: var(--surface2);
  border: 1.5px solid var(--blue);
  border-radius: var(--r);
  padding: 12px 14px;
}
.crsConvResTitle {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 8px;
}
.crsConvResRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.crsConvResRow:last-child { border-bottom: none; }
.crsConvResLabel {
  font-size: 11px;
  color: var(--muted);
  min-width: 120px;
  flex-shrink: 0;
}
.crsConvResVal {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

/* ── Matrix de equivalencias ────────────────────────── */
.crsConvMatrix {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.crsConvMatTitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface2);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.crsMatRow {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 40px;
  gap: 6px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  align-items: center;
}
.crsMatRow:last-child { border-bottom: none; }
.crsMatFrom { background: #dbeafe22; }
.crsMatTo   { background: #dcfce722; font-weight: 700; }
.crsMatName  { color: var(--text); }
.crsMatVal   { color: var(--blue); }
.crsMatEpsg  { font-size: 9px; color: var(--muted); font-family: monospace; margin-left: 4px; }
.crsMatUnit  { color: var(--muted); font-size: 10px; text-align: right; }

/* ── Reference table ────────────────────────────────── */
.crsRefTable {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
}
.crsRefTable table { min-width: 560px; }

/* ── Tab CRS button color ───────────────────────────── */
.tab[data-tab="CRS"] { color: #7c3aed; }
.tab[data-tab="CRS"].active { color: #7c3aed; }

/* ══════════════════════════════════════════════════════
   V1 · VISOR 3D (Three.js)
══════════════════════════════════════════════════════ */

.v3dFps {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
  padding: 2px 6px;
}
.v3dStats {
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,.55);
  color: #93c5fd;
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
}
.v3dCatList {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.v3dCatItem {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--surface2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text);
  border: 1px solid var(--border);
}
.v3dCatDot  { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.v3dCatName { font-weight:600; }
.v3dCatCount{ color:var(--muted); font-size:10px; }
.tab[data-tab="Visor3D"] { color: #7dd3fc; }

/* ══════════════════════════════════════════════════════
   V1 · CESIUM
══════════════════════════════════════════════════════ */

.cesiumInfoBox {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--r);
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text);
}
.tab[data-tab="Cesium"] { color: #4ade80; }

/* ══════════════════════════════════════════════════════
   V1 · LEY 7/2022
══════════════════════════════════════════════════════ */

.ley7Header { background: linear-gradient(135deg, #eff6ff, #f0fdf4); }
body.dark-mode .ley7Header { background: linear-gradient(135deg, #1e2c3d, #14532d22); }

.ley7MetaBadge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.ley7BoeBadge {
  background: #dc2626;
  color: white;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 3px;
}
.ley7BoeRef   { font-family: var(--mono); font-size: 11px; color: var(--blue); font-weight:700; }
.ley7FechaVig { font-size: 10px; color: var(--muted); }

.ley7Titulo {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.4;
}
.ley7MetaGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.ley7MetaItem { display: flex; flex-direction: column; gap: 1px; }
.ley7MetaK    { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight:700; }
.ley7MetaV    { font-size: 11px; color: var(--text); }

.ley7RCDAlert {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 11px;
  color: #92400e;
}
body.dark-mode .ley7RCDAlert { background: #44330022; border-color: #d9770644; color: #fcd34d; }

/* ── Artículos ───────────────────────────────────────── */
.ley7Section { padding-top: 10px; }

.ley7Art {
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 6px;
  overflow: hidden;
  transition: box-shadow .15s;
}
.ley7Art:hover { box-shadow: 0 2px 8px rgba(29,78,216,.08); }
.ley7Destacado {
  border-color: #1d4ed8;
  background: #eff6ff08;
}
body.dark-mode .ley7Destacado { background: #1e3a5f22; }

.ley7ArtHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  background: var(--surface2);
  user-select: none;
  gap: 8px;
}
.ley7ArtHeader:hover { background: var(--surface); }
.ley7ArtTitle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.ley7ArtNum    { font-family: var(--mono); font-size: 10px; font-weight:700; color: var(--blue); flex-shrink:0; }
.ley7ArtTitulo { font-size: 12px; font-weight: 600; color: var(--text); }
.ley7ArtToggle { color: var(--muted); font-size: 10px; flex-shrink:0; }

.ley7RCDBadge {
  background: #1d4ed8;
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.ley7DestBadge {
  background: #d97706;
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ley7ArtBody  { padding: 10px 14px; border-top: 1px solid var(--border); }

.ley7ArtTexto {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-line;
  margin-bottom: 8px;
}
.ley7Nota {
  background: #fef3c7;
  border-left: 3px solid #d97706;
  border-radius: 0 4px 4px 0;
  padding: 6px 10px;
  font-size: 11px;
  color: #92400e;
  margin-bottom: 6px;
  font-weight: 600;
}
body.dark-mode .ley7Nota { background: #44330030; color: #fcd34d; border-color: #d97706; }

.ley7Tags     { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ley7Tag      { background: var(--surface2); border: 1px solid var(--border); padding: 1px 7px; border-radius: 10px; font-size: 9px; color: var(--muted); }

/* ── Tabla de definiciones ───────────────────────────── */
.ley7ExtTable { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.ley7ExtRow   { display: grid; grid-template-columns: 160px 1fr; gap: 8px; padding: 5px 6px; border-radius: 3px; }
.ley7ExtRow:nth-child(even) { background: var(--surface2); }
.ley7ExtMatch { background: #fef9c3 !important; }
body.dark-mode .ley7ExtMatch { background: #44330055 !important; }
.ley7ExtTerm  { font-size: 11px; font-weight: 700; color: var(--blue); }
.ley7ExtDef   { font-size: 11px; line-height: 1.5; color: var(--text); }
mark.ley7Mark { background: #fde047; padding: 0 2px; border-radius: 2px; }
body.dark-mode mark.ley7Mark { background: #854d0e; color: #fef08a; }

/* ── Tabla de obligaciones ───────────────────────────── */
.ley7ObliTable td:first-child { font-weight: 600; }
.ley7Umbral { font-size: 9px; color: var(--muted); margin-top: 2px; font-style: italic; }

/* ── Tab color ───────────────────────────────────────── */
.tab[data-tab="Ley7"] { color: #16a34a; }
.tab[data-tab="Ley7"].active { color: #16a34a; border-bottom-color: #16a34a; }

/* ══════════════════════════════════════════════════════
   V1 · MEJORAS UX GENERALES
══════════════════════════════════════════════════════ */

/* Loading progress bar */
#loadingBar {
  box-shadow: 0 0 8px #1d4ed888;
}

/* Better active tab indicator — color per tab */
.tab[data-tab="Visor3D"].active { border-bottom-color: #7dd3fc; }
.tab[data-tab="Cesium"].active  { border-bottom-color: #4ade80; }
.tab[data-tab="CRS"].active     { border-bottom-color: #7c3aed; }
.tab[data-tab="Ley7"].active    { border-bottom-color: #16a34a; }
.tab[data-tab="BIM"].active     { border-bottom-color: #f59e0b; }

/* V3D canvas focus ring */
#v3dCanvas:focus { outline: none; }
#v3dWrap:fullscreen { width: 100vw; height: 100vh; }
#v3dWrap:-webkit-full-screen { width: 100vw; height: 100vh; }

/* CRS panel subtle animation */
.crsBtn {
  transition: border-color .12s, background .12s, box-shadow .12s, transform .08s;
}
.crsBtn:active { transform: scale(.96); }

/* Ley7 search highlight pulse */
.ley7ExtMatch {
  animation: ley7Pulse .4s ease;
}
@keyframes ley7Pulse {
  0%   { background: #fef08a !important; }
  100% { background: #fef9c3 !important; }
}

/* Tab navigation keyboard shortcut tooltip */
.tab[data-tab]::after {
  content: attr(data-shortcut);
  display: none;
}

/* Better scrollbar for tabScroll */
.tabScroll::-webkit-scrollbar       { width: 4px; }
.tabScroll::-webkit-scrollbar-track { background: transparent; }
.tabScroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Cesium container loading state */
#cesiumContainer { transition: opacity .3s; }
#cesiumContainer.loading { opacity: .6; }

/* V3D stats overlay */
#v3dOverlay { pointer-events: none; }

/* tipBadge — info icon in labels */
.tipBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: var(--border);
  color: var(--muted);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════
   V1 · POLISH IDEAndalucía
══════════════════════════════════════════════════════ */

/* Section headers: blue accent left border */
.sectionHead {
  padding-left: 8px;
  border-left: 3px solid var(--ideBlue);
}
.snum {
  background: var(--ideBlue);
  color: white !important;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
}

/* Buttons: crisper IDE style */
.btnPrimary {
  background: var(--ideBlue);
  border-radius: 4px;
  font-size: 12px;
  letter-spacing: .01em;
}
.btnPrimary:hover { background: var(--ideBlueHov); }

.btnSecondary {
  background: var(--ideBlueLight);
  color: var(--ideBlue);
  border-color: rgba(26,111,160,.25);
  border-radius: 4px;
}
.btnSecondary:hover { background: #d0e9f5; }

/* Form inputs: cleaner */
.formInput {
  border-radius: 4px;
  font-size: 12px;
}
.formInput:focus {
  border-color: var(--ideBlue);
  box-shadow: 0 0 0 2px rgba(26,111,160,.15);
}

/* Tables: IDEAndalucía grid style */
.tblData thead tr {
  background: var(--ideBlue) !important;
  color: white !important;
}
.tblData thead th {
  color: white !important;
  font-weight: 600;
  font-size: 11px;
  padding: 8px 10px;
  letter-spacing: .02em;
  border: none !important;
}
.tblData tbody tr:nth-child(even) {
  background: var(--ideBlueLight) !important;
}
.tblData tbody tr:hover {
  background: #c8e3f0 !important;
}
body.dark-mode .tblData thead tr {
  background: #155d87 !important;
}
body.dark-mode .tblData tbody tr:nth-child(even) {
  background: rgba(26,111,160,.12) !important;
}
body.dark-mode .tblData tbody tr:hover {
  background: rgba(26,111,160,.2) !important;
}

/* Toast notifications: IDE style */
#toastMsg {
  background: var(--ideBlue) !important;
  border-left: 4px solid white !important;
  border-radius: 4px !important;
}

/* CRS buttons: use ideBlue accent */
.crsBtn.active {
  border-color: var(--ideBlue) !important;
  background: var(--ideBlueLight) !important;
  box-shadow: 0 0 0 2px rgba(26,111,160,.2) !important;
}
.crsBtnName { color: var(--ideBlue) !important; }

/* Leaflet popups IDE style */
.leaflet-popup-content-wrapper {
  border-top: 3px solid var(--ideBlue) !important;
}

/* BIM viewer toolbar */
.bimViewerToolbar {
  background: var(--ideBlue);
}
.bimViewerToolbar button {
  color: white !important;
  background: rgba(255,255,255,.12) !important;
  border-color: rgba(255,255,255,.2) !important;
}
.bimViewerToolbar button:hover {
  background: rgba(255,255,255,.25) !important;
}

/* Ley7 RCD badge */
.ley7RCDBadge {
  background: var(--ideBlue) !important;
}
.ley7BoeBadge {
  background: #c0392b !important;
}

/* Scrollbar style: IDE neutral */
* {
  scrollbar-width: thin;
  scrollbar-color: #c5d8e8 transparent;
}
*::-webkit-scrollbar       { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c5d8e8; border-radius: 3px; }
body.dark-mode *::-webkit-scrollbar-thumb { background: #2d4a5e; }

/* Section border: subtle IDE */
.section {
  border-left: 2px solid transparent;
  transition: border-color .15s;
}
.section:hover {
  border-left-color: var(--ideBlue);
}

/* IFC status bar */
.ifcStatus.ok   { color: var(--ideBlue); }
.ifcStatus.warn { color: #c0392b; }

/* Chips active IDE */
.chip:has(input:checked) { border-color: var(--ideBlue) !important; }
.chip.agreca:has(input:checked) { background: var(--ideBlueLight); color: var(--ideBlue); }

/* ══════════════════════════════════════════════════════════
   V1 · FONTELLO / FONT AWESOME 4 ICON SYSTEM
   Iconos de fuente en toda la interfaz
══════════════════════════════════════════════════════════ */

/* ── Tamaños y alineación base ──────────────────────────── */
.fa, [class^="ion-"], [class*=" ion-"] {
  vertical-align: middle;
  line-height: 1;
}

/* ── Topbar actions ─────────────────────────────────────── */
.tbBtn .fa, .tbBtn [class^="ion-"] {
  font-size: 15px;
  display: block;
}
#btnMenuToggle .fa {
  font-size: 16px;
  color: white;
}

/* ── Menú items ─────────────────────────────────────────── */
.menuIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  font-size: 15px;
  flex-shrink: 0;
  transition: color .12s, opacity .12s;
}
.menuItem .fa.menuIcon { opacity: .72; }
.menuItem:hover .fa.menuIcon,
.menuItem.active .fa.menuIcon { opacity: 1; }

/* ── Breadcrumb icon ────────────────────────────────────── */
#bcIcon {
  font-size: 14px !important;
  width: 18px;
  text-align: center;
  display: inline-block;
}

/* ── Botones con icono ──────────────────────────────────── */
.btnPrimary .fa,
.btnSecondary .fa,
.btnGhost .fa,
.btnTool .fa { margin-right: 5px; font-size: 12px; }

/* ── Toast con icono ────────────────────────────────────── */
#toastMsg::before {
  font-family: FontAwesome;
  content: "\f05a"; /* fa-info-circle */
  margin-right: 7px;
  opacity: .85;
  font-size: 13px;
}

/* ── Section numbers — opcionalmente icon font ──────────── */
.snum-icon {
  font-family: FontAwesome;
  background: var(--ideBlue);
  color: white;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 12px;
  flex-shrink: 0;
}

/* ── Status badges ──────────────────────────────────────── */
.ifcStatus::before,
.v3dStatus::before {
  font-family: FontAwesome;
  margin-right: 5px;
}
.ifcStatus.ok::before   { content: "\f00c"; color: var(--ideBlue); } /* fa-check */
.ifcStatus.warn::before { content: "\f071"; color: #c0392b; }       /* fa-warning */
.ifcStatus.pending::before { content: "\f110"; color: var(--muted); } /* fa-spinner */

/* ── Catastro WMS badge ─────────────────────────────────── */
.menuItemBtn .fa { font-size: 13px; color: var(--muted); }

/* ── menuSectionHead ────────────────────────────────────── */
.menuSectionHead .fa {
  font-size: 11px;
  color: var(--muted);
  transition: transform .2s;
}
.menuSectionHead.collapsed .fa.menuChevron {
  transform: rotate(-90deg);
}

/* ── Panel breadcrumb icon for each tab ─────────────────── */
#panelBreadcrumb .fa {
  font-size: 14px;
  color: var(--ideBlue);
}

/* ── CRS Buttons ─────────────────────────────────────────── */
.crsBtnFlag .fa { font-size: 16px; }

/* ── Ley 7 art toggle arrows ─────────────────────────────── */
.ley7ArtToggle {
  font-family: FontAwesome;
  font-size: 10px;
  color: var(--muted);
}

/* ── Results / ranking rows ─────────────────────────────── */
.rankRow::before {
  font-family: FontAwesome;
  content: "\f041"; /* fa-map-marker */
  color: var(--ideBlue);
  margin-right: 4px;
  font-size: 11px;
}

/* ── Chips icon ─────────────────────────────────────────── */
.chip .fa { font-size: 11px; }

/* ── Offline banner icon ────────────────────────────────── */
.offlineBanner::before {
  font-family: FontAwesome;
  content: "\f127"; /* fa-chain-broken */
  margin-right: 8px;
  font-size: 14px;
}

/* ── Form labels with icon prefix ───────────────────────── */
.formLabelIcon .fa {
  color: var(--ideBlue);
  margin-right: 4px;
  font-size: 11px;
  opacity: .8;
}

/* ── Loading progress bar pulse ─────────────────────────── */
#loadingBar::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  animation: barShine 1s infinite;
}
@keyframes barShine {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ── Menu item badges (Fontello-style chips) ─────────────── */
.menuBadge .fa { font-size: 9px; }

/* ── Dark mode icon adjustments ─────────────────────────── */
body.dark-mode .menuIcon { opacity: .65; }
body.dark-mode .menuItem:hover .menuIcon,
body.dark-mode .menuItem.active .menuIcon { opacity: 1; }
body.dark-mode .tbBtn .fa { color: rgba(255,255,255,.8); }

/* ── Ionicons usage (complementary set) ─────────────────── */
/* ion-ios-* iconos para secciones específicas si se usan */
.ion-ios-briefcase-outline,
.ion-ios-map-outline,
.ion-ios-analytics { font-size: 15px; }


/* ══════════════════════════════════════════════════════
   V1 · AJUSTES SPLIT-PANEL FINALES
══════════════════════════════════════════════════════ */

/* contentPanel es el contexto posicionado para #map */
#contentPanel { position: relative; }

/* tabPane con fondo opaco (por encima del mapa) */
.tabPane {
  background: var(--bg);
}
/* El tab Config y otros que tienen mapa: fondo transparente
   para que se vea el mapa debajo al hacer scroll */
#tabConfig.tabPane.active,
#tabResults.tabPane.active,
#tabAnalisis.tabPane.active {
  background: transparent;
}
/* ════════════════════════════════════════════════════════
   V1 — NUEVOS COMPONENTES
   tipo obra select · sub-acordeón · modal progreso · coords
════════════════════════════════════════════════════════ */

/* ── 1. TIPO OBRA SELECT ─────────────────────────────────── */
.tipoObraSelectWrap {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
  background: var(--surface2);
}
.tipoObraSelectWrap:focus-within {
  border-color: var(--ideBlue);
  box-shadow: 0 0 0 3px rgba(26,111,160,.12);
}
.tipoObraSelectIcon {
  padding: 0 12px;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26,111,160,.08);
  border-right: 1px solid var(--border);
  pointer-events: none;
  user-select: none;
  min-width: 48px;
}
.tipoObraSelect {
  flex: 1;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  -webkit-appearance: auto;
  appearance: auto;
}
.tipoObraSelect:focus { outline: none; }
.tipoObraHintInline {
  font-size: 11px;
  color: var(--muted);
  padding: 5px 9px;
  background: var(--ideBlueLight, #e8f4f9);
  border-left: 3px solid var(--ideBlue);
  border-radius: 0 0 var(--r) var(--r);
  line-height: 1.45;
  margin-top: 2px;
}
.tipoObraHintInline:empty { display: none; }
body.dark-mode .tipoObraSelectIcon { background: rgba(26,111,160,.15); }
body.dark-mode .tipoObraSelect { color: var(--text); }

/* ── 2. SUB-ACORDEÓN — mismo estilo que los ítems del menú principal ── */
.subAccItem {
  /* Igual que .menuItem */
  display: block;
  border-bottom: 1px solid var(--border2);
}
.subAccHead {
  /* Idéntico a .menuItem */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  border-left: 3px solid transparent;
  transition: background .1s, color .1s, border-color .1s;
  user-select: none;
  background: var(--surface);
}
.subAccHead:hover {
  background: #f0f7fc;
  color: var(--ideBlue);
  border-left-color: var(--ideBlue);
}
.subAccItem.open > .subAccHead {
  background: #e8f4f9;
  color: var(--ideBlue);
  border-left-color: var(--ideBlue);
  font-weight: 600;
}
/* Icono de número/badge — igual que .menuIcon */
.subAccNum {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: var(--muted);
  color: white;
  border-radius: 4px;
  font-size: 10px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  transition: background .1s;
}
.subAccItem.open > .subAccHead .subAccNum { background: var(--ideBlue); }
.subAccHead:hover .subAccNum { background: var(--ideBlue); }

.subAccLabel {
  flex: 1;
  line-height: 1.35;
}
/* Flecha — igual que .menuArrow, apunta a la derecha cuando cerrado */
.subAccArrow {
  font-size: 13px;
  color: var(--dim);
  flex-shrink: 0;
  transition: transform .22s ease, color .15s;
}
/* Cuando está abierto, la flecha rota 90° (apunta abajo) */
.subAccItem.open > .subAccHead .subAccArrow {
  transform: rotate(90deg);
  color: var(--ideBlue);
}
.subAccHead:hover .subAccArrow {
  color: var(--ideBlue);
}

/* Cuerpo del sub-acordeón */
.subAccBody {
  max-height: 0;
  overflow: hidden;
  transition: max-height .32s cubic-bezier(.4,0,.2,1);
  background: var(--surface2);
  border-left: 3px solid var(--ideBlue);
}
.subAccBody.subAccOpen {
  max-height: 9999px;
  transition: max-height .48s cubic-bezier(.4,0,.2,1);
}
.subAccBody .section {
  margin: 8px 10px;
  border-radius: var(--r);
}
.subAccBody .section:last-child { margin-bottom: 10px; }

/* Dark mode */
body.dark-mode .subAccHead { background: var(--surface); }
body.dark-mode .subAccItem.open > .subAccHead { background: rgba(26,111,160,.18); }
body.dark-mode .subAccBody { background: var(--surface2); }

/* ── 3. MODAL DE PROGRESO CENTRAL ────────────────────────── */
.progressModal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: pmFadeIn .2s ease;
}
@keyframes pmFadeIn { from { opacity: 0; } to { opacity: 1; } }

.progressModalBox {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28), 0 4px 16px rgba(0,0,0,.14);
  padding: 28px 32px 24px;
  width: min(440px, 92vw);
  animation: pmSlideUp .24s cubic-bezier(.4,0,.2,1);
}
@keyframes pmSlideUp {
  from { transform: translateY(14px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)   scale(1);    opacity: 1; }
}

.progressModalHeader {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 22px;
}
.progressModalIcon {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(26,111,160,.1);
  color: var(--ideBlue);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.progressModalTitle {
  font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2;
}
.progressModalSub {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  font-family: 'JetBrains Mono', monospace;
}
.progressModalBarWrap {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
}
.progressModalBar {
  flex: 1; height: 14px; background: var(--surface3);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.progressModalFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--ideBlue) 0%, #4ade80 100%);
  border-radius: 999px;
  transition: width .28s ease;
  position: relative; overflow: hidden;
}
.progressModalFill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.3) 50%, transparent 100%);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-200%); }
  to   { transform: translateX(200%); }
}
.progressModalPct {
  font-size: 20px; font-weight: 800; color: var(--ideBlue);
  min-width: 52px; text-align: right;
  font-family: 'JetBrains Mono', monospace;
}
.progressModalEta {
  font-size: 10px; color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  min-height: 16px; margin-bottom: 18px;
}
.progressModalFooter { display: flex; justify-content: flex-end; }
.btnDanger {
  padding: 8px 16px;
  background: transparent;
  color: var(--red); border: 1.5px solid var(--red);
  border-radius: var(--r); cursor: pointer; font-size: 12px;
  font-family: 'Inter', sans-serif; font-weight: 600;
  transition: background .12s, color .12s;
  display: flex; align-items: center; gap: 6px;
}
.btnDanger:hover { background: var(--redBg); }
body.dark-mode .progressModalBox { background: var(--surface); }

/* ── 4. BARRA COORDENADAS CURSOR ─────────────────────────── */
.mapCoordBar {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  pointer-events: none;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  max-width: 90vw; overflow: hidden;
}
body.dark-mode .mapCoordBar {
  background: rgba(22,27,34,.94);
  border-color: var(--border);
}
.mapCRSBadge {
  background: var(--ideBlue); color: white;
  padding: 2px 7px; border-radius: 3px;
  font-size: 9px; font-weight: 700;
  letter-spacing: .05em; flex-shrink: 0;
}
.mapCoordText { color: var(--text); font-size: 11px; font-weight: 500; }
.mapCoordDivider { color: var(--border); font-size: 14px; }
.mapZoomBadge { color: var(--muted); font-size: 10px; flex-shrink: 0; }

/* ── 5. LEAFLET SCALE CONTROL STYLE ─────────────────────── */
.leaflet-control-scale-line {
  background: rgba(255,255,255,.92) !important;
  border: 1.5px solid var(--ideBlue) !important;
  border-top: none !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10px !important; font-weight: 600 !important;
  color: var(--ideBlue) !important;
  padding: 2px 6px !important;
  border-radius: 0 0 4px 4px !important;
}
body.dark-mode .leaflet-control-scale-line {
  background: rgba(22,27,34,.92) !important;
  color: #58a6ff !important;
  border-color: #58a6ff !important;
}

/* ── 6. MAPANEL coord bar — see main #mapPanel rule above ── */


/* ════════════════════════════════════════════════════════════════
   V1 — UX INTERACTIVO
   Tooltips ricos · Iconos ayuda · Badges estado · Workflow · Tour
════════════════════════════════════════════════════════════════ */

/* ── TOOLTIP RICO (popover flotante) ────────────────────────── */
#uxTooltip {
  display: none;
  position: fixed;
  z-index: 10000;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
  font-size: 12px;
  opacity: 0;
  transform: translateY(-4px) scale(.97);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
#uxTooltip.uxTipVisible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.uxTipHeader {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border2);
  border-radius: 10px 10px 0 0;
}
.uxTipBadge {
  display: inline-block;
  font-size: 9px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px;
  margin-bottom: 4px; letter-spacing: .04em;
}
.uxTipTitle {
  font-size: 13px; font-weight: 700;
  color: var(--text); line-height: 1.3;
}
.uxTipBody {
  padding: 8px 14px;
  font-size: 11.5px; line-height: 1.65;
  color: var(--muted);
  white-space: pre-line;
}
.uxTipSteps {
  margin: 0 14px 8px; padding-left: 18px;
  font-size: 11px; color: var(--muted); line-height: 1.7;
}
.uxTipSteps li::marker { color: var(--ideBlue); font-weight: 700; }
.uxTipClose {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--dim); font-size: 11px; padding: 3px 6px;
  border-radius: 3px; transition: color .12s, background .12s;
}
.uxTipClose:hover { color: var(--text); background: var(--surface2); }

/* ── BOTONES DE AYUDA ─────────────────────────────────────── */
/* ⓘ en cabeceras de sección */
.helpBtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: var(--ideBlueLight, #e8f4f9);
  color: var(--ideBlue);
  border: 1px solid rgba(26,111,160,.25);
  border-radius: 50%;
  font-size: 10px; cursor: pointer;
  transition: background .12s, transform .1s;
  vertical-align: middle; flex-shrink: 0;
  margin-left: 6px; line-height: 1;
}
.helpBtn:hover {
  background: var(--ideBlue); color: white;
  transform: scale(1.15);
}

/* ⓘ pequeño en labels de formulario */
.helpBtnSmall {
  display: inline-flex; align-items: center;
  background: none; border: none;
  color: var(--dim); font-size: 11px; cursor: pointer;
  margin-left: 4px; padding: 0;
  transition: color .12s; vertical-align: middle;
}
.helpBtnSmall:hover { color: var(--ideBlue); }

/* ? en items del menú (visible en hover) */
.menuHelpBtn {
  background: none; border: none;
  color: var(--dim); font-size: 12px; cursor: pointer;
  padding: 0 3px; flex-shrink: 0;
  opacity: 0;
  transition: opacity .12s, color .12s;
  line-height: 1;
}
.menuItem:hover .menuHelpBtn { opacity: 1; }
.menuItem.active .menuHelpBtn { opacity: .5; }
.menuHelpBtn:hover { color: var(--ideBlue) !important; opacity: 1 !important; }

/* ── BADGES DE ESTADO en items del menú ──────────────────── */
.sectionStatusBadge {
  font-size: 9px; font-weight: 600;
  padding: 2px 6px; border-radius: 8px;
  flex-shrink: 0; margin-left: 2px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .02em;
  transition: all .3s ease;
}
.status-pending { background: var(--surface3); color: var(--muted); }
.status-ok      { background: #dcfce7; color: #16a34a; }
.status-active  { background: #fef3c7; color: #b45309;
  animation: statusPulse 1.4s ease-in-out infinite; }
.status-warn    { background: #fee2e2; color: #dc2626; }
@keyframes statusPulse {
  0%,100% { opacity: 1; } 50% { opacity: .5; }
}
body.dark-mode .status-ok { background: rgba(22,163,74,.2); }
body.dark-mode .status-active { background: rgba(180,83,9,.2); }

/* ── BARRA DE WORKFLOW (5 pasos) ─────────────────────────── */
.workflowBar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 10px 4px;
  gap: 0;
  overflow: visible;
}
.wfStep {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; flex: 1; position: relative; cursor: default;
}
.wfStepIcon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border: 2px solid var(--border);
  background: var(--surface2); color: var(--dim);
  transition: all .25s ease; position: relative; z-index: 1;
}
.wfStepLabel {
  font-size: 9px; font-weight: 600; color: var(--dim);
  text-align: center; text-transform: uppercase; letter-spacing: .04em;
  transition: color .25s;
}
.wfConnector {
  position: absolute;
  top: 15px;
  left: calc(50% + 15px);
  right: calc(-50% + 15px);
  height: 2px;
  background: var(--border);
  transition: background .3s;
}
/* Done */
.wfStep.done .wfStepIcon  { background: #dcfce7; border-color: #16a34a; color: #16a34a; }
.wfStep.done .wfStepLabel { color: #16a34a; }
.wfStep.done .wfConnector { background: #16a34a; }
/* Active */
.wfStep.active .wfStepIcon {
  background: var(--ideBlueLight, #e8f4f9);
  border-color: var(--ideBlue); color: var(--ideBlue);
  box-shadow: 0 0 0 4px rgba(26,111,160,.12);
  animation: wfPulse 2s ease-in-out infinite;
}
.wfStep.active .wfStepLabel { color: var(--ideBlue); font-weight: 700; }
@keyframes wfPulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(26,111,160,.12); }
  50%     { box-shadow: 0 0 0 8px rgba(26,111,160,.05); }
}

/* ── ONBOARDING TOUR ─────────────────────────────────────── */
.tourOverlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.38);
  z-index: 8000;
  pointer-events: none;
}
.tourBox {
  position: fixed; z-index: 8001;
  width: 320px;
  background: var(--surface);
  border: 1.5px solid var(--ideBlue);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,.25);
  padding: 16px;
  opacity: 0;
  transform: scale(.95) translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}
.tourBox.tourBoxVisible { opacity: 1; transform: scale(1) translateY(0); }
.tourHeader {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.tourCounter {
  font-size: 10px; font-weight: 700; color: var(--ideBlue);
  font-family: 'JetBrains Mono', monospace;
  background: rgba(26,111,160,.1); padding: 2px 8px; border-radius: 10px;
}
.tourClose {
  background: none; border: none; cursor: pointer;
  color: var(--dim); font-size: 13px; padding: 2px 6px;
  border-radius: 4px; transition: color .12s;
}
.tourClose:hover { color: var(--text); background: var(--surface2); }
.tourTitle { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.tourText  { font-size: 12px; line-height: 1.6; color: var(--muted); margin-bottom: 12px; }
.tourProgress { display: flex; gap: 5px; margin-bottom: 12px; }
.tourDot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: background .2s; }
.tourDotActive { background: var(--ideBlue); }
.tourDotDone   { background: #16a34a; }
.tourActions   { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tourHighlight {
  outline: 3px solid var(--ideBlue) !important;
  outline-offset: 4px; border-radius: 4px;
  animation: tourGlow .9s ease-in-out infinite alternate;
  position: relative; z-index: 8005;
}
@keyframes tourGlow {
  from { outline-color: var(--ideBlue); }
  to   { outline-color: #7dd3fc; }
}

/* ── RIPPLE en botones primarios ─────────────────────────── */
.btnPrimary { overflow: hidden; position: relative; }
.btnRipple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.3);
  transform: scale(0);
  animation: rippleAnim .5s linear;
  pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ── SECCIONES: fade-in al abrir acordeón ────────────────── */
.subAccBody.subAccOpen .section {
  animation: secFadeIn .2s ease both;
}
.subAccBody.subAccOpen .section:nth-child(2) { animation-delay: .05s; }
.subAccBody.subAccOpen .section:nth-child(3) { animation-delay: .10s; }
@keyframes secFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── HOVER sutil en secciones ────────────────────────────── */
.accContent .section,
.subAccBody .section {
  transition: box-shadow .15s, border-color .15s;
}
.accContent .section:hover,
.subAccBody .section:hover {
  box-shadow: 0 4px 16px rgba(26,111,160,.08);
  border-color: rgba(26,111,160,.2);
}

/* ── KEYBOARD HELP MODAL ─────────────────────────────────── */
.kbHelpModal {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.kbHelpModal.kbHelpVisible { opacity: 1; }
.kbHelpBox {
  background: var(--surface); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: min(440px,95vw); overflow: hidden;
}
.kbHelpHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--ideBlue);
  color: white; font-size: 13px; font-weight: 600;
}
.kbHelpClose {
  background: rgba(255,255,255,.15); border: none; border-radius: 4px;
  color: white; cursor: pointer; padding: 3px 8px; font-size: 13px;
}
.kbHelpClose:hover { background: rgba(255,255,255,.25); }
.kbHelpTable { width: 100%; border-collapse: collapse; }
.kbHelpTable tr { border-bottom: 1px solid var(--border2); }
.kbHelpTable tr:last-child { border-bottom: none; }
.kbKeys { padding: 10px 18px; font-size: 12px; white-space: nowrap; width: 160px; }
.kbDesc { padding: 10px 18px; font-size: 12px; color: var(--muted); }
kbd {
  display: inline-block; background: var(--surface2);
  border: 1px solid var(--border); border-bottom: 2px solid var(--border);
  border-radius: 4px; padding: 1px 7px; font-size: 11px;
  font-family: 'JetBrains Mono', monospace; color: var(--text);
}
.kbHelpFooter {
  padding: 10px 18px; font-size: 10px; color: var(--dim);
  background: var(--surface2); border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
}


/* ════════════════════════════════════════════════════════════
   V1 — MATERIAL A TRATAR / MATERIAL A USAR
   Dos flujos · BCCA cards · flow badges · ranking usar
════════════════════════════════════════════════════════════ */

/* ── Info tipo obra por flujo ──────────────────────────────── */
.flowTipoInfo { margin-bottom: 10px; }
.flowTipoBadge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid currentColor;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  line-height: 1.3;
}
.flowTipoDisabled {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--surface3);
  color: var(--muted);
  border-radius: 20px;
  font-size: 11px;
  font-style: italic;
}

/* ── Bloques de cálculo en §05 ─────────────────────────────── */
.calcFlowBlock {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface2);
}
.calcFlowBlock:last-child { margin-bottom: 0; }
.calcFlowHeader {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.calcFlowBadge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  color: white; font-size: 11px; font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.calcFlowTitle {
  font-size: 12px; font-weight: 600; color: var(--text);
  flex: 1; line-height: 1.3;
}

/* Color del btnRun para Material a Usar */
.btnRunUsar {
  background: linear-gradient(135deg, #b45309, #d97706) !important;
}
.btnRunUsar:hover { opacity: .92; }
.btnRunUsar.running { opacity: .7; }

/* ── BCCA Cards ────────────────────────────────────────────── */
.bccaCards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}
@media(max-width:420px) { .bccaCards { grid-template-columns: 1fr; } }

.bccaCard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.bccaCard:hover {
  border-color: var(--amber);
  background: #fef9f0;
  box-shadow: 0 2px 8px rgba(180,83,9,.1);
}
.bccaCard.active {
  border-color: var(--amber);
  background: #fef3c7;
  box-shadow: 0 0 0 2px rgba(180,83,9,.15);
}
body.dark-mode .bccaCard.active {
  background: rgba(180,83,9,.15);
  border-color: #d97706;
}
.bccaIcon { font-size: 20px; line-height: 1; }
.bccaLabel {
  font-size: 12px; font-weight: 700;
  color: var(--text);
}
.bccaCard.active .bccaLabel { color: var(--amber); }

/* ── Usar ranking ──────────────────────────────────────────── */
.usarRankingWrap {
  margin-top: 10px;
}
.usarRankingHeader {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.usarRankingTitle {
  font-size: 12px; font-weight: 700; color: var(--amber);
}
.usarMatList {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 8px;
}
.usarMatItem {
  display: flex; align-items: flex-start; gap: 6px;
  flex-wrap: wrap;
  padding: 4px 6px;
  background: var(--surface2);
  border-radius: 4px;
  font-size: 11px;
}
.usarMatBadge {
  font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.usarMat-agreca { background: #dbeafe; color: #1d4ed8; }
.usarMat-bio    { background: #dcfce7; color: #16a34a; }
.usarMat-bajo   { background: #ede9fe; color: #7c3aed; }
.usarMatName { font-weight: 600; color: var(--text); }
.usarMatEPD {
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 2px;
  background: #fef3c7; color: #92400e;
  font-family: 'JetBrains Mono', monospace;
}
.usarMatDesc { font-size: 10px; color: var(--muted); flex-basis: 100%; }

/* ── Progress bar uso ──────────────────────────────────────── */
#progressTrackUsar {
  height: 6px; background: var(--surface3);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border); margin-top: 6px;
}
#progressFillUsar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #b45309, #d97706);
  border-radius: 999px; transition: width .25s;
}
#progressTextUsar {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--muted); margin-top: 3px;
}


/* ════════════════════════════════════════════════════════
   V1 — NUEVOS COMPONENTES
   UTM · Roles · Modelos A/B · Saturación · DGT
════════════════════════════════════════════════════════ */

/* ── UTM Display ─────────────────────────────────────── */
.utmDisplay {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 6px 10px; margin-top: 6px;
  background: rgba(26,111,160,.06); border: 1px solid rgba(26,111,160,.2);
  border-radius: var(--r);
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
.utmLabel {
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  background: var(--ideBlue); color: white;
  padding: 1px 6px; border-radius: 3px; flex-shrink: 0;
}
.utmValue { color: var(--text); font-weight: 600; }
.utmZone  { color: var(--muted); font-size: 10px; }

/* ── Roles ───────────────────────────────────────────── */
#roleSelector {
  padding: 10px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.roleSelectorTitle {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 7px;
}
.roleCards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.roleCard {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 6px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--r);
  cursor: pointer; font-family: inherit;
  transition: border-color .12s, background .12s;
}
.roleCard:hover { border-color: var(--ideBlue); background: #f0f7fc; }
.roleCard.active {
  border-color: var(--ideBlue); background: #e8f4f9;
  box-shadow: 0 0 0 2px rgba(26,111,160,.12);
}
.roleIcon  { font-size: 18px; line-height: 1; }
.roleLabel { font-size: 10px; font-weight: 700; color: var(--text); text-align: center; }
.roleDesc  { font-size: 9px; color: var(--muted); text-align: center; line-height: 1.2; }
.roleCard.active .roleLabel { color: var(--ideBlue); }
.activeRoleLabel { font-size: 10px; color: var(--ideBlue); font-weight: 600; text-align: center; padding: 3px 0; }
body.dark-mode .roleCard.active { background: rgba(26,111,160,.18); }

/* ── Modelos A/B ─────────────────────────────────────── */
.routeModelCards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; margin-bottom: 6px; }
.routeModelCard {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 8px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--r);
  cursor: pointer; font-family: inherit; text-align: center;
  transition: border-color .12s, background .12s;
}
.routeModelCard:hover { border-color: var(--ideBlue); background: #f0f7fc; }
.routeModelCard.active { border-color: var(--ideBlue); background: #e8f4f9; box-shadow: 0 0 0 2px rgba(26,111,160,.12); }
.routeModelIcon  { font-size: 20px; line-height: 1; }
.routeModelLabel { font-size: 12px; font-weight: 700; color: var(--text); }
.routeModelSub   { font-size: 10px; color: var(--muted); }
.routeModelCard.active .routeModelLabel { color: var(--ideBlue); }
.routeModelDesc {
  font-size: 11px; color: var(--muted); line-height: 1.5;
  padding: 5px 8px; background: #e8f4f9;
  border-left: 3px solid var(--ideBlue); border-radius: 0 4px 4px 0;
}
.modeloResult { margin-top: 10px; }
.modeloResultHeader {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r) var(--r) 0 0; font-size: 12px; font-weight: 700;
}
.modeloResultMeta { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.modeloResultList { margin: 0; padding: 0 0 0 18px; background: var(--surface2); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--r) var(--r); }
.modeloResultList li { padding: 4px 8px; font-size: 11px; border-bottom: 1px solid var(--border2); display: flex; justify-content: space-between; }
.modeloResultList li:last-child { border-bottom: none; }
.modeloStopMeta { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ── DGT ─────────────────────────────────────────────── */
.dgtRow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dgtInfo {
  font-size: 10px; font-weight: 600; padding: 3px 8px;
  background: #fef3c7; color: #92400e;
  border: 1px solid #d97706; border-radius: 10px; white-space: nowrap;
}

/* ── Saturación ──────────────────────────────────────── */
.satWidget {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 12px; margin: 8px 0;
}
.satWidgetHeader { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.satWidgetTitle  { font-size: 11px; font-weight: 700; color: var(--text); }
.satGlobal       { font-size: 13px; font-weight: 700; }
.satBarWrap      { height: 8px; background: var(--surface3); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.satBar          { height: 100%; border-radius: 999px; transition: width .3s; }
.satPerPlant     { display: flex; flex-direction: column; gap: 3px; }
.satPlantRow     { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10px; }
.satPlantName    { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.satPlantBadge   { font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
.sat-bajo     { background: #dcfce7; color: #16a34a; }
.sat-medio    { background: #fef3c7; color: #92400e; }
.sat-alto     { background: #fee2e2; color: #dc2626; }
.sat-saturado { background: #dc2626; color: white; }
.sat-unknown  { background: var(--surface3); color: var(--muted); }

/* ════════════════════════════════════════════════════════
   V1 — WFS STATUS BAR
════════════════════════════════════════════════════════ */
.wfsStatusBar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--r);
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--surface2);
  margin: 6px 0;
}
.wfsDot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.wfsDot-loading { background: #d97706; animation: wfsPulse 1s infinite; }
.wfsDot-ok      { background: #16a34a; }
.wfsDot-error   { background: #dc2626; }
@keyframes wfsPulse {
  0%,100% { opacity:1; } 50% { opacity:.3; }
}

/* ════════════════════════════════════════════════════════
   V1 — MATERIAL A USAR: RUTAS · RANKING · DETALLE
════════════════════════════════════════════════════════ */

/* ── Chips de tipo de proveedor ──────────────────────── */
.usarTypeChips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0;
}
.usarTypeChip {
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 10px;
}

/* ── Tabla ranking usar ──────────────────────────────── */
.usarRankTable tbody tr.usarRankRow:hover {
  background: var(--ideBlueLight, #e8f4f9);
  cursor: pointer;
}
.usarRankTable tbody tr.usarRankRowSelected {
  background: #e8f4f9;
  outline: 2px solid var(--ideBlue);
  outline-offset: -2px;
}
.usarRankingMeta {
  font-size: 10px; color: var(--muted);
  font-style: italic;
}

/* ── Detalle de ruta seleccionada ────────────────────── */
.usarRouteDetailBox {
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--r);
  border: 1px solid var(--border);
}
.usarRouteDetailTitle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
  margin-bottom: 10px;
}
.usarRouteDetailGrid {
  display: grid; grid-template-columns: auto 1fr;
  gap: 4px 16px; font-size: 11px;
  margin-bottom: 8px;
}
.usarRouteDetailGrid span { color: var(--muted); }
.usarRouteDetailGrid strong { font-weight: 600; }
.usarRouteDetailMaterial {
  font-size: 10px; color: var(--muted);
  padding: 4px 8px; background: var(--surface2);
  border-radius: 4px; margin-bottom: 8px;
}
.usarRouteDetailActions { display: flex; gap: 8px; }
.fallbackWarn {
  font-size: 10px; color: #d97706;
  background: #fef3c7; padding: 3px 8px;
  border-radius: 4px; margin-bottom: 8px;
}

/* ════════════════════════════════════════════════════════
   V1 — SIRA STATS PANEL + STATUS
════════════════════════════════════════════════════════ */
.siraStatsPanel {
  background: var(--surface2);
  border: 1px solid rgba(22,163,74,.25);
  border-radius: var(--r);
  padding: 8px 10px;
  margin: 8px 0;
  font-size: 11px;
}
.siraStatsHeader {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; color: var(--text); margin-bottom: 6px;
}
.siraStatsBody { display: flex; flex-direction: column; gap: 3px; }
.siraStatRow {
  display: flex; align-items: center; gap: 6px; font-size: 10px;
}
.siraStatProv { width: 68px; color: var(--muted); flex-shrink: 0; }
.siraStatBar  {
  flex: 1; height: 6px; background: var(--surface3);
  border-radius: 999px; overflow: hidden;
}
.siraStatBar span {
  display: block; height: 100%; border-radius: 999px;
  transition: width .4s ease;
}
.siraStatN { width: 24px; text-align: right; font-family: 'JetBrains Mono',monospace; color: var(--text); }
.siraLoadStatus {
  margin-top: 5px; font-size: 10px; color: var(--muted);
}

/* ════════════════════════════════════════════════════════
   V1 — LAYER VISIBILITY BADGE + ROUTE DETAIL CARD
════════════════════════════════════════════════════════ */
.layerVisibilityBadge {
  position: absolute;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 10px;
  pointer-events: none;
  z-index: 900;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
body.dark-mode .layerVisibilityBadge { background: rgba(30,44,61,.9); }

.routeDetailCard {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ideBlue);
  border-radius: var(--r);
  font-size: 11px;
}
.routeDetailTitle {
  font-size: 13px; font-weight: 700;
  margin-bottom: 8px;
}
.routeDetailGrid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin-bottom: 6px;
}
.routeDetailGrid span { color: var(--muted); }
.routeDetailGrid strong { font-weight: 600; }
.routeDetailActions { margin-top: 6px; }

/* ════════════════════════════════════════════════════════
   V1 — SEPARADORES DE FLUJO TRATAR / USAR
════════════════════════════════════════════════════════ */
.calcFlowSeparator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r);
  margin: 10px 0 6px;
}
.calcFlowSepTratar {
  background: rgba(26,111,160,.07);
  border: 1.5px solid rgba(26,111,160,.25);
}
.calcFlowSepUsar {
  background: rgba(22,163,74,.07);
  border: 1.5px solid rgba(22,163,74,.25);
}
.calcFlowSepIcon {
  font-size: 16px; flex-shrink: 0;
}
.calcFlowSepLabel {
  font-size: 12px; font-weight: 700; color: var(--text);
}
.calcFlowSepDesc {
  font-size: 10px; color: var(--muted); margin-left: auto;
  text-align: right; line-height: 1.3;
}
@media(max-width:380px) { .calcFlowSepDesc { display:none; } }

/* ════════════════════════════════════════════════════════
   V1 — LEYENDA TOP-RIGHT: group headers
════════════════════════════════════════════════════════ */
.legGroupHeader {
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
  padding: 6px 2px 3px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.legGroupHeader:first-child { border-top: none; padding-top: 2px; }
.legGroupHeaderUsar { color: var(--muted); }

/* Legend control top-right positioning */
.leaflet-top.leaflet-right .leaflet-control-layers {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

/* ══════════════════════════════════════════════
   V1 — Estilos adicionales
══════════════════════════════════════════════ */

/* Botón USAR (variante verde del btnRun) */
.btnRunUsar {
  background: linear-gradient(135deg, #15803d, #16a34a) !important;
  box-shadow: 0 2px 8px rgba(21,128,61,.35) !important;
}
.btnRunUsar:hover {
  background: linear-gradient(135deg, #166534, #15803d) !important;
}
.btnRunUsar.running {
  background: linear-gradient(135deg, #14532d, #166534) !important;
}

/* Barras de progreso individuales */
#progressWrapTratar, #progressWrapUsar {
  padding: 4px 0 6px;
}
#progressTrackTratar, #progressTrackUsar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0 4px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
}
#progressFillTratar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #1a6fa0, #2563eb, #38bdf8);
  background-size: 200% 100%;
  border-radius: 4px;
  transition: width .28s ease;
  animation: shimmerBar 1.8s linear infinite;
}
#progressFillUsar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #15803d, #16a34a, #4ade80);
  background-size: 200% 100%;
  border-radius: 4px;
  transition: width .28s ease;
  animation: shimmerBar 1.8s linear infinite;
}
@keyframes shimmerBar {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
#progressTextTratar, #progressTextUsar {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 2px 0 0;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -.01em;
}

/* Tarifa input */
.tarifaRow {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.tarifaInput { width: 80px !important; text-align: right; }

/* Ranking USAR row hover */
.usarRankRow:hover { background: var(--blueHov, #e8f4f9) !important; }
.usarRankRow.rankRowSelected {
  background: var(--blue3, #dbeafe) !important;
  outline: 2px solid #1a6fa0; outline-offset: -2px;
}

/* flujoResultBanner */
.flujoResultBanner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; border-radius: var(--r, 6px);
  margin: 12px 0 6px; font-size: 11px; font-weight: 700;
}
.flujoResultBannerTratar {
  background: rgba(26,111,160,.1); border-left: 4px solid #1a6fa0; color: #1a6fa0;
}
.flujoResultBannerUsar {
  background: rgba(21,128,61,.1); border-left: 4px solid #15803d; color: #15803d;
}
.resultCount { font-weight: 400; font-size: 10px; opacity: .8; }

/* Panel flujo */
.flujoPanel {
  border: 1.5px solid var(--border); border-radius: var(--r, 6px);
  padding: 14px; margin-bottom: 12px; background: var(--surface2);
}
.flujoPanel-tratar { border-left: 4px solid #1a6fa0; }
.flujoPanel-usar   { border-left: 4px solid #15803d; }
.flujoPanelHeader  { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.flujoPanelBadge   {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.flujoBadgeTratar  { background: #1a6fa0; color: white; }
.flujoBadgeUsar    { background: #15803d; color: white; }
.flujoPanelTitle   { font-size: 13px; font-weight: 700; color: var(--text); }
.flujoPanelSub     { font-size: 10px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

/* Chips de tipo proveedor USAR */
.chip.chipYac  { color: #7c3aed; border-color: rgba(124,58,237,.3); }
.chip.chipHorm { color: #0e7490; border-color: rgba(14,116,144,.3); }
.chip.chipBio  { color: #16a34a; border-color: rgba(22,163,74,.3); }

/* Saturation widget */
.satWidget    { padding: 6px 0; }
.satHeader    { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; }
.satBar       { height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 6px; overflow: hidden; }
.satRow       { display: flex; justify-content: space-between; font-size: 10px; padding: 1px 0; }
.satBadge     { padding: 1px 5px; border-radius: 3px; font-weight: 700; font-size: 9px; }
.satBadge-bajo     { background: #dcfce7; color: #15803d; }
.satBadge-medio    { background: #fef9c3; color: #a16207; }
.satBadge-alto     { background: #fee2e2; color: #b91c1c; }
.satBadge-saturado { background: #7f1d1d; color: white; }

/* Route detail card */
.routeDetailCard {
  padding: 12px; border-radius: var(--r, 6px);
  border-left: 4px solid #1a6fa0;
  background: var(--surface2); margin: 8px 0;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }

/* Dark mode adjustments */
body.dark-mode .flujoPanel        { background: var(--surface); }
body.dark-mode .flujoResultBannerTratar { background: rgba(26,111,160,.15); }
body.dark-mode .flujoResultBannerUsar   { background: rgba(21,128,61,.15); }
body.dark-mode .satBadge-bajo     { background: #052e16; color: #86efac; }
body.dark-mode .satBadge-medio    { background: #422006; color: #fde68a; }
body.dark-mode .satBadge-alto     { background: #450a0a; color: #fca5a5; }

/* ══════════════════════════════════════════════
   V1 — Estilos nuevas funcionalidades
══════════════════════════════════════════════ */

/* Comentario de tipo de obra */
.obraComentario {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; margin: 6px 0 2px;
  background: rgba(26,111,160,.07);
  border-left: 3px solid #1a6fa0;
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 10px; color: var(--muted); line-height: 1.5;
}
.obraComentarioIcon { font-size: 13px; flex-shrink: 0; margin-top: 1px; }
body.dark-mode .obraComentario { background: rgba(26,111,160,.12); }

/* Route visibility bar */
.routeVisBar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; margin-bottom: 10px;
  background: var(--surface2); border-radius: var(--r);
  border: 1px solid var(--border); flex-wrap: wrap;
}
.routeVisLabel { font-size: 10px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.routeVisBtn {
  padding: 4px 10px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--muted);
  font-size: 10px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.routeVisBtn:hover { border-color: #1a6fa0; color: #1a6fa0; }
.routeVisBtn.active { background: #1a6fa0; color: white; border-color: #1a6fa0; }
#btnShowUsar.active { background: #15803d; border-color: #15803d; }
body.dark-mode .routeVisBtn { background: var(--surface3); }

/* Interactive progress bar */
#progressTextTratar, #progressTextUsar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 0 0;
}
.progMsg {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  letter-spacing: .01em;
}
.progStats {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -.01em;
}

/* Informe actions */
.informeActions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.informeNote {
  font-size: 10px; color: var(--muted); line-height: 1.5;
  margin-top: 10px; padding: 8px;
  background: var(--surface2); border-radius: var(--r);
}
.informeNote .fa { margin-right: 4px; }

/* ══════════════════════════════════════════════
   V1 — Route toggle overlay + charts
══════════════════════════════════════════════ */

/* Route visibility floating control on map */
.routeVisBarFloat {
  position: absolute;
  bottom: 36px; left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.95);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  backdrop-filter: blur(4px);
}
body.dark-mode .routeVisBarFloat { background: rgba(22,27,34,.95); }
.routeVisBarFloat .routeVisLabel { font-size: 10px; font-weight: 700; color: var(--muted); }
.routeVisBarFloat .routeVisBtn {
  padding: 3px 10px; border-radius: 12px;
  border: 1.5px solid var(--border);
  background: transparent; color: var(--muted);
  font-size: 10px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.routeVisBarFloat .routeVisBtn:hover { border-color: #1a6fa0; color: #1a6fa0; }
.routeVisBarFloat .routeVisBtn.active { background: #1a6fa0; color: white; border-color: #1a6fa0; }
.routeVisBarFloat #btnShowUsar.active { background: #15803d; border-color: #15803d; }
.routeVisBarFloat #btnShowBoth.active { background: #7c3aed; border-color: #7c3aed; }

/* Chart sub-headings */
.chartsSubHead {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.chartsSubHead:first-of-type { border-top: none; margin-top: 0; }

/* Small charts grid (detail) */
.chartsGridSm {
  grid-template-columns: repeat(2, 1fr) !important;
}
@media (max-width: 900px) { .chartsGridSm { grid-template-columns: 1fr !important; } }

/* Wide chart */
.chart-wide { grid-column: span 2; }

/* Donut legend */
.donutLegend {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px; font-size: 10px;
}
.donutLegend span { display: flex; align-items: center; gap: 3px; }
.donutLegend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Chart label */
.chartLabel {
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-align: center; margin-bottom: 4px; letter-spacing: .02em;
}

/* Chart box improvement */
.chartBox {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px;
  display: flex; flex-direction: column;
  min-height: 160px;
}
.chartBox canvas { flex: 1; }

/* Detail charts indicator */
#chartsDetailGrid {
  border-left: 3px solid #1a6fa0;
  padding-left: 8px;
}
#chartsGlobalGrid {
  border-left: 3px solid #16a34a;
  padding-left: 8px;
}

/* appBody — map always visible, menus start collapsed */
#sideLeft { min-width: 0; }

/* ══════════════════════════════════════════════
   V1 — Fixes de gráficos, overlay rutas, startup
══════════════════════════════════════════════ */

/* Overlay flotante de toggle de rutas sobre el mapa */
.routeVisBarFloat {
  position: absolute;
  top: 10px; right: 50px;          /* just left of legend */
  z-index: 999;
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(4px);
  border: 1.5px solid rgba(26,111,160,.3);
  border-radius: 20px;
  padding: 5px 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  font-size: 11px;
}
body.dark-mode .routeVisBarFloat {
  background: rgba(22,27,34,.95);
  border-color: rgba(88,166,255,.3);
}
.routeVisBarFloat .routeVisLabel {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin-right: 3px;
}
.routeVisBarFloat .routeVisBtn {
  padding: 3px 9px; border-radius: 12px;
  border: 1.5px solid rgba(26,111,160,.25);
  background: transparent; color: var(--text);
  font-size: 10px; font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.routeVisBarFloat .routeVisBtn:hover  { border-color: #1a6fa0; color: #1a6fa0; }
.routeVisBarFloat .routeVisBtn.active { background: #1a6fa0; color: white; border-color: #1a6fa0; }
.routeVisBarFloat #btnShowUsar.active  { background: #15803d; border-color: #15803d; }
.routeVisBarFloat #btnShowBoth.active  { background: #7c3aed; border-color: #7c3aed; }

/* Chart boxes — explicit height so Chart.js renders correctly */
.chartsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.chartBox {
  position: relative;
  height: 220px;
  background: var(--surface2);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: 8px;
  overflow: hidden;
}
.chartBox canvas {
  width: 100% !important;
  height: 100% !important;
}
@media (max-width: 500px) {
  .chartsGrid { grid-template-columns: 1fr; }
  .chartBox   { height: 180px; }
}

/* Summary grid in Analisis */
.analysisSummary { margin-bottom: 12px; }
.summaryGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 600px) { .summaryGrid { grid-template-columns: 1fr 1fr; } }

/* ══════════════════════════════════════════════════════
   V1 — Nuevas clases de componentes
══════════════════════════════════════════════════════ */

/* Info panel */
.infoPanel { display:flex; align-items:flex-start; gap:8px; padding:8px 11px; margin:5px 0 8px; background:linear-gradient(135deg,rgba(26,111,160,.07),rgba(26,111,160,.03)); border-left:3px solid #1a6fa0; border-radius:0 6px 6px 0; font-size:10px; color:var(--muted); line-height:1.5; }
.infoPanelIcon { font-size:12px; flex-shrink:0; margin-top:1px; }

/* Compare grid */
.compareGrid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:8px; }
@media(max-width:520px){ .compareGrid{grid-template-columns:1fr;} }

/* Calc history entry */
.histEntry { cursor:pointer; padding:8px 10px; border-radius:6px; border:1px solid var(--border); margin-bottom:6px; background:var(--surface2); transition:background .1s; }
.histEntry:hover { background:var(--surface3,#e8f4fb); }

/* Summary cards (KPI USAR) */
.summaryGrid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
@media(max-width:500px){ .summaryGrid{grid-template-columns:1fr 1fr;} }
.summaryCard { padding:10px 12px; border-radius:var(--r); background:var(--surface2); border:1px solid var(--border); text-align:center; }
.summaryCard.blue   { border-left:3px solid #1a6fa0; }
.summaryCard.green  { border-left:3px solid #15803d; }
.summaryCard.orange { border-left:3px solid #d97706; }
.summaryCard.purple { border-left:3px solid #7c3aed; }
.summaryVal { font-size:16px; font-weight:800; color:var(--text); }
.summaryLbl { font-size:9px; color:var(--muted); margin-top:2px; }

/* USAR table header (green) */
.tblData.usarTable thead tr,
.tblData.usarTable thead th,
table.usarTable thead tr,
table.usarTable thead th { background: #14532d !important; color: #fff !important; font-weight: 700 !important; }

/* USAR ranking row */
.usarRankRow:hover { background:rgba(21,128,61,.07); }
.usarRankRow.selected { background:rgba(21,128,61,.14) !important; outline:2px solid #15803d; outline-offset:-2px; }

/* USAR charts grid */
#usarChartsGrid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:10px; }
@media(max-width:500px){ #usarChartsGrid{grid-template-columns:1fr;} }

/* Export button improved */
.btnExport { display:inline-flex !important; align-items:center !important; justify-content:center !important; gap:4px !important; font-weight:600 !important; transition:all .15s !important; }
.btnExport:hover { background:#1a6fa0 !important; color:white !important; border-color:#1a6fa0 !important; transform:translateY(-1px); }

/* Ranking selected row */
#tbodyRanking tr.selected { background:rgba(26,111,160,.14) !important; outline:2px solid #1a6fa0; outline-offset:-2px; }


/* ── GRÁFICOS EXPANDIBLES ────────────────────────────────── */
.chartBox {
  position: relative;
}
.chartBox .btnExpandChart {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.chartBox:hover .btnExpandChart { opacity: 1; }
.btnExpandChart:hover { background: var(--blue3); color: var(--blue); border-color: var(--blue); }

/* Chart fullscreen modal */
#chartModal {
  position: fixed; inset: 0; z-index: 20000;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
#chartModal.open { display: flex; }
#chartModalBox {
  background: var(--surface); border-radius: 12px;
  box-shadow: 0 32px 80px rgba(0,0,0,.35);
  width: min(900px, 94vw); height: min(580px, 88vh);
  display: flex; flex-direction: column; overflow: hidden;
}
#chartModalHead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#chartModalTitle { font-weight: 700; font-size: 14px; color: var(--text); }
#chartModalBody { flex: 1; padding: 16px; position: relative; }
#chartModalBody canvas { width: 100% !important; height: 100% !important; }
#btnCloseChartModal {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
#btnCloseChartModal:hover { background: var(--redBg); color: var(--red); border-color: var(--red); }

/* ── PANEL LER POLÍTICA — nuevo módulo ──────────────────── */
.lerPoliticaTable { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 8px; }
.lerPoliticaTable th { background: var(--ideBlue); color: white; padding: 6px 8px; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.lerPoliticaTable td { padding: 5px 8px; border-bottom: 1px solid var(--border2); vertical-align: middle; }
.lerPoliticaTable tr:hover td { background: var(--blueHov); }
.lerPoliticaBar { height: 6px; border-radius: 3px; background: var(--blue3); display: inline-block; vertical-align: middle; }
.lerPoliticaBadge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; border-radius: 3px; font-size: 9px; font-weight: 800; padding: 0 5px; }
.provinciaDotBar { height: 8px; border-radius: 4px; transition: width .4s ease; }
.politicaToggle { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.politicaToggleBtn { padding: 4px 10px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface2); color: var(--muted); font-size: 10px; font-weight: 600; cursor: pointer; transition: all .15s; }
.politicaToggleBtn.active { background: var(--ideBlue); color: white; border-color: var(--ideBlue); }

/* ── CHECKLIST DISEÑADOR ────────────────────────────────── */
.checklistPanel { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 8px; }
.checklistItem { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border2); cursor: pointer; }
.checklistItem:last-child { border-bottom: none; }
.checklistBox { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; font-size: 10px; transition: all .15s; }
.checklistItem.checked .checklistBox { background: var(--green); border-color: var(--green); color: white; }
.checklistItem.checked .checklistText { color: var(--muted); text-decoration: line-through; }
.checklistText { font-size: 11px; color: var(--text); line-height: 1.4; }
.checklistSub  { font-size: 9px; color: var(--muted); margin-top: 1px; }
.checklistProgress { height: 4px; background: var(--border); border-radius: 2px; margin-top: 10px; }
.checklistProgressFill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--green), #4ade80); transition: width .3s; }

/* ── FUNCIONES AVANZADAS ────────────────────────────────── */
.advancedPanel { background: linear-gradient(135deg, #0f2a4a 0%, #1a3a5c 100%); border-radius: 8px; padding: 12px; color: white; margin-top: 8px; }
.advancedPanel .advTitle { font-size: 11px; font-weight: 700; color: #93c5fd; margin-bottom: 8px; letter-spacing: .04em; text-transform: uppercase; }
.advancedCard { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 9px 11px; margin-bottom: 6px; cursor: pointer; transition: background .15s; }
.advancedCard:hover { background: rgba(255,255,255,.13); }
.advancedCard .advCardTitle { font-size: 11px; font-weight: 700; color: #e2e8f0; margin-bottom: 3px; display:flex; align-items:center; flex-wrap:wrap; gap:4px; }
.advancedCard .advCardDesc  { font-size: 10px; color: #94a3b8; line-height: 1.5; }
.advancedCard .advCardBadge { display: inline-block; background: rgba(74,222,128,.15); color: #4ade80; border: 1px solid rgba(74,222,128,.3); border-radius: 3px; font-size: 8px; font-weight: 700; padding: 1px 5px; text-transform: uppercase; white-space:nowrap; }

/* ── MEJORAS GENERALES UI ───────────────────────────────── */
/* Section numbers badge */
.snum { 
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; border-radius: 5px;
  background: var(--ideBlue); color: white;
  font-size: 10px; font-weight: 800; padding: 0 4px;
  flex-shrink: 0;
}
/* Section head more polished */
.sectionHead {
  border-left: 3px solid var(--ideBlue);
  padding-left: 8px;
  margin-left: -8px;
}
/* Hover lift on cards */
.summaryCard { transition: transform .15s, box-shadow .15s; }
.summaryCard:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
/* Ranking table sticky header */
.rankWrap { max-height: 380px; overflow-y: auto; }
.tblRanking thead { position: sticky; top: 0; z-index: 1; }
.tblRanking thead th { background: var(--surface); box-shadow: 0 1px 0 var(--border); }


/* ════════════════════════════════════════════════════════
   V1 FIXES — Ranking USAR header + Multi-Ruta styles + RD105
════════════════════════════════════════════════════════ */

/* ── Ranking USAR — cabecera verde institucional ────────── */
.usarTable thead tr,
.usarTable thead th,
#tbodyUsarRanking ~ thead tr,
table.usarTable > thead > tr > th {
  background: #14532d !important;
  color: white !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 8px 10px !important;
  letter-spacing: .02em !important;
  border: none !important;
}
.usarTable tbody tr { cursor: pointer; transition: background .1s; }
.usarTable tbody tr:hover { background: rgba(21,128,61,.08); }
.usarTable tbody tr.selected,
.usarRankRow.selected { background: rgba(21,128,61,.15) !important; }

/* ── Ranking TRATAR — cabecera azul reforzada ───────────── */
.tblRanking > thead > tr > th {
  background: var(--ideBlue) !important;
  color: white !important;
  position: sticky; top: 0; z-index: 2;
}

/* ── Multi-Ruta sections — estilos mejorados ────────────── */
.multirutaSection {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  transition: box-shadow .15s;
}
.multirutaSection:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }

.multirutaTitle {
  font-size: 13px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.multirutaBadge {
  background: var(--ideBlue); color: white;
  font-size: 10px; font-weight: 800;
  padding: 3px 8px; border-radius: 4px;
  letter-spacing: .04em; flex-shrink: 0;
}

.multirutaResults {
  margin-top: 10px; border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* Multi-Ruta result rows — styled like ranking */
.multirutaRouteRow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  font-size: 11px; cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 3px;
  transition: background .12s, border-color .12s;
}
.multirutaRouteRow:hover {
  background: var(--blueHov);
  border-color: var(--border);
}
.multirutaRouteRow .mrColor {
  width: 12px; height: 12px;
  border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,.1);
}
.multirutaRouteRow .mrName  { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multirutaRouteRow .mrDist  { font-family: 'JetBrains Mono',monospace; color: var(--muted); font-size: 10px; flex-shrink: 0; }

/* Multi-Ruta table headers */
.multirutaTable {
  width: 100%; border-collapse: collapse;
  font-size: 11px; margin-top: 8px;
}
.multirutaTable thead tr {
  background: var(--ideBlue) !important;
}
.multirutaTable thead th {
  color: white !important; padding: 7px 10px;
  font-weight: 700; font-size: 10px;
  letter-spacing: .03em; border: none;
}
.multirutaTable tbody tr { border-bottom: 1px solid var(--border2); }
.multirutaTable tbody tr:hover { background: var(--blueHov); }
.multirutaTable td { padding: 5px 10px; vertical-align: middle; }

/* Grafo cards */
.grafoCard {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  margin-bottom: 10px;
  border-left: 4px solid var(--ideBlue);
  transition: box-shadow .15s;
}
.grafoCard:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.grafoCard.verde  { border-left-color: #16a34a; }
.grafoCard.amber  { border-left-color: #d97706; }
.grafoCard.purple { border-left-color: #7c3aed; }
.grafoCardTitle { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.grafoCardDesc  { font-size: 10px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.grafoCardBtns  { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Grafo result blocks */
.grafoResult {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px;
  margin-top: 8px; font-size: 11px;
}
.grafoResult table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.grafoResult table thead th {
  background: var(--surface3); color: var(--muted);
  padding: 4px 8px; font-size: 10px; font-weight: 700; text-align: left;
}
.grafoResult table td { padding: 4px 8px; border-bottom: 1px solid var(--border2); }

/* Panel resultados avanzados */
#advResultsPanel {
  border-radius: 8px; overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
#advResultsContent .advResRow {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--border2);
  font-size: 11px;
}

/* RD105 — badge amber color override */
.rd105Art .ley7ArtNum {
  background: #d97706 !important;
  color: white !important;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10px;
}
.rd105Art .ley7ArtHeader {
  background: var(--surface2);
}
.rd105Art .ley7ArtHeader:hover {
  background: #fef3c715;
}

/* Ley7/RD105 search bar */
.ley7SearchBar { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; }
.ley7SearchInput {
  flex: 1; padding: 7px 10px; font-size: 11px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text);
}
.ley7SearchInput:focus { outline: none; border-color: var(--ideBlue); }
.ley7SearchStats { font-size: 10px; color: var(--muted); flex-shrink: 0; }
.ley7RCDOnly { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 8px; cursor: pointer; }

/* ═══════════════════════════════════════════════════════════
   MOBILE ADAPTIVE LAYER — GEORECICLA V1
   Breakpoints: 768px (tablet), 480px (phone), 360px (small)
   Design: full-screen map first, slide-up panels, bottom nav
═══════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES MOBILE ─────────────────────────────── */
:root {
  --mob-nav-h: 56px;
  --mob-sheet-radius: 20px;
  --mob-panel-h: 55vh;
  --mob-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── BOTTOM NAVIGATION BAR ────────────────────────────── */
#mobileNav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--mob-nav-h) + var(--mob-safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,.12);
  z-index: 200;
  padding-bottom: var(--mob-safe-bottom);
}
.mobNavInner {
  display: flex; height: var(--mob-nav-h);
  align-items: stretch;
}
.mobNavBtn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; border: none; background: none;
  color: var(--muted); cursor: pointer;
  font-size: 10px; font-weight: 600;
  letter-spacing: .02em; padding: 0;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.mobNavBtn .mobNavIcon {
  font-size: 20px; line-height: 1;
  transition: transform .15s;
}
.mobNavBtn.active { color: var(--blue); }
.mobNavBtn.active .mobNavIcon { transform: translateY(-2px); }
.mobNavBtn.active::after {
  content: '';
  position: absolute; bottom: 0; left: 25%; right: 25%;
  height: 3px; background: var(--blue);
  border-radius: 3px 3px 0 0;
}
.mobNavBtn:active .mobNavIcon { transform: scale(.88); }

/* FAB — Calcular rutas */
#mobFab {
  display: none;
  position: fixed; bottom: calc(var(--mob-nav-h) + var(--mob-safe-bottom) + 16px);
  right: 16px; z-index: 201;
  width: 56px; height: 56px;
  border-radius: 50%; border: none;
  background: var(--blue);
  color: white; font-size: 22px;
  box-shadow: 0 4px 16px rgba(29,78,216,.45);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  display: none; align-items: center; justify-content: center;
}
#mobFab:active { transform: scale(.92); box-shadow: 0 2px 8px rgba(29,78,216,.4); }
#mobFab.running { background: #dc2626; animation: mobFabPulse 1.2s infinite; }
@keyframes mobFabPulse {
  0%,100% { box-shadow: 0 4px 16px rgba(220,38,38,.45); }
  50%      { box-shadow: 0 4px 24px rgba(220,38,38,.7); }
}

/* ── MOBILE SLIDE-UP SHEET ────────────────────────────── */
#mobileSheet {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 190;
  background: var(--surface);
  border-radius: var(--mob-sheet-radius) var(--mob-sheet-radius) 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  max-height: 90vh;
  overflow: hidden;
  padding-bottom: calc(var(--mob-nav-h) + var(--mob-safe-bottom));
}
#mobileSheet.open { transform: translateY(0); }

.mobSheetHandle {
  display: flex; justify-content: center; align-items: center;
  padding: 10px 0 6px;
  flex-shrink: 0;
}
.mobSheetHandle::before {
  content: ''; width: 36px; height: 4px;
  background: var(--border); border-radius: 2px;
}
.mobSheetHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 10px; flex-shrink: 0;
}
.mobSheetTitle {
  font-size: 16px; font-weight: 700; color: var(--text);
}
.mobSheetClose {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface2); border: none;
  color: var(--muted); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mobSheetBody {
  overflow-y: auto; flex: 1;
  padding: 0 12px 8px;
  -webkit-overflow-scrolling: touch;
}
/* Sheet overlay backdrop */
#mobileSheetBackdrop {
  display: none;
  position: fixed; inset: 0; z-index: 185;
  background: rgba(0,0,0,.35);
  opacity: 0; transition: opacity .28s;
}
#mobileSheetBackdrop.visible { opacity: 1; }

/* ── MOBILE HEADER — compact topbar ──────────────────── */
@media (max-width: 768px) {
  /* Show mobile nav and FAB */
  #mobileNav { display: block; }
  #mobFab     { display: flex; }

  /* Compact topbar */
  #topbar {
    height: 44px; padding: 0 10px; gap: 6px;
  }
  #brandTitle { font-size: 12px; }
  #brandSub   { display: none; }
  #topbarCenter { gap: 4px; }
  .tileSelectTop { max-width: 130px; font-size: 10px; padding: 4px 6px; }
  .tbBtnLabel { display: none; }
  .tbBtn { min-width: 32px; padding: 0 6px; height: 30px; font-size: 12px; }
  /* Hide some topbar buttons on mobile — put in sheet */
  #btnLang, #btnManualPDF, #btnHelp { display: none; }
  /* Workflow bar — compact horizontal scroll */
  .workflowBar {
    padding: 4px 8px; gap: 4px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .workflowBar::-webkit-scrollbar { display: none; }
  .wfStep { min-width: 60px; padding: 5px 6px; font-size: 9px; }
  .wfStepIcon { font-size: 14px; }

  /* ── MAP takes full screen ── */
  #appBody { position: relative; }
  #sideLeft {
    position: fixed !important;
    top: 44px; left: 0; bottom: calc(var(--mob-nav-h) + var(--mob-safe-bottom));
    width: 100% !important; max-width: 480px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 30px rgba(0,0,0,.2);
  }
  body.menuOpen #sideLeft {
    transform: translateX(0);
    width: 100% !important;
  }
  /* Sidebar overlay */
  body.menuOpen::before {
    content: ''; position: fixed; inset: 0; z-index: 140;
    background: rgba(0,0,0,.4); top: 44px;
    bottom: calc(var(--mob-nav-h) + var(--mob-safe-bottom));
  }

  /* Map fills full area below topbar above bottom nav */
  #mapPanel {
    position: fixed !important;
    top: 44px; left: 0; right: 0;
    bottom: calc(var(--mob-nav-h) + var(--mob-safe-bottom));
  }

  /* ── ACCORDION sections — more touch-friendly ── */
  .menuItem { min-height: 48px; padding: 0 14px; }
  .menuItemLabel { font-size: 13px; }
  .accContent { padding: 12px 10px; }
  .section { padding: 12px; margin-bottom: 8px; }

  /* ── FORMS — bigger touch targets ── */
  .formInput, .formSelect, input[type="text"], input[type="number"],
  input[type="email"], select {
    height: 44px !important; font-size: 14px !important; padding: 0 10px !important;
  }
  label.formLabel { font-size: 12px; margin-bottom: 4px; }
  .btnPrimary, .btnSecondary {
    height: 46px !important; font-size: 14px !important;
    border-radius: 12px !important;
  }
  button { min-height: 44px; }

  /* ── RANKING TABLE — mobile cards instead of wide table ── */
  .tblRanking thead { display: none; }
  .tblRanking tbody tr {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  /* #, destino_nombre, CLE on first row; tipo, prov, km on second */
  .tblRanking tbody tr td:nth-child(1) {
    grid-row: 1; grid-column: 1;
    font-size: 10px; color: var(--muted); align-self: start; padding-top: 2px;
  }
  .tblRanking tbody tr td:nth-child(2) {
    grid-row: 1; grid-column: 2;
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .tblRanking tbody tr td:nth-child(10) { /* CLE */
    grid-row: 1; grid-column: 3;
    font-size: 12px; font-weight: 700; color: var(--blue);
    white-space: nowrap;
  }
  .tblRanking tbody tr td:nth-child(3) {
    grid-row: 2; grid-column: 1;
    font-size: 10px; color: var(--muted);
  }
  .tblRanking tbody tr td:nth-child(4) {
    grid-row: 2; grid-column: 2;
    font-size: 11px; color: var(--muted);
  }
  .tblRanking tbody tr td:nth-child(5) {
    grid-row: 2; grid-column: 3;
    font-size: 11px; color: var(--text);
    font-family: 'JetBrains Mono', monospace;
  }
  /* Hide verbose columns on mobile */
  .tblRanking tbody tr td:nth-child(6),
  .tblRanking tbody tr td:nth-child(7),
  .tblRanking tbody tr td:nth-child(8),
  .tblRanking tbody tr td:nth-child(9) { display: none; }

  /* ── KPI CARDS — 2-column on mobile ── */
  .summaryGrid { grid-template-columns: 1fr 1fr !important; gap: 6px !important; }
  .summaryCard { padding: 10px 8px; }
  .summaryVal  { font-size: 18px !important; }
  .summaryLbl  { font-size: 9px !important; }

  /* ── CHARTS — full width ── */
  .chartsGridSm, .chartsGrid, #chartsGrid, .chartDualRow,
  .chartRow, [id*="ChartsGrid"] {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }
  .chartBox, .chartWrap { margin-bottom: 10px !important; }
  canvas { max-height: 220px !important; }

  /* ── SEMAFORO — 2-col ── */
  .semaGrid { grid-template-columns: 1fr 1fr !important; }

  /* ── COMPARADOR ── */
  .compareGrid { grid-template-columns: 1fr !important; }

  /* ── CRS ── */
  .crsConvGrid { grid-template-columns: 1fr !important; }
  .crsRefTable { font-size: 10px !important; }
  .crsRefTable td, .crsRefTable th { padding: 5px 6px !important; }

  /* ── MODAL progress ── */
  .progressModalBox {
    width: 90vw !important; padding: 20px 16px !important;
  }

  /* ── TOAST ── */
  #toastContainer {
    bottom: calc(var(--mob-nav-h) + var(--mob-safe-bottom) + 70px) !important;
    left: 12px !important; right: 12px !important;
    max-width: none !important;
  }
  .toast { font-size: 12px !important; padding: 10px 14px !important; }

  /* ── MAP LEGEND compact ── */
  #mapLegend { top: 50px; right: 6px; font-size: 10px; padding: 6px 8px; }

  /* ── COORD BAR hide on small ── */
  #coordBar { display: none !important; }

  /* ── SECTION HEADERS smaller ── */
  .sectionHead { font-size: 11px; }
  .slabel { font-size: 12px !important; }

  /* Mobile sheet visible */
  #mobileSheet { display: flex; flex-direction: column; }
  #mobileSheetBackdrop { display: block; }

  /* ── Results panel — slide-up when visible ── */
  /* (handled via JS adding .open to #mobileSheet) */
}

/* ── PHONE — very small screens ── */
@media (max-width: 480px) {
  :root { --mob-nav-h: 52px; }
  #topbar { height: 40px; padding: 0 8px; }
  #brandTitle { font-size: 11px; }
  .vBadge { display: none; }
  .tileSelectTop { max-width: 100px; font-size: 9px; }
  .tbBtn { height: 28px; min-width: 28px; font-size: 11px; }

  /* Full-width menu */
  body.menuOpen #sideLeft { max-width: 100vw !important; }

  /* FAB smaller */
  #mobFab { width: 50px; height: 50px; font-size: 20px; right: 12px; }

  /* Ranking even more compact */
  .tblRanking tbody tr { padding: 8px 10px; }
  .tblRanking tbody tr td:nth-child(2) { font-size: 12px; }

  /* Workflow bar — only icons */
  .wfStepLabel { display: none; }
  .wfStep { min-width: 40px; }

  /* Inputs bigger */
  .formInput, .formSelect, input, select { font-size: 16px !important; } /* prevent iOS zoom */
}

/* ── TABLET landscape ── */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --left-w: 380px; }
  .summaryGrid { grid-template-columns: repeat(2, 1fr); }
  .chartsGridSm { grid-template-columns: 1fr 1fr !important; }
}

/* ── SWIPE HINT on mobile ── */
.mobSwipeHint {
  display: none;
  position: fixed; bottom: calc(var(--mob-nav-h) + var(--mob-safe-bottom) + 8px);
  left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.7); color: white;
  padding: 8px 16px; border-radius: 20px;
  font-size: 11px; z-index: 202; pointer-events: none;
  animation: swipeHintFade 2.5s ease forwards;
}
@keyframes swipeHintFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
@media (max-width: 768px) { .mobSwipeHint { display: block; } }

/* ── FOCUS rings larger on touch ── */
@media (max-width: 768px) {
  *:focus-visible {
    outline: 3px solid var(--blue) !important; outline-offset: 2px;
  }
}

/* ── PRINT — hide mobile nav ── */
@media print {
  #mobileNav, #mobFab, #mobileSheet, #mobileSheetBackdrop { display: none !important; }
  #mapPanel { position: static !important; height: 280px !important; }
  #sideLeft { position: static !important; width: 100% !important; transform: none !important; }
}

/* ── Tipo de obra — carpetas de color ──────────────────────────── */

/* Icon badge colors per obra type */
.tipoObraIcon-nueva_planta   { color: #ea580c; }
.tipoObraIcon-rehabilitacion { color: #16a34a; }
.tipoObraIcon-demolicion     { color: #6b7280; }
.tipoObraIcon-urbanizacion   { color: #7c3aed; }
.tipoObraIcon-obra_menor     { color: #dc2626; }

/* ── Rank actions row (export + navigation below ranking table) ── */
.rankActionsRow {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; padding: 10px 12px 8px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
}
.rankActionsGroup {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.rankActionsRight { margin-left: auto; }
.rankActionsLabel {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding-right: 4px;
}
.btnRankAction {
  height: 28px; padding: 0 10px;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
  text-decoration: none; display: inline-flex; align-items: center;
  transition: background .15s, border-color .15s;
}
.btnRankAction:hover { background: var(--blue); color: white; border-color: var(--blue); }
.btnRankAction.nav  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.btnRankAction.nav:hover  { background: #1d4ed8; color: white; }
.btnRankAction.nav3 { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.btnRankAction.nav3:hover { background: #15803d; color: white; }
.btnRankAction.stop { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btnRankAction.stop:hover { background: #dc2626; color: white; }
@media (max-width: 768px) {
  .rankActionsRow { gap: 6px; padding: 8px 10px; }
  .rankActionsLabel { display: none; }
}

/* ── Modal overlay ─────────────────────────────────────────── */
.modalOverlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.55); display: flex;
  align-items: center; justify-content: center;
}
.modalBox {
  background: var(--surface); border-radius: var(--rl);
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  padding: 20px 24px; max-width: 560px; width: 90%;
  max-height: 85vh; overflow-y: auto; position: relative;
}
.modalClose {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; font-size: 18px;
  color: var(--muted); cursor: pointer; line-height: 1;
}
.modalClose:hover { color: var(--text); }

/* ── Toast notification ─────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--gray900, #1e2c3d); color: white;
  padding: 8px 18px; border-radius: 20px; font-size: 13px;
  z-index: 8000; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: none; white-space: nowrap;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ── Hover tooltip ──────────────────────────────────────────── */
.hoverTooltip {
  position: fixed; z-index: 7000; pointer-events: none;
  background: var(--gray900, #1e2c3d); color: white;
  font-size: 11px; padding: 5px 9px; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); max-width: 220px;
  white-space: pre-wrap; line-height: 1.4;
}

/* ── Legend interactive toggle ──────────────────────────────── */
.legendToggle {
  cursor: pointer; user-select: none;
  padding: 2px 3px; border-radius: 4px;
  transition: background .12s; display: flex;
  align-items: center; gap: 5px;
  margin-bottom: 3px; font-size: 10px; color: var(--text);
}
.legendToggle:hover { background: var(--surface2); }
.legendChk {
  width: 13px; height: 13px; cursor: pointer;
  accent-color: var(--blue); flex-shrink: 0;
}
.legendToggle input:not(:checked) ~ .legendSymbol { opacity: 0.25; }
.legendToggle input:not(:checked) ~ span:last-child { opacity: 0.35; }
.legendGroupLabel {
  font-size: 9px; font-weight: 700; color: var(--blue);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 1px 0 2px; border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.legendClusterNote {
  font-size: 8px; color: var(--muted); line-height: 1.3; margin-top: 4px;
}
.legendSymbol {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 20px; height: 20px;
}
.legendSep { border-top: 1px solid var(--border); margin: 4px 0; }
.legendTitle {
  font-size: 9px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 3px;
}

/* ── Wizard step progression ──────────────────────────────── */
.subAccItem.locked > .subAccHead {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}
.subAccItem.locked > .subAccHead .subAccNum {
  background: var(--muted, #6b7280) !important;
}
.subAccItem.locked > .subAccHead .subAccNum::after {
  content: ' 🔒'; font-size: 9px;
}
.subAccItem.completed > .subAccHead .subAccNum {
  background: #16a34a !important;
}
.subAccItem.completed > .subAccHead .subAccNum::after {
  content: ' ✓'; font-size: 9px;
}
.subAccItem.unlocking {
  animation: stepUnlock 0.45s ease;
}
@keyframes stepUnlock {
  0%   { opacity: 0.35; transform: translateX(-6px); }
  100% { opacity: 1;    transform: translateX(0); }
}
/* Paso 2 group header — visual divider only, not clickable */
#subAcc-filtros {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}
#subAcc-filtros > .subAccHead {
  background: var(--surface2);
  border-left: 3px solid var(--blue);
  pointer-events: none;
  cursor: default;
}

.tipoObraSelect, .tipoObraSelect option {
  color: var(--text, #1e2c3d) !important;
}

/* Force black text on tipo obra select */
.tipoObraSelect, .tipoObraSelect option {
  color: #1e2c3d !important;
}
select option {
  color: #1e2c3d;
}

/* ═══════════════════════════════════════════════════════════
   REDESIGNED STEP HEADERS — clean, modern, distinct badges
   ═══════════════════════════════════════════════════════════ */
.stepHead {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px !important;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 3px;
  transition: all .15s ease;
  cursor: pointer;
  background: white;
}
body.dark-mode .stepHead { background: var(--surface); }

.stepHead:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

/* Color-coded left border per step */
.stepHead--blue  { border-left: 4px solid #1565c0; }
.stepHead--teal  { border-left: 4px solid #00796b; }
.stepHead--green { border-left: 4px solid #2e7d32; }

/* Active/open state */
.subAccItem.open > .stepHead {
  background: linear-gradient(135deg, rgba(21,101,192,.04), rgba(21,101,192,.08));
  box-shadow: 0 2px 12px rgba(21,101,192,.12);
}
.subAccItem.open > .stepHead--teal {
  background: linear-gradient(135deg, rgba(0,121,107,.04), rgba(0,121,107,.08));
  box-shadow: 0 2px 12px rgba(0,121,107,.12);
}
.subAccItem.open > .stepHead--green {
  background: linear-gradient(135deg, rgba(46,125,50,.04), rgba(46,125,50,.08));
  box-shadow: 0 2px 12px rgba(46,125,50,.12);
}

/* Completed state */
.subAccItem.completed > .stepHead {
  border-left-color: #16a34a !important;
}
.subAccItem.completed > .stepHead .stepStatus {
  background: #16a34a;
  color: white;
}
.subAccItem.completed > .stepHead .stepStatus::before {
  content: "✓ ";
}

/* Badge (icon circle) */
.stepBadge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: white;
}
.stepBadge--blue  { background: #1565c0; }
.stepBadge--teal  { background: #00796b; }
.stepBadge--green { background: #2e7d32; }
.subAccItem.completed .stepBadge { background: #16a34a !important; }

/* Labels */
.stepInfo {
  flex: 1;
  min-width: 0;
}
.stepLabel {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.stepSub {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
  margin-top: 1px;
}

/* Status pill */
.stepStatus {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface2);
  color: var(--muted);
  white-space: nowrap;
}

/* Arrow in step head */
.stepHead .subAccArrow {
  font-size: 12px;
  color: var(--muted);
  transition: transform .2s;
  margin-left: 4px;
}
.subAccItem.open > .stepHead .subAccArrow {
  transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════════════════
   UI IMPROVEMENTS — smooth transitions + animations
   ═══════════════════════════════════════════════════════════ */

/* Smooth open/close for step bodies */
.subAccBody {
  transition: max-height .3s ease, opacity .2s ease, padding .2s ease;
  overflow: hidden;
}

/* Step completion animation */
@keyframes stepDone {
  0%   { background: rgba(22,163,74,.15); }
  100% { background: transparent; }
}
.subAccItem.completed > .stepHead {
  animation: stepDone 1.5s ease;
}

/* Better section cards inside steps */
.accContent .section {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  transition: box-shadow .15s;
}
.accContent .section:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* Workflow bar — more modern */
.workflowBar {
  display: flex;
  justify-content: space-between;
  padding: 8px 6px;
  background: linear-gradient(135deg, #f8fafc, #eff6ff);
  border-radius: 10px;
  border: 1px solid #dbeafe;
  margin-bottom: 10px;
}
body.dark-mode .workflowBar {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border-color: var(--border);
}
.wfStep {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  opacity: 0.5;
  transition: opacity .2s;
}
.wfStep.active, .wfStep.done { opacity: 1; }
.wfStepIcon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2px solid transparent;
  transition: all .2s;
}
.wfStep.active .wfStepIcon {
  border-color: var(--blue);
  background: #eff6ff;
}
.wfStep.done .wfStepIcon {
  background: #16a34a;
  border-color: #16a34a;
  color: white;
}
.wfStepLabel {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.wfStep.active .wfStepLabel { color: var(--blue); }
.wfStep.done .wfStepLabel { color: #16a34a; }

/* Chips — more polished */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .12s;
  background: var(--surface);
}
.chip:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

/* LER cards — better hover */
.lerCard {
  transition: transform .12s, box-shadow .12s;
}
.lerCard:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* BCCA cards — polished */
.bccaCard {
  transition: transform .1s, box-shadow .1s;
}
.bccaCard:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,.1);
}

/* Buttons — subtle gradient */
.btnRun {
  background: linear-gradient(135deg, #1565c0, #1976d2) !important;
  transition: transform .1s, box-shadow .1s;
}
.btnRun:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(21,101,192,.35);
}
.btnRunUsar {
  background: linear-gradient(135deg, #2e7d32, #388e3c) !important;
}
.btnRunUsar:hover {
  box-shadow: 0 4px 14px rgba(46,125,50,.35);
}

/* ── Global workflow progress bar (thin) ─────────────────── */
.wfBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 8px;
  background: linear-gradient(180deg, #f0f4f8, #e8edf3);
  border-bottom: 1px solid var(--border);
}
body.dark-mode .wfBar { background: var(--surface2); }
.wfG {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--muted);
}
.wfG span {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: 7.5px;
}
.wfDot {
  color: var(--border);
  font-size: 10px;
  margin: 0 1px;
}
