/* ZonQR Captura — iPad first (768–1180), toques de 44px, inputs de 16px */
:root {
  --bg: #080808; --card: #121212; --elev: #1a1a1a; --line: #2a2a2a;
  --text: #f3f3ee; --muted: #9a9a90; --lime: #c6ff3d; --danger: #ff5c5c; --warn: #ffd166; --blue: #7ab8ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100dvh; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
a { color: var(--lime); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

input, select, textarea {
  width: 100%; min-height: 44px; font-size: 16px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--elev); -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 30px; }
input[type="date"] { min-height: 44px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lime); outline-offset: 0; border-color: transparent; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 650; font-size: .95rem; cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.btn-lime { background: var(--lime); color: #080808; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-danger { background: rgba(255,92,92,.14); color: var(--danger); border-color: rgba(255,92,92,.35); }
.btn-sm { min-height: 40px; padding: 8px 12px; font-size: .86rem; }
.btn-big { width: 100%; min-height: 56px; font-size: 1.05rem; margin-bottom: 14px; }
.btn:disabled { opacity: .5; }
.linkbtn { background: none; border: 0; color: var(--lime); font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 36px; padding: 4px; }

.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
  box-sizing: border-box; height: calc(56px + env(safe-area-inset-top, 0px)); /* altura fija: la .nav se pega justo debajo */
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: rgba(8,8,8,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.top h1 span { color: var(--lime); font-weight: 700; }
.net-pill { font-size: .78rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); }
.net-pill.on { color: var(--lime); border-color: rgba(198,255,61,.4); }
.net-pill.off { color: var(--warn); border-color: rgba(255,209,102,.5); background: rgba(255,209,102,.08); }

.nav { position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 39; display: flex; gap: 8px; overflow-x: auto;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); border-bottom: 1px solid var(--line); }
.nav button { flex: 0 0 auto; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 650; cursor: pointer; }
.nav button.on { color: var(--lime); border-color: var(--lime); background: rgba(198,255,61,.08); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left)); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel h2 { font-size: 1.08rem; margin-bottom: 8px; }
.panel h3 { font-size: 1rem; margin-bottom: 4px; }
.panel p { margin-bottom: 10px; }
.hint { font-size: .82rem; color: var(--muted); }
.hint.warn { color: var(--warn); } .hint.ok { color: var(--lime); }
.tip { background: rgba(198,255,61,.07); border: 1px solid rgba(198,255,61,.3); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: .9rem; }
.backup-banner { background: rgba(255,209,102,.1); border: 1px solid rgba(255,209,102,.4); color: #ffe3a3; border-radius: 12px; padding: 8px 14px; margin-bottom: 14px; font-size: .9rem; }
.fatal { background: rgba(255,92,92,.12); border: 1px solid rgba(255,92,92,.4); color: var(--danger); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); }

.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.bar > input, .bar > select { flex: 1 1 160px; }
.bar .grow { flex: 1 1 200px; margin: 0; }
.filters select { flex: 1 1 150px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.row:active { border-color: var(--lime); }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--elev); }
.thumb.ph { display: grid; place-items: center; font-size: .68rem; color: var(--muted); text-align: center; }
.row-main { min-width: 0; }
.row-main strong { display: block; font-size: 1.02rem; overflow-wrap: anywhere; }
.sub { font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.pills { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.pill { font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.e-prospecto { color: var(--muted); }
.e-interesado { color: var(--warn); border-color: rgba(255,209,102,.45); }
.e-listo { color: var(--lime); border-color: rgba(198,255,61,.45); background: rgba(198,255,61,.08); }
.b-activo { color: var(--lime); } .b-por_vencer { color: var(--warn); border-color: rgba(255,209,102,.45); }
.b-vencido { color: var(--danger); border-color: rgba(255,92,92,.45); background: rgba(255,92,92,.08); }
.b-pausado { color: var(--muted); } .b-trial { color: var(--blue); border-color: rgba(122,184,255,.45); }

.due-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; background: var(--elev); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.due-row.late { border-color: rgba(255,92,92,.45); }
.due-row .info { flex: 1 1 200px; }

.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.detail-head h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .row { grid-template-columns: 56px 1fr; } .pills { grid-column: 2; flex-direction: row; align-items: flex-start; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: .82rem; color: var(--muted); font-weight: 650; }
.section { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--lime); font-weight: 800; margin: 20px 0 10px; }
.section .hint { text-transform: none; letter-spacing: 0; font-weight: 500; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tag { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--elev); color: var(--muted); cursor: pointer; font-size: .88rem; }
.tag.on { color: var(--lime); border-color: var(--lime); background: rgba(198,255,61,.1); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--elev); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-del { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border-radius: 10px; border: 0; background: rgba(0,0,0,.72); color: #fff; font-size: 1rem; cursor: pointer; }
.photo-size { position: absolute; left: 6px; bottom: 6px; font-size: .7rem; background: rgba(0,0,0,.7); padding: 2px 6px; border-radius: 6px; }
.photo-add { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; min-height: 120px;
  border: 1px dashed #444; border-radius: 12px; background: var(--elev); color: var(--text); font-weight: 650; cursor: pointer; }

#map { position: relative; z-index: 0; height: 300px; border-radius: 14px; border: 1px solid var(--line); margin: 10px 0 6px; background: #1d1d1d; }
@media (orientation: landscape) and (min-width: 1000px) { #map { height: 360px; } }
.pin { width: 28px; height: 28px; border-radius: 50%; background: var(--lime); border: 4px solid #080808; box-shadow: 0 0 0 2px var(--lime), 0 4px 12px rgba(0,0,0,.6); }
.geo-result { display: block; width: 100%; text-align: left; min-height: 44px; margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--elev); cursor: pointer; font-size: .88rem; }
.leaflet-container { font-family: var(--font); }

.actionbar { position: sticky; bottom: 0; z-index: 30; display: flex; flex-wrap: wrap; gap: 8px; margin: 18px -16px -16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(18,18,18,.97); border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; }
.actionbar .spacer { flex: 1; }

.group .actions { margin-top: 8px; }
.steps { padding-left: 22px; } .steps li { margin-bottom: 6px; }

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.modal-box { width: 100%; max-width: 560px; max-height: min(90dvh, 100%); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.modal-box h2 { font-size: 1.15rem; margin-bottom: 10px; }
.modal-box p { margin-bottom: 10px; }
.modal-box .actions { margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, calc(100% + 80px)); z-index: 200;
  background: var(--lime); color: #080808; font-weight: 700; padding: 12px 20px; border-radius: 999px; max-width: 90vw; text-align: center; transition: transform .25s ease; }
.toast.show { transform: translate(-50%, 0); }

.relu-credit { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 26px; font-size: .72rem; color: var(--muted); opacity: .85; }
.relu-credit img { height: 20px; width: auto; }
