/* estilos.css — Lote KML → Plano AutoCAD. Tipografía del sistema, paleta de la plantilla del motor. */
:root {
  --tinta: #111827;
  --texto: #1f2937;
  --texto-suave: #6b7280;
  --papel: #f3f4f6;
  --panel: #ffffff;
  --borde: #e5e7eb;
  --lindero: #16a34a;
  --lindero-oscuro: #15803d;
  --verde-tinta: #065f46;
  --amarillo: #fef9c3;
  --amarillo-fuerte: #facc15;
  --rojo: #b91c1c;
  --foco: #2563eb;
  --radio: 10px;
  --sombra: 0 1px 2px rgba(17, 24, 39, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--texto);
  background: var(--papel);
}
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }

/* ───── Cabecera ───── */
.cabecera {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--tinta); color: #fff;
}
.marca { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.marca-icono { width: 36px; height: 36px; flex: none; }
.marca h1 { font-size: 17px; letter-spacing: .01em; }
.marca p { font-size: 12px; color: #9ca3af; }

.zona-carga {
  flex: 1 1 320px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; border: 1.5px dashed #4b5563; border-radius: var(--radio);
  color: #d1d5db; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 8px 8px;                       /* papel milimetrado */
}
.zona-carga:hover, .zona-carga:focus-visible { border-color: var(--lindero); background-color: rgba(22,163,74,.08); }
.zona-carga.arrastrando { border-color: var(--amarillo-fuerte); background-color: rgba(250,204,21,.12); color: #fff; }
.zona-carga-texto { flex: 1; }
.zona-carga-archivo { flex: 1; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zona-carga-archivo::before { content: "📄 "; }

.acciones-cabecera { display: flex; gap: 8px; }

/* ───── Botones ───── */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2; transition: background .15s, border-color .15s;
}
.boton:disabled { opacity: .5; cursor: not-allowed; }
.boton-primario { background: var(--lindero); color: #fff; }
.boton-primario:hover:not(:disabled) { background: var(--lindero-oscuro); }
.boton-secundario { background: transparent; color: inherit; border-color: currentColor; opacity: .9; }
.boton-secundario:hover:not(:disabled) { opacity: 1; background: rgba(127,127,127,.12); }
.cabecera .boton-secundario { color: #e5e7eb; border-color: #4b5563; }
.boton-dxf { padding: 9px 18px; font-size: 14px; box-shadow: 0 2px 6px rgba(22,163,74,.35); }

/* ───── Opciones ───── */
.opciones { background: var(--panel); border-bottom: 1px solid var(--borde); padding: 14px 20px; }
.opciones form { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 24px; }
.opciones fieldset { border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px 14px 12px; margin: 0; display: grid; gap: 8px; align-content: start; }
.opciones legend { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); font-weight: 600; padding: 0 6px; }
.opciones label { display: grid; gap: 3px; font-size: 12.5px; color: var(--texto-suave); }
.opciones label.check { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--texto); }
.opciones label.check small { color: var(--texto-suave); }
.opciones input[type="text"], .opciones select {
  font: inherit; font-size: 13px; color: var(--texto); padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; min-width: 0; width: 100%;
}
.opciones .rotulo { grid-template-columns: 1fr 1fr; }
.opciones .rotulo legend { grid-column: 1 / -1; }
.opciones-pie { grid-column: 1 / -1; font-size: 12px; color: var(--texto-suave); }

/* ───── Avisos y estados ───── */
.aviso { margin: 14px 20px 0; padding: 10px 14px; border-radius: var(--radio); font-size: 13.5px; }
.aviso-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.aviso-error::before { content: "⚠ "; }

.vacio { display: flex; justify-content: center; padding: 48px 20px; }
.vacio-tarjeta {
  max-width: 640px; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 28px 32px; box-shadow: var(--sombra);
  display: grid; gap: 16px; justify-items: start;
}
.vacio-tarjeta h2 { font-size: 20px; color: var(--tinta); }
.vacio-tarjeta ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.vacio-nota { font-size: 12.5px; color: var(--texto-suave); }

.cargando { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 64px 20px; color: var(--texto-suave); }
.spinner { width: 36px; height: 36px; border: 4px solid var(--borde); border-top-color: var(--lindero); border-radius: 50%; animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ───── Resultado ───── */
main { padding: 14px 20px 24px; display: grid; gap: 14px; }
.barra-resultado { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.barra-resultado label { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.barra-resultado select { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; max-width: 360px; }
.separador { flex: 1; }
.descargas { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.descargas .boton-secundario { color: var(--texto); border-color: #d1d5db; background: #fff; }
.menu-csv { position: relative; }
.menu-csv-lista { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--borde); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 240px; z-index: 1000; display: grid; }
.menu-csv-lista a { padding: 8px 12px; font-size: 13px; color: var(--texto); text-decoration: none; white-space: nowrap; }
.menu-csv-lista a:hover { background: var(--papel); }

.resumen { display: flex; gap: 28px; flex-wrap: wrap; padding: 12px 18px; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); font-size: 14px; box-shadow: var(--sombra); }
.resumen b { display: block; font-size: 11px; text-transform: uppercase; color: var(--texto-suave); letter-spacing: .05em; font-weight: 600; }

.columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 950px) { .columnas { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--sombra); }
.panel h2 { font-size: 14px; padding: 10px 14px; border-bottom: 1px solid var(--borde); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel h2 span { font-weight: 400; font-size: 12px; color: var(--texto-suave); }
#plano { width: 100%; height: 540px; display: block; background: #fafafa; }
#mapa { width: 100%; height: 540px; background: #e5e7eb; }
@media (max-width: 950px) { #plano, #mapa { height: 420px; } }
.leyenda { display: flex; gap: 16px; padding: 8px 14px; font-size: 12px; border-top: 1px solid var(--borde); flex-wrap: wrap; align-items: center; }
.leyenda i { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -2px; border-radius: 2px; }
.leyenda-nota { color: var(--texto-suave); margin-left: auto; }

.tabla { padding: 6px 14px 10px; overflow-x: auto; }
table { border-collapse: collapse; font-size: 12.5px; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 10px; border-bottom: 1px solid #eee; text-align: right; white-space: nowrap; }
th { color: var(--texto-suave); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
th:first-child, td:first-child { text-align: left; }
tr.frente td { background: var(--amarillo); font-weight: 600; }

.nota-precision { font-size: 12px; color: var(--texto-suave); }
.pie { padding: 8px 20px 18px; font-size: 11.5px; color: var(--texto-suave); text-align: right; }

/* Etiquetas de vértices en el mapa (tooltips Leaflet) */
.etq { background: rgba(17,24,39,.75); color: #fff; border: none; font-weight: 700; font-size: 11px; padding: 1px 5px; }
.etq::before { display: none; }

@media (max-width: 640px) {
  .cabecera { padding: 10px 14px; gap: 12px; }
  .marca { min-width: 0; }
  .acciones-cabecera { width: 100%; }
  .acciones-cabecera .boton { flex: 1; }
  main, .opciones { padding-left: 12px; padding-right: 12px; }
  .aviso { margin-left: 12px; margin-right: 12px; }
  .opciones .rotulo { grid-template-columns: 1fr; }
  .boton-dxf { width: 100%; }
}
