/* PIN: mismos tokens de marca que translate-service (paleta Clever Solar, Fira Sans propia), claro y oscuro según el sistema, móvil primero. */
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/FiraSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/FiraSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/FiraSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/FiraSans-Bold.woff2") format("woff2"); }
:root {
  --fondo: #F3F4F6; --superficie: #FFFFFF; --texto: rgba(33, 39, 45, .87); --titulo: #111827; --tenue: #606774;
  --borde: #E5E7EB; --borde-campo: #6B7280; --hover-sec: #f3f4f5;
  --acento: #195A8F; --acento-hover: #175181; --acento-texto: #FFFFFF; --foco: #195A8F; --sel-fondo: #e4f1fe;
  --ok: #156e6a; --atencion: #935f07; --atencion-fondo: #fdf1dc;
  --error: #8f2929; --error-fondo: #fde3e3; --ok-fondo: #dcf5f3;
  --sombra: 0 .25rem 1.125rem rgba(33, 39, 45, .08); --sombra-peq: 0 .125rem .25rem rgba(33, 39, 45, .08);
  --r: 6px; --margen: 16px;
  --fuente: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0F172A; --superficie: #1E293B; --texto: rgba(255, 255, 255, .87); --titulo: rgba(255, 255, 255, .87); --tenue: #9CA3AF;
    --borde: #334155; --borde-campo: #9CA3AF; --hover-sec: #334155;
    --acento: #4AA4F8; --acento-hover: #8BCBFF; --acento-texto: #000000; --foco: #4AA4F8; --sel-fondo: #2f435a;
    --ok: #34D399; --atencion: #FBBF24; --atencion-fondo: #413a26;
    --error: #f98686; --error-fondo: #413544; --ok-fondo: #1d3f3f;
    --sombra: 0 .25rem 1.25rem rgba(0, 0, 0, .3); --sombra-peq: 0 .125rem .25rem rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 16px/1.5 var(--fuente); }
a { color: var(--acento); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { color: var(--titulo); line-height: 1.3; }
h1 { font-size: 1.25rem; font-weight: 700; margin: 0 0 .25rem; }
h2 { font-size: 1.125rem; font-weight: 600; margin: 0 0 .5rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1rem 0 .25rem; }
p { margin: 0 0 .5rem; }
.ayuda { color: var(--tenue); font-size: .9rem; }
small.ayuda { font-size: .8rem; }

/* Controles: mínimo 44 px de alto */
button, .btn-principal, .btn-secundario { font: inherit; min-height: 44px; border-radius: var(--r); cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.btn-principal { display: inline-flex; align-items: center; justify-content: center; background: var(--acento); color: var(--acento-texto); border: 0; padding: .5rem 1.25rem; font-weight: 600; text-decoration: none; box-shadow: var(--sombra-peq); }
.btn-principal:hover:not(:disabled) { background: var(--acento-hover); }
.btn-secundario { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; background: var(--superficie); color: var(--titulo); border: 1px solid var(--borde-campo); padding: .45rem .9rem; font-weight: 500; text-decoration: none; }
.btn-secundario:hover:not(:disabled) { background: var(--hover-sec); }
.btn-peligro { color: var(--error); border-color: var(--error); }
.btn-texto { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; padding: .25rem .5rem; }
label { display: block; font-weight: 500; margin: .75rem 0 .25rem; color: var(--titulo); }
input:not([type=checkbox]):not([type=radio]), textarea { width: 100%; min-height: 44px; font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borde-campo); border-radius: var(--r); padding: .5rem .65rem; }
input[type=file] { padding: .55rem .4rem; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--acento); }
input:disabled, textarea:disabled { opacity: .7; }

/* Avisos: color, icono y texto */
.aviso { padding: .6rem .8rem; border-radius: var(--r); margin: .5rem 0; border: 1px solid; }
.aviso p { margin: 0 0 .4rem; }
.aviso ul { margin: 0; padding-left: 1.2rem; }
.aviso-error { background: var(--error-fondo); color: var(--error); border-color: var(--error); }
.aviso-ok { background: var(--ok-fondo); color: var(--ok); border-color: var(--ok); }
.aviso-atencion { background: var(--atencion-fondo); color: var(--atencion); border-color: var(--atencion); }

/* Cabecera */
.cabecera { background: var(--superficie); box-shadow: var(--sombra-peq); padding: .25rem var(--margen); display: flex; flex-wrap: wrap; align-items: center; gap: 0 .75rem; position: relative; z-index: 6; }
.marca { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; color: var(--titulo); text-decoration: none; }
.marca-logo { display: block; height: 22px; width: auto; }
.marca-nombre { font-weight: 700; font-size: 1.05rem; }
.empresa-movil { display: none; color: var(--tenue); font-size: .9rem; margin: 0 0 .15rem; overflow-wrap: anywhere; }
.cabecera-sub { color: var(--tenue); font-size: .9rem; flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 599px) {
  .pag-mapa .cabecera-sub { display: none; }
  .empresa-movil { display: block; }
}
.idiomas { display: flex; gap: .15rem; margin-left: auto; }
.idiomas a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .45rem; color: var(--acento); }
.idiomas a[aria-current="true"] { color: var(--titulo); font-weight: 600; text-decoration: none; }
.cabecera form { margin: 0; }

