/* Layout: pantalla negra, foto difuminada con el nombre encima, tarjeta de preguntas centrada */
:root {
  --bg: #0a0a0a;
  --card: #141414;
  --card-hover: #1b1b1b;
  --line: #2a2a2a;
  --fg: #f2f2f0;
  --muted: #8a8a86;
  --faint: #4a4a48;
  --accent: #ffffff;
  --error: #ff8a7a;
  --display: "Oswald", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; }

header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding-block: 22px;
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; font-size: 15px; text-decoration: none; }
.tag { color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; }
a.tag:hover { color: var(--fg); }

main {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 36px;
  padding-block: 8px 56px;
}

/* Foto difuminada + nombre */
.hero { position: relative; width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; }
.hero.sm { max-width: 400px; }
.photo { position: relative; width: 100%; max-width: 100%; aspect-ratio: 1; overflow: hidden; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.photo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, transparent 40%, rgba(10,10,10,.75) 75%, var(--bg) 97%),
    linear-gradient(to right, var(--bg) 0%, transparent 18%, transparent 82%, var(--bg) 100%),
    linear-gradient(to top, transparent 85%, var(--bg) 100%);
}
h1 {
  font-family: var(--display); font-weight: 300; text-transform: uppercase;
  font-size: clamp(40px, 9vw, 84px); line-height: .95; letter-spacing: .01em;
  text-align: center; margin: 0; text-wrap: balance;
}
.hero.sm h1 { font-size: clamp(36px, 8vw, 60px); }
h1 strong { font-weight: 500; display: block; }
.hero h1 { margin-top: -0.9em; position: relative; }

/* Tarjeta de formulario */
.card {
  width: 100%; max-width: 520px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 32px clamp(20px, 5vw, 36px);
  display: flex; flex-direction: column; gap: 22px;
}
.section { font-family: var(--display); font-weight: 500; font-size: 22px; letter-spacing: .08em; text-transform: uppercase; margin: 0; }
.lead { margin: -10px 0 0; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; line-height: 1.5; color: var(--muted); }
.progress { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 1px; background: var(--line); position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); width: 0; transition: width .35s ease; }
.step { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 13px; color: var(--muted); }

