/* Componentes reutilizables: botones, lista, insignias, detalle, formulario, avisos y punto de ubicación. */
.btn { text-decoration: none; min-height: 48px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--field); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-wa { background: #25d366; color: #fff; border-color: transparent; box-shadow: 0 6px 16px -8px rgba(37,211,102,.8); }
.btn-wa:hover { background: #1fbd5a; }
.btn-soft-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.btn-soft-danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.btn-block { width: 100%; }
.row { display: flex; gap: 8px; margin-top: 12px; }
.row .btn { flex: 1; }

/* toast: cristal esmerilado, entra desde arriba. Las variantes solo cambian el tinte (--toast-bg/-edge/-glow); brillo y sombras son comunes */
.toast { --toast-bg: color-mix(in srgb, var(--surface-solid) 45%, transparent); --toast-edge: rgba(255,255,255,.16); --toast-glow: rgba(0,0,0,.5);
  pointer-events: auto; touch-action: none; cursor: grab; width: 100%; max-width: 420px; padding: 13px 16px; border-radius: 18px;
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,0) 60%), var(--toast-bg); border: 1px solid var(--toast-edge);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(0,0,0,.18), 0 16px 36px -12px var(--toast-glow), 0 2px 8px rgba(0,0,0,.18);
  animation: toast-in .35s cubic-bezier(.2,.8,.2,1); }