/* Entrada y páginas sueltas */
.tarjeta-entrar { background: var(--superficie); box-shadow: var(--sombra); border-radius: var(--r); padding: 1.25rem; margin: 1.5rem auto; max-width: 28rem; width: calc(100% - 2 * var(--margen)); }
.tarjeta-entrar form .btn-principal { width: 100%; margin-top: 1rem; }
.clave { font: 1.1rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.fila-botones { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }

/* Mapa y lista: móvil */
.zona-mapa { position: sticky; top: 0; z-index: 4; background: var(--superficie); box-shadow: var(--sombra-peq); }
.mapa-marco { position: relative; isolation: isolate; }
#mapa { height: 38dvh; min-height: 220px; background: #d9dde2; }
#mapa.colocando-mapa { cursor: crosshair; }
.cruz { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; pointer-events: none; z-index: 900;
  background: linear-gradient(#000, #000) center/2px 100% no-repeat, linear-gradient(#000, #000) center/100% 2px no-repeat; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.aviso-capa { margin: 0; padding: .3rem var(--margen); font-size: .85rem; background: var(--atencion-fondo); color: var(--atencion); }
.colocando { padding: .3rem var(--margen) .4rem; background: var(--sel-fondo); color: var(--titulo); }
.colocando p { margin: 0 0 .25rem; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.colocando-botones { display: flex; flex-wrap: wrap; gap: .4rem; }
.zona-lista { padding: .75rem var(--margen) 5.5rem; }
.panel-cabeza { margin-bottom: .5rem; }
.panel-titulo { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 .75rem; }
.panel-titulo h1 { margin: 0; }
.avance { font-weight: 600; color: var(--titulo); margin: 0; }
progress { display: block; width: 100%; height: 8px; margin: .2rem 0 .3rem; accent-color: var(--acento); }
#instrucciones { margin: 0; }
#estado-conf { margin: .3rem 0 0; }
.guardado { margin: .2rem 0 0; font-size: .9rem; color: var(--tenue); }
.guardado.con-error { color: var(--error); font-weight: 600; }
.caja-buscar label { margin-top: .4rem; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.fila { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r); scroll-margin: calc(38dvh + 7.5rem) 0 5rem; }
.fila.sel { border-color: var(--acento); box-shadow: 0 0 0 1px var(--acento); }
.fila-boton { width: 100%; display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .65rem; background: none; border: 0; color: inherit; text-align: left; }
.fila.sel .fila-boton { background: var(--sel-fondo); border-radius: var(--r) var(--r) 0 0; }
.num { flex: 0 0 auto; min-width: 1.75rem; height: 1.75rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--acento); color: var(--acento-texto); font-weight: 600; font-size: .875rem; }
.fila-txt { min-width: 0; display: flex; flex-direction: column; }
.fila-nombre { color: var(--titulo); font-weight: 600; overflow-wrap: anywhere; }
.fila-tipo { color: var(--tenue); overflow-wrap: anywhere; }
.fila.sel .fila-tipo, .fila.sel .est-por { color: var(--texto); }
.fila-est { font-weight: 500; }
.est-por { color: var(--tenue); }
.est-ok { color: var(--ok); }
.est-inicial { color: var(--atencion); }
.editor:not(:empty) { padding: 0 .65rem .65rem; }
.ed-botones { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.acciones { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; padding: .4rem var(--margen) calc(.4rem + env(safe-area-inset-bottom)); background: var(--superficie); box-shadow: 0 -2px 8px rgba(0, 0, 0, .12); }
.acciones button { width: 100%; height: 100%; padding: .3rem .4rem; font-size: .9rem; line-height: 1.2; }
.acciones form { margin: 0; }
.toast { position: fixed; left: var(--margen); right: var(--margen); bottom: 4.75rem; z-index: 7; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .75rem; padding: .55rem .8rem; border-radius: var(--r); background: #1f2937; color: #fff; box-shadow: var(--sombra); overflow-wrap: anywhere; }

/* Chincheta: número, forma y color. Punteada = posición inicial sin comprobar; mayor y ámbar = seleccionada */
.pin { background: none; border: 0; }
.pin span { display: flex; align-items: center; justify-content: center; position: absolute; isolation: isolate; left: 7px; top: 6px; width: 30px; height: 30px; font: 600 13px/1 var(--fuente); color: #fff; }
.pin span::before { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #195A8F; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.pin-inicial span::before { background: #5b6472; border-style: dashed; }
.pin-sel span::before { background: #935f07; outline: 3px solid #fff; }

/* Controles de Leaflet: objetivos de 44 px y atribución legible, siempre visible */
.leaflet-container { font: inherit; }
.leaflet-touch .leaflet-bar a, .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; color: #111827; }
.leaflet-control-layers { color: #111827; border-radius: var(--r); color-scheme: light; }
.leaflet-control-layers-expanded { padding: .1rem .5rem; }
.leaflet-control-layers label { display: block; margin: 0; color: #111827; font-weight: 500; }
.leaflet-control-layers label > span, .leaflet-control-layers label > div { display: flex; align-items: center; gap: .3rem; min-height: 44px; }
.leaflet-control-layers-selector { margin: 0; top: 0; }
.leaflet-container .leaflet-control-attribution { background: rgba(255, 255, 255, .92); color: #111827; font-size: 12px; line-height: 1.35; padding: 2px 5px; white-space: normal; max-width: 100%; }
.leaflet-container .leaflet-control-attribution a { color: #123f66; text-decoration: underline; }
/* El logo va sobre la imagen, sin fondo ni retoques. En móvil la atribución ocupa todo el ancho: queda encima de ella. Un toque pasa al mapa. */
.leaflet-container .logo-capa { display: block; margin: 0 0 6px 8px; pointer-events: none; }
@media (max-width: 640px) { .leaflet-container .logo-capa { margin-bottom: 44px; } }

/* Diálogos */
dialog { background: var(--superficie); color: var(--texto); border: 0; border-radius: var(--r); box-shadow: var(--sombra); padding: 1.1rem; width: min(30rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog ul { margin: .25rem 0 .75rem; padding-left: 1.2rem; overflow-wrap: anywhere; }
.dlg-botones { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }

/* Administración */
.admin { padding: 1rem var(--margen) 3rem; max-width: 76rem; margin: 0 auto; }
.caja { background: var(--superficie); border-radius: var(--r); box-shadow: var(--sombra-peq); padding: 1rem; margin: 1rem 0; overflow-wrap: break-word; overflow-x: auto; }
.caja > form { margin-top: .5rem; }
.caja form .btn-principal { margin-top: .75rem; }
.celda-accion form .btn-secundario, .lista-simple .btn-secundario { white-space: nowrap; }
.lista-simple { list-style: none; margin: 0 0 1rem; padding: 0; }
.lista-simple li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--borde); }
.lista-simple form { margin: 0; }
.tabla { width: 100%; border-collapse: collapse; margin: .75rem 0; background: var(--superficie); }
.tabla th { text-align: left; font-size: .85rem; color: var(--tenue); font-weight: 600; padding: .4rem .5rem; border-bottom: 2px solid var(--borde); }
.tabla td { padding: .45rem .5rem; border-bottom: 1px solid var(--borde); vertical-align: middle; overflow-wrap: break-word; }
.sin-partir { white-space: nowrap; }
.num-celda { font-variant-numeric: tabular-nums; }
.enlace-44 { display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; }
.marca-celda { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; }
@media (max-width: 720px) {
  .tabla-tarjetas thead, .tabla-capas thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabla-tarjetas tr, .tabla-capas tr { display: block; padding: .5rem 0; border-bottom: 2px solid var(--borde); }
  .tabla-tarjetas td, .tabla-capas td { display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem; border: 0; padding: .15rem 0; align-items: center; }
  .tabla-tarjetas td::before, .tabla-capas td::before { content: attr(data-label); color: var(--tenue); font-size: .85rem; }
  .tabla-tarjetas td.celda-accion { display: block; padding-top: .35rem; }
  .tabla-tarjetas td.celda-accion::before { content: none; }
  .tabla-tarjetas td.celda-accion:empty { display: none; }
  .sin-partir { white-space: normal; }
}

/* Escritorio: lista a la izquierda, mapa a la derecha, sin desplazar la página */
@media (min-width: 900px) and (min-height: 561px) {
  .pag-mapa { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  .trabajo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 26rem) 1fr; }
  .zona-mapa { grid-column: 2; grid-row: 1; position: relative; display: flex; flex-direction: column; min-height: 0; }
  .mapa-marco { flex: 1; min-height: 0; }
  #mapa { height: 100%; }
  .zona-lista { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; padding: 0; background: var(--fondo); border-right: 1px solid var(--borde); }
  .panel-cabeza { padding: .75rem var(--margen) .25rem; margin: 0; }
  .lista-marco { flex: 1; min-height: 0; overflow-y: auto; padding: .25rem var(--margen) .75rem; }
  .acciones { position: static; box-shadow: 0 -1px 0 var(--borde); }
  .fila { scroll-margin: .25rem; }
  .toast { left: auto; right: 1.5rem; bottom: 1.5rem; max-width: 30rem; }
}
/* Poca altura (texto al 200 % o móvil apaisado): nada fijo, todo se desplaza con la página */
@media (max-height: 560px) {
  .zona-mapa { position: static; }
  #mapa { height: 280px; }
  .zona-lista { padding-bottom: 1rem; }
  .acciones { position: static; padding-left: 0; padding-right: 0; background: none; box-shadow: none; }
  .fila { scroll-margin: .25rem; }
  .toast { bottom: .75rem; }
}