input, textarea, select {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  color: var(--fg); font: 300 22px/1.3 var(--body); padding: 10px 0; outline: none;
}
textarea { font-size: 18px; line-height: 1.5; resize: vertical; min-height: 110px; }
select {
  padding-right: 28px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 6px) 55%; background-size: 6px 6px; background-repeat: no-repeat;
}
select:invalid { color: var(--faint); }
select option { background: var(--card); color: var(--fg); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { border-bottom-color: var(--accent); }
.phone { display: flex; gap: 14px; align-items: flex-end; }
.phone select { flex: 0 0 auto; width: 7.2em; font-size: 18px; padding-bottom: 12px; }
.phone input { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hint { margin: -2px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 150px; padding: 18px; border: 1px dashed #3a3a3a; border-radius: 6px;
  color: var(--fg); font-size: 14px; letter-spacing: .04em; cursor: pointer; text-align: center;
}
.upload:hover { border-color: var(--muted); }
.upload img { max-width: 100%; max-height: 260px; border-radius: 4px; object-fit: contain; }
.upload.has { border-style: solid; }
.upload.has span { color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.sr-only:focus-visible + .upload { outline: 2px solid var(--accent); outline-offset: 3px; }
.notice {
  max-height: 240px; overflow-y: auto; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  color: var(--muted); font-size: 13px; line-height: 1.6;
}
.notice strong { display: block; color: var(--fg); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.notice p { margin: 8px 0 0; }
.check { display: flex; gap: 12px; align-items: flex-start; color: var(--fg); font-size: 14px; line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--accent); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.err { color: var(--error); font-size: 12px; min-height: 16px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button {
  font: 500 12px var(--body); letter-spacing: .16em; text-transform: uppercase;
  border-radius: 4px; padding: 14px 22px; cursor: pointer; border: 1px solid var(--accent);
}
.primary { background: var(--accent); color: var(--bg); }
.primary:disabled { opacity: .5; cursor: progress; }
.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.done { text-align: center; gap: 14px; }
.done h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .04em; font-size: 30px; margin: 0; }
.done p { color: var(--muted); margin: 0; line-height: 1.6; }
.done .actions { justify-content: center; }
.done a.ghost { text-decoration: none; font: 500 12px var(--body); letter-spacing: .16em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 4px; padding: 14px 22px; }

/* Hub */
.menu { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.menu h2 { margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.option {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 16px;
  padding: 22px clamp(20px, 5vw, 28px);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  text-decoration: none; transition: background .2s ease, border-color .2s ease;
}
.option:hover { background: var(--card-hover); border-color: #3a3a3a; }
.option strong { font-family: var(--display); font-weight: 500; font-size: 26px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.1; }
.option span { grid-column: 1; color: var(--muted); font-size: 14px; line-height: 1.5; }
.option i { grid-column: 2; grid-row: 1 / span 2; font-style: normal; font-size: 22px; color: var(--muted); transition: transform .2s ease, color .2s ease; }
.option:hover i { transform: translateX(4px); color: var(--fg); }

footer { color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding-block: 20px; border-top: 1px solid var(--line); text-align: center; }

@media (prefers-reduced-motion: reduce) { .bar i, .option, .option i { transition: none; } }

/* ===== Mapeo ===== */
:root { --warn: #f2b84b; --ok: #6fcf97; --map-bg: #edf0ed; }
main.wide { align-items: stretch; justify-content: flex-start; padding-block: 28px 56px; }
header .actions { gap: 18px; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--muted); letter-spacing: .16em; }
.linkish:hover { color: var(--fg); }
.note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.mini { margin: 0; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }

.dash { width: 100%; max-width: 1240px; margin-inline: auto; display: flex; flex-direction: column; gap: 22px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dash-head .section { margin-bottom: 4px; }
.chips { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.chip { border: 0; border-radius: 999px; padding: 9px 16px; background: transparent; color: var(--muted); }
.chip.on { background: var(--accent); color: var(--bg); }
.dash-head .ghost { padding: 11px 18px; }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 960px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat span { color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.stat strong { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat.warn strong { color: var(--warn); }
.stat.info strong { color: #7db7ff; }
.stat.good strong { color: var(--ok); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.map-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.map-scroll { overflow-x: auto; border-radius: 6px; border: 1px solid var(--line); background: var(--map-bg); }
.map { position: relative; min-width: 640px; cursor: pointer; user-select: none; }
.map img { display: block; width: 100%; height: auto; max-width: none; }
.badge {
  position: absolute; transform: translate(-50%, 0);
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px;
  background: #0a0a0a; color: #fff; border: 2px solid #fff;
  font: 600 12px/22px var(--body); letter-spacing: 0; text-transform: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: pointer;
}
.badge:hover { background: #fff; color: #0a0a0a; border-color: #0a0a0a; }
.badge.sel { background: #fff; color: #0a0a0a; border-color: #0a0a0a; box-shadow: 0 0 0 4px #0a0a0a; transform: translate(-50%, 0) scale(1.15); }
.pin {
  position: absolute; width: 40px; height: 40px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 3px solid #0a0a0a; box-shadow: 0 0 0 3px rgba(255,255,255,.85); pointer-events: none;
}

.detail { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; max-height: 640px; overflow-y: auto; }
.detail-empty, .detail-none { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.detail-title { margin: 0; font-family: var(--display); font-weight: 500; font-size: 26px; letter-spacing: .04em; text-transform: uppercase; }
.detail .mini { margin-top: 10px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.people li { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.p-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-top strong { font-weight: 500; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.p-sub { color: var(--muted); font-size: 13px; line-height: 1.4; }
.pill { flex: 0 0 auto; font-size: 11px; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor; }
.pill.warn { color: var(--warn); }
.pill.ok { color: var(--ok); }
.pill.info { color: #7db7ff; }
.p-top { flex-wrap: wrap; gap: 6px 10px; }
.p-tags { flex-wrap: wrap; justify-content: flex-end; }
.pill-select {
  width: auto; padding: 5px 26px 5px 11px; border: 1px solid currentColor; border-radius: 999px;
  background-color: transparent; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
  font: 500 12px/1.2 var(--body); letter-spacing: .04em; -webkit-appearance: none; appearance: none;
}
.pill-select.warn { color: var(--warn); }
.pill-select.info { color: #7db7ff; }
.pill-select.ok { color: var(--ok); }
.pill-select.busy { color: var(--muted); opacity: .6; cursor: progress; }
.pill-select:disabled { cursor: default; }
.pill-select:focus, .pill-select:focus-visible { border-color: currentColor; outline: 2px solid currentColor; outline-offset: 2px; }

.table-card { display: flex; flex-direction: column; gap: 10px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.sel { background: var(--card-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.zero { color: var(--faint); }
td.warnTxt { color: var(--warn); }
.option.locked { border-style: dashed; }

/* Mapa SVG interactivo */
.map-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chips.small .chip { padding: 7px 14px; font-size: 11px; }
.legend { color: var(--muted); font-size: 12px; }
.svgmap {
  position: relative; width: 100%; aspect-ratio: 2689 / 2316; max-width: 100%;
  background: var(--map-bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.svgmap svg { display: block; width: 100%; height: 100%; cursor: grab; }
.svgmap svg:active { cursor: grabbing; }
.shape { stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: pointer; transition: fill .2s ease, filter .15s ease; outline: none; }
.shape:hover, .shape:focus-visible { filter: brightness(.93) saturate(1.15); stroke: #1a1a1a; stroke-width: 2; }
.shape.sel { stroke: #0a0a0a; stroke-width: 3.5; filter: none; }
.shape.water { cursor: default; }
.lbl { font-family: var(--body); font-weight: 600; fill: #1c1c1c; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 5px; stroke-linejoin: round; pointer-events: none; }
.lbl-water { fill: #4a6b7a; font-weight: 500; }
.bub { fill: #0a0a0a; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.bub.sel { fill: #fff; stroke: #0a0a0a; }
.bub-t { font-family: var(--body); font-weight: 700; fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.bub-t.sel { fill: #0a0a0a; }
.zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoom button {
  width: 36px; height: 36px; padding: 0; border-radius: 6px; border: 1px solid #d4d8d4;
  background: #fff; color: #1c1c1c; font: 500 18px/1 var(--body); letter-spacing: 0; text-transform: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.zoom button:hover { background: #f2f4f2; }
.tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: #0a0a0a; color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 4px; white-space: nowrap;
}

/* Botón de WhatsApp en la lista de personas */
.p-tags { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.wa-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: #25d366; color: #0a0a0a; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.wa-btn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #0a0a0a; opacity: .75; }
.wa-btn:hover { background: #3be27a; }