[data-theme="light"] .toast { --toast-bg: rgba(255,255,255,.62); --toast-edge: rgba(255,255,255,.8); --toast-glow: rgba(15,23,42,.25); }
.toast::before { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
/* variante éxito: cristal verde con check */
.toast.success { --toast-bg: linear-gradient(135deg, rgba(34,197,94,.42), rgba(16,120,60,.38)); --toast-edge: rgba(134,239,172,.45); --toast-glow: rgba(16,120,60,.55); color: #eafff1; }
.toast.success::before { content: '✓'; color: #052e16; background: #86efac; }
[data-theme="light"] .toast.success { --toast-bg: linear-gradient(135deg, rgba(134,239,172,.7), rgba(74,222,128,.55)); --toast-edge: rgba(22,163,74,.45); --toast-glow: rgba(22,163,74,.35); color: #064e24; }
[data-theme="light"] .toast.success::before { color: #fff; background: #16a34a; }
/* variante aviso del admin: cristal del acento con "i" */
.toast.aviso { --toast-bg: linear-gradient(135deg, color-mix(in srgb, var(--accent) 50%, transparent), color-mix(in srgb, var(--accent) 30%, transparent)); --toast-edge: color-mix(in srgb, var(--accent) 60%, transparent); font-weight: 600; }
.toast.aviso::before { content: 'i'; color: #fff; background: var(--accent); }
/* variante alerta: cristal rojo con "!" (operativo detectado, baja, publicar sobre el agua) */
.toast.danger { --toast-bg: linear-gradient(135deg, rgba(239,68,68,.55), rgba(153,27,27,.5)); --toast-edge: rgba(252,165,165,.5); --toast-glow: rgba(153,27,27,.6); color: #fff1f1; font-weight: 600; }
.toast.danger::before { content: '!'; font-size: 14px; color: #fff; background: #dc2626; }
[data-theme="light"] .toast.danger { --toast-bg: linear-gradient(135deg, rgba(239,68,68,.88), rgba(185,28,28,.85)); --toast-edge: rgba(185,28,28,.6); --toast-glow: rgba(185,28,28,.4); color: #fff; }
.toast.out { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-140%) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-140%) scale(.96); } }

.seg { display: flex; background: var(--field); border-radius: 14px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; min-height: 40px; border: 0; background: none; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

.list { list-style: none; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.list li button { width: 100%; text-align: left; display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--field); min-height: 64px; }
.list .empty { text-align: center; color: var(--muted); padding: 40px 0; }
.list .meta { color: var(--muted); font-size: 13px; }
.list .txt { min-width: 0; flex: 1; }
.list .txt b, .list .txt .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.t-operativo { background: var(--c-operativo); }
.t-radar { background: #1466ff; }

/* detalle */
.detail-head { display: flex; gap: 12px; align-items: center; padding-right: 40px; }
.detail-head h2 { font-size: 20px; }
.detail-note { margin-top: 12px; overflow-wrap: anywhere; }
.detail-meta { margin-top: 8px; color: var(--muted); font-size: 14px; display: grid; gap: 2px; }

/* formulario */
.sheet-title { font-size: 20px; margin-bottom: 4px; padding-right: 40px; }
.field { width: 100%; border: 1px solid var(--border); background: var(--field); color: var(--text); border-radius: 14px; padding: 12px; font: inherit; font-size: 16px; resize: none; }
.counter { text-align: right; color: var(--muted); font-size: 12px; margin-top: 2px; }
.where { color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.where button { border: 0; background: none; color: var(--accent); font-weight: 600; min-height: 44px; }
.err { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { min-height: 44px; padding: 0 14px 0 8px; border-radius: 10px; border: 2px solid var(--border); background: var(--field); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.chip .badge { width: 28px; height: 28px; }
.chip[aria-pressed="false"] { opacity: .5; }

.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25); }

/* globo de detalle (popup de MapLibre) con flecha hacia el pin */
.inc-pop { z-index: 25; }
.inc-pop .maplibregl-popup-content { width: 264px; padding: 16px; font: inherit; color: var(--text); border-radius: 20px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent); border: 1px solid rgba(255,255,255,.12);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 16px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.1); animation: pop-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.inc-pop .maplibregl-popup-tip { border-width: 8px; }
.inc-pop.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: color-mix(in srgb, var(--surface-solid) 88%, #fff 4%); margin-bottom: -1px; }
.inc-pop.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: color-mix(in srgb, var(--surface-solid) 88%, #fff 4%); }
.inc-pop.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface-solid); }
.inc-pop.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface-solid); }
.inc-pop .detail-head { padding: 0; gap: 12px; }
.inc-pop .detail-head h2 { font-size: 17px; line-height: 1.2; }
.inc-pop .detail-head .sub { color: var(--muted); font-size: 13px; }
.inc-pop .detail-note { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--field); font-size: 14px; line-height: 1.35; }
.inc-pop .stat { margin: 12px 0 14px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.inc-pop .btn { min-height: 42px; font-size: 15px; }
.detail-actions { display: grid; gap: 8px; }
.detail-img { display: block; width: 100%; max-height: 200px; object-fit: cover; margin-top: 12px; border-radius: 12px; background: var(--field); }
.adm { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.adm-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.adm textarea { width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--field); color: var(--text);
  font: inherit; font-size: 16px; resize: vertical; }
.adm textarea:focus { outline: none; border-color: var(--accent); }
.adm .row { display: flex; gap: 6px; }
.adm .btn { white-space: normal; line-height: 1.15; }
.btn-sm { min-height: 38px !important; font-size: 13px !important; padding: 0 10px; }
.inc-pop .fade-out { opacity: 0; filter: blur(4px); transform: scale(.96); pointer-events: none; transition: opacity .3s ease, filter .3s ease, transform .3s ease; }
.inc-pop.closing .maplibregl-popup-content, .inc-pop.closing .maplibregl-popup-tip { animation: pop-out .3s ease-in forwards; pointer-events: none; }
@keyframes pop-out { to { opacity: 0; filter: blur(8px); transform: translateY(-4px) scale(.96); } }
/* mira que cae al publicar (map.js drop) */
.drop-pin, .drop-shadow, .drop-ring { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%,-50%); opacity: 0; }
.drop-pin { width: 56px; height: 56px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); will-change: transform; }
.drop-pin svg { display: block; }
.drop-shadow { width: 30px; height: 10px; border-radius: 50%; background: rgba(0,0,0,.45); filter: blur(2px); }
.drop-ring { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgb(255,32,32); background: rgba(255,32,32,.16); box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }

/* modal tras publicar: compartir por WhatsApp sobre el mapa difuminado */
.share-modal { width: min(360px, calc(100% - 32px)); max-width: none; padding: 0; margin: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); animation: share-in .3s cubic-bezier(.2,.8,.2,1); }
.share-modal::backdrop { background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: share-fade .3s ease-out; }
.share-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 20px 20px; }
.share-card .badge { width: 56px; height: 56px; margin-bottom: 14px; box-shadow: 0 0 0 8px color-mix(in srgb, var(--c-operativo) 18%, transparent); }
.share-card .badge svg { width: 30px; height: 30px; }
.share-card h2 { font-size: 20px; font-weight: 700; }
.share-card p { color: var(--muted); font-size: 15px; margin: 6px 0 20px; }
.share-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
@keyframes share-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes share-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .share-modal, .share-modal::backdrop { animation: none; } }

/* Pantalla de baneo: negro y mínimo. */
#banned {
  position: fixed; inset: 0; z-index: 2147483647; display: flex; flex-direction: column;
  overflow: auto; outline: none; background: #000; color: #fff;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.ban-main, .ban-appeal { width: min(100%, 420px); margin-inline: auto; }
.ban-main { margin-block: auto; }
.ban-kicker { margin: 0; color: #888; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; }
#ban-title { margin: 8px 0 24px; font-size: clamp(32px, 9vw, 44px); line-height: 1.05; font-weight: 700; }
#ban-why p { margin: 0 0 8px; color: #ccc; line-height: 1.45; overflow-wrap: anywhere; }
#ban-why b { color: #fff; font-weight: 600; }
.ban-appeal form { display: grid; gap: 10px; }
.ban-appeal label, .ban-sent { margin: 0; color: #aaa; font-size: 14px; }
.ban-sent { text-align: center; }
.ban-appeal textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #333; background: #111; color: #fff; font: inherit; font-size: 16px; resize: vertical; }
.ban-btn { width: 100%; min-height: 48px; border-radius: 10px; border: 1px solid #333; background: #111; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.ban-btn:disabled { opacity: .5; cursor: progress; }
.ban-err { margin: 0; color: #f87171; font-size: 14px; }
.ban-err:empty, .ban-appeal [hidden] { display: none; }

/* Sugerencia de instalación (install.js): hoja inferior estilo iOS con un teléfono animado paso a paso. */
.install-modal { width: min(480px, 100%); max-width: none; max-height: 100%; margin: auto auto 0; padding: 0; border: 0; border-radius: 22px 22px 0 0;
  background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); animation: ip-up .42s cubic-bezier(.2,.9,.25,1); }
.install-modal::backdrop { background: rgba(0,0,0,.4); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: share-fade .3s ease-out; }
.install-modal.out { animation: ip-down .26s ease-in forwards; }
.install-modal.out::backdrop { animation: share-fade .26s ease-in reverse forwards; }
@keyframes ip-up { from { transform: translateY(100%); } }
@keyframes ip-down { to { transform: translateY(100%); } }
.ip-card { display: flex; flex-direction: column; gap: 14px; padding: 8px 20px calc(16px + var(--safe-b)); }
.ip-grab { align-self: center; width: 38px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 22%, transparent); }
.ip-head { display: flex; align-items: center; gap: 12px; }
.ip-head img { width: 52px; height: 52px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.ip-head h2 { font-size: 19px; font-weight: 700; }
.ip-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.ip-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ip-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; opacity: .5; transition: opacity .3s; }
.ip-steps li.on { opacity: 1; }
.ip-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--field); font-weight: 700; font-size: 13px; transition: background .3s, color .3s, transform .3s; }
.ip-steps li.on .ip-n { background: var(--accent); color: var(--accent-text); transform: scale(1.1); }
.ip-t, .ip-d { display: block; }
.ip-d { color: var(--muted); font-size: 13px; }
.ip-later { background: transparent; border-color: transparent; color: var(--muted); }

/* El teléfono: siempre oscuro (es un dibujo del dispositivo). Coordenadas en px sobre una pantalla de 150×250. */
.ip-phone { align-self: center; width: 162px; padding: 6px; border-radius: 28px; background: #05070a; box-shadow: 0 0 0 1.5px #2a313d, 0 10px 30px rgba(0,0,0,.35); }
.ip-screen { position: relative; width: 150px; height: 250px; border-radius: 22px; overflow: hidden; background: #111822; font: 600 9px/1 system-ui, sans-serif; color: #cfd8e6; }
.ip-bar { position: absolute; left: 0; right: 0; display: flex; align-items: center; background: #1b2330; }
.ip-top { top: 0; height: 24px; padding: 0 8px; gap: 6px; }
.ip-url { flex: 1; height: 12px; border-radius: 6px; background: #2b3545; }
.ip-dots { font-size: 13px; }
.ip-bottom { bottom: 0; height: 28px; justify-content: space-around; font-size: 13px; }
.ip-share svg { width: 14px; height: 14px; display: block; color: #4c9bff; }
.is-android .ip-bottom, .is-ios .ip-dots { display: none; }
.ip-page { position: absolute; inset: 32px 10px 36px; display: flex; flex-direction: column; gap: 8px; }
.ip-page i { height: 34px; border-radius: 8px; background: #1e2836; }
.ip-page i:first-child { height: 70px; background: linear-gradient(135deg, #1d3557, #2a4d7a); }

.ip-menu { position: absolute; padding-bottom: 4px; background: #222c3a; box-shadow: 0 6px 20px rgba(0,0,0,.5); transition: transform .45s cubic-bezier(.2,.9,.25,1), opacity .3s; }
.ip-menu-head { display: flex; justify-content: space-between; align-items: center; height: 28px; padding: 0 8px; color: #8e9bb0; }
.ip-add { color: #4c9bff; transition: transform .2s; }
.ip-row { height: 22px; margin: 2px 6px 0; border-radius: 6px; background: #2c3747; display: flex; align-items: center; padding: 0 6px; transition: background .25s; }
.is-ios .ip-menu { left: 4px; right: 4px; bottom: 4px; border-radius: 12px; transform: translateY(120%); }
.is-android .ip-menu { top: 26px; right: 6px; width: 112px; border-radius: 8px; transform-origin: top right; transform: scale(.5); opacity: 0; }
[data-step="1"] .ip-menu, [data-step="2"] .ip-menu { transform: none; opacity: 1; }
[data-step="1"] .ip-hit { background: #35577f; transition-delay: 1.2s; }
[data-step="2"] .ip-add { transform: scale(1.15); transition-delay: 1.2s; }

.ip-home { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 34px); justify-content: center; align-content: start; gap: 14px 12px; padding-top: 40px;
  background: linear-gradient(160deg, #1d3557, #3b2a5c); opacity: 0; transition: opacity .4s; }
.ip-home i, .ip-home img { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.18); }
.ip-home img { transform: scale(0); background: none; }
[data-step="3"] .ip-home { opacity: 1; }
[data-step="3"] .ip-home img { animation: ip-pop .55s .5s cubic-bezier(.3,1.6,.5,1) forwards; }
@keyframes ip-pop { to { transform: scale(1); box-shadow: 0 0 0 4px rgba(76,155,255,.45); } }

/* Dedo: viaja al objetivo de cada paso y "toca"; el nombre de la animación alterna para que se reinicie en cada paso. */
.ip-finger { position: absolute; z-index: 2; left: 75px; top: 150px; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: rgba(255,255,255,.55); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); transition: left .6s .3s ease-in-out, top .6s .3s ease-in-out, opacity .3s;
  animation: ip-tap-a 2.8s both; }
.ip-finger::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #fff; opacity: 0; animation: ip-ring-a 2.8s both; }
[data-step="1"] .ip-finger { animation-name: ip-tap-b; }
[data-step="1"] .ip-finger::after { animation-name: ip-ring-b; }
[data-step="3"] .ip-finger { opacity: 0; }
.is-ios[data-step="0"] .ip-finger { left: 94px; top: 236px; }
.is-ios[data-step="1"] .ip-finger { left: 60px; top: 199px; }
.is-ios[data-step="2"] .ip-finger { left: 124px; top: 148px; }
.is-android[data-step="0"] .ip-finger { left: 136px; top: 12px; }
.is-android[data-step="1"] .ip-finger { left: 80px; top: 91px; }
.is-android[data-step="2"] .ip-finger { left: 122px; top: 40px; }
@keyframes ip-tap-a { 0%, 35% { transform: scale(1); } 42% { transform: scale(.75); } 50%, 100% { transform: scale(1); } }
@keyframes ip-tap-b { 0%, 35% { transform: scale(1); } 42% { transform: scale(.75); } 50%, 100% { transform: scale(1); } }
@keyframes ip-ring-a { 0%, 40% { opacity: 0; transform: scale(1); } 45% { opacity: .9; } 70%, 100% { opacity: 0; transform: scale(2.4); } }
@keyframes ip-ring-b { 0%, 40% { opacity: 0; transform: scale(1); } 45% { opacity: .9; } 70%, 100% { opacity: 0; transform: scale(2.4); } }
@media (max-height: 640px) { .ip-phone { zoom: .78; } }
@media (prefers-reduced-motion: reduce) { .install-modal, .install-modal::backdrop { animation: none; } }
