/* App Náutica — mapa a pantalla completa, navegación inferior, MOB a pantalla completa */
:root {
  --navy: #0B3A66;
  --blue: #1D6FB8;
  --sky: #4FA3E3;
  --ice: #E6F0FA;
  --line: #BFD6EE;
  --ink: #0B1F33;
  --muted: #4E6278;
  --white: #FFFFFF;
  --red: #C62828;
  --amber-bg: #FFF1D6;
  --amber-ink: #6B4200;
  --amber: #E8A400;
  --green: #2E7D32;
  --green-bg: #E3F2E5;
  --mob-bg: #0E1E30;
  --mob-card: #13283F;
  --f-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--f-body); color: var(--ink); background: var(--ice); -webkit-tap-highlight-color: transparent; overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* Vistas */
.view { position: absolute; inset: 0 0 calc(var(--nav-h) + var(--safe-b)) 0; display: none; }
.view.active { display: block; }
#view-clima, #view-guia { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { padding: calc(16px + var(--safe-t)) max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; }
.page-title { margin: 0; font-size: 22px; color: var(--navy); border-bottom: 3px solid var(--blue); padding-bottom: 6px; }

/* Barra superior del mapa */
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 500; background: var(--navy); color: var(--white); padding: calc(10px + var(--safe-t)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: .2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1.5px solid var(--sky); background: transparent; display: grid; place-items: center; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--white); stroke-width: 2; }
.editor-badge { background: var(--amber); color: var(--ink); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: .5px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1.5px solid var(--sky); background: transparent; color: #CFE6FA; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.chip .dot { width: 10px; height: 10px; border-radius: 5px; }
.chip.on { background: var(--sky); color: var(--ink); border-color: var(--sky); }
.alert-banner { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--amber-bg); color: var(--amber-ink); font-size: 13px; font-weight: 600; }
.alert-banner.red { background: #FDE2E2; color: #7A1010; }
.alert-banner button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 18px; line-height: 1; padding: 0 4px; }

/* Mapa */
#map { position: absolute; inset: 0; z-index: 1; background: #CFE3F2; }
.map-disclaimer { position: absolute; left: 8px; bottom: 4px; z-index: 400; margin: 0; font-size: 10px; background: rgba(255,255,255,.85); padding: 2px 6px; border-radius: 4px; color: var(--muted); }
.leaflet-control-attribution { font-size: 9px; }
.poi-icon { width: 30px; height: 30px; border-radius: 15px; border: 2px solid var(--white); display: grid; place-items: center; color: var(--white); font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.35); font-family: var(--f-body); }
.poi-icon.unverified { border-style: dashed; border-color: var(--amber); }
.me-icon { width: 18px; height: 18px; border-radius: 9px; background: #1E88E5; border: 3px solid var(--white); box-shadow: 0 0 0 8px rgba(30,136,229,.22); }
.mob-icon { width: 26px; height: 26px; border-radius: 13px; background: var(--red); border: 3px solid var(--white); box-shadow: 0 0 0 10px rgba(198,40,40,.25); }

.btn-mob { position: absolute; right: max(14px, env(safe-area-inset-right, 0px)); bottom: 28px; z-index: 600; width: 78px; height: 78px; border-radius: 39px; border: 4px solid var(--white); background: var(--red); color: var(--white); font-size: 18px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.btn-mob:active { transform: scale(.96); }

/* Hoja inferior */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 700; background: var(--white); border-radius: 18px 18px 0 0; border-top: 3px solid var(--blue); box-shadow: 0 -4px 16px rgba(0,0,0,.15); padding: 8px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 10px; max-height: 60%; overflow-y: auto; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--blue); align-self: center; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-right: 36px; }
.sheet-title-wrap { min-width: 0; }
.sheet h2 { margin: 0; font-size: 17px; }
.sheet-head p { margin: 2px 0 0; font-size: 13px; }
.sheet-notes { margin: 0; font-size: 14px; color: var(--muted); }
.sheet-notes:empty { display: none; }
.sheet-actions, .sheet-editor { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sheet-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sheet-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 18px; border: 0; background: var(--ice); font-size: 22px; color: var(--navy); }
.tag { flex: none; padding: 3px 8px; border-radius: 6px; background: var(--ice); color: var(--navy); font-size: 11px; font-weight: 700; }
.tag.warn { background: var(--amber-bg); color: var(--amber-ink); }

/* Botones */
.btn { min-height: 44px; border-radius: 10px; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; padding: 0 10px; border: 0; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-outline { background: var(--white); color: var(--navy); border: 1.5px solid var(--blue); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-sm { min-height: 38px; font-size: 13px; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 600; text-decoration: underline; padding: 6px 0; }

/* Editor */
.editor-panel { position: absolute; left: max(10px, env(safe-area-inset-left, 0px)); right: 100px; bottom: 16px; z-index: 650; background: var(--white); border: 2px solid var(--amber); border-radius: 14px; padding: 10px 12px; max-height: 38%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.editor-head { display: flex; justify-content: space-between; align-items: center; }
.editor-hint { margin: 0; font-size: 13px; color: var(--muted); }
.editor-hint.active { color: var(--amber-ink); font-weight: 600; }
.editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pending-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pending-list button { width: 100%; text-align: left; background: var(--ice); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--ink); }
.pending-list button.sel { background: var(--amber-bg); border-color: var(--amber); }
.pending-list small { display: block; color: var(--muted); }
summary { font-size: 13px; font-weight: 600; cursor: pointer; }

/* Formularios (modal) */
.modal { position: fixed; inset: 0; z-index: 2000; background: rgba(11,31,51,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: var(--white); width: 100%; max-width: 520px; max-height: 88%; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(18px + var(--safe-b)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 12px; }
.modal-box h2 { margin: 0; font-size: 18px; color: var(--navy); }
.modal-box p { margin: 0; font-size: 14px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { font: 15px var(--f-body); padding: 10px; border: 1.5px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--white); }
.field textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 20px; height: 20px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-box { width: 100%; min-height: 160px; font: 12px var(--f-mono); }

/* Tarjetas */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card-title { margin: 0; font-size: 15px; color: var(--navy); }
.card p { margin: 0; }
.link-list { display: flex; flex-direction: column; gap: 6px; }
.link-list a { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--blue); border-radius: 10px; color: var(--navy); font-weight: 600; text-decoration: none; font-size: 14px; }
.link-list a::after { content: "↗"; color: var(--blue); }

/* Clima */
.semaforo { border-radius: 16px; padding: 16px; display: flex; gap: 14px; align-items: center; background: var(--white); border: 1px solid var(--line); }
.semaforo .light { width: 56px; height: 56px; border-radius: 28px; flex: none; display: grid; place-items: center; color: var(--white); font-weight: 700; font-size: 26px; }
.semaforo h2 { margin: 0; font-size: 18px; }
.semaforo p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; }
.semaforo.verde { background: var(--green-bg); border-color: #A9D3AE; } .semaforo.verde .light { background: var(--green); }
.semaforo.amarillo { background: var(--amber-bg); border-color: #F0CF8A; color: var(--amber-ink); } .semaforo.amarillo .light { background: var(--amber); }
.semaforo.rojo { background: #FDE2E2; border-color: #F2A9A9; color: #7A1010; } .semaforo.rojo .light { background: var(--red); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--white); border-radius: 12px; border-top: 3px solid var(--blue); padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-family: var(--f-mono); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11px; color: var(--muted); }
.hourly { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.hour { flex: none; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; }
.hour .bar-wrap { height: 70px; width: 18px; display: flex; align-items: flex-end; background: var(--ice); border-radius: 4px; }
.hour .bar { width: 100%; border-radius: 4px; }
.hour .arrow { width: 16px; height: 16px; }
.hour .w { font-family: var(--f-mono); font-weight: 600; }

/* Guía */
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: #CFE1F4; position: sticky; top: 0; z-index: 5; }
.segmented button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--blue); font-weight: 600; font-size: 14px; }
.segmented button.active { background: var(--white); color: var(--navy); font-weight: 700; }
.tab { display: none; flex-direction: column; gap: 12px; }
.tab.active { display: flex; }
.sos { background: var(--red); color: var(--white); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.sos h2 { margin: 0; font-size: 16px; }
.sos p { margin: 0; font-size: 14px; line-height: 1.5; color: #FFE3E3; }
.sos .phone { font-family: var(--f-mono); font-size: 22px; font-weight: 600; color: var(--white); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid #DCE9F6; }
.list-row:first-child { border-top: 0; }
.ch { width: 48px; flex: none; font-family: var(--f-mono); font-size: 21px; font-weight: 600; color: var(--navy); }
.ch.red { color: var(--red); }
.list-row p { margin: 0; font-size: 14px; }
.proc { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.45; }
details.proc-box { border: 1.5px solid var(--blue); border-radius: 10px; padding: 10px 12px; }
details.proc-box summary { font-size: 14px; color: var(--navy); }
details.proc-box[open] summary { margin-bottom: 8px; }
.buoy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.buoy { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--white); }
.buoy svg { width: 76px; height: 110px; }
.buoy strong { font-size: 14px; color: var(--navy); }
.buoy span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.buoy .light-code { font-family: var(--f-mono); font-size: 11px; color: var(--blue); }
.sound-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid #DCE9F6; }
.sound-row:first-child { border-top: 0; }
.sound-row .txt { flex: 1; min-width: 0; font-size: 14px; }
.sound-row .txt small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.blasts { display: flex; gap: 3px; align-items: center; margin-bottom: 2px; }
.blasts i { display: block; height: 8px; border-radius: 4px; background: var(--navy); }
.blasts i.s { width: 10px; } .blasts i.l { width: 34px; } .blasts i.b { width: 10px; height: 10px; border-radius: 5px; background: var(--amber); }
.play { flex: none; width: 44px; height: 44px; border-radius: 22px; border: 1.5px solid var(--blue); background: var(--white); display: grid; place-items: center; }
.play svg { width: 18px; height: 18px; fill: var(--navy); }
.play.playing { background: var(--navy); } .play.playing svg { fill: var(--white); }
.gloss dt { font-weight: 700; color: var(--navy); font-size: 14px; margin-top: 10px; }
.gloss dt:first-child { margin-top: 0; }
.gloss dd { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink); }
.search { font: 15px var(--f-body); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; width: 100%; }
.about { margin-top: 8px; }

/* Navegación inferior */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--white); border-top: 3px solid var(--blue); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bottom-nav button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #5E7FA0; font-size: 11px; font-weight: 500; }
.bottom-nav button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.bottom-nav button.active { color: var(--navy); font-weight: 700; }

/* MOB */
.mob { position: fixed; inset: 0; z-index: 3000; background: var(--mob-bg); color: var(--white); display: flex; flex-direction: column; overflow-y: auto; }
.mob-head { background: var(--red); padding: calc(14px + var(--safe-t)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
.mob-row { display: flex; justify-content: space-between; align-items: center; }
.mob-title { font-size: 21px; letter-spacing: .5px; }
.mob-timer { font-size: 22px; font-weight: 600; }
.mob-pos { margin: 4px 0 0; font-size: 13px; color: #FFE3E3; font-family: var(--f-mono); }
.mob-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #2A3A4C; }
.mob-stats > div { background: var(--mob-bg); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.mob-label { font-size: 12px; color: #A9BBCD; font-weight: 600; letter-spacing: .4px; }
.mob-big { font-size: 38px; font-weight: 600; }
.mob-body { padding: 12px 16px 0; display: flex; flex-direction: column; gap: 10px; }
.mob-man-btns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mob-man-btns button { min-height: 42px; border-radius: 8px; border: 1px solid #3A4C60; background: transparent; color: #D6E2EE; font-size: 12px; font-weight: 500; }
.mob-man-btns button.active { background: var(--sky); color: var(--ink); border-color: var(--sky); font-weight: 700; }
.mob-draw { background: var(--mob-card); border-radius: 14px; }
.mob-draw svg { display: block; width: 100%; height: auto; }
.mob-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #D6E2EE; line-height: 1.4; }
.mob-actions { margin-top: auto; padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(16px + var(--safe-b)) max(16px, env(safe-area-inset-left, 0px)); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mob-call { background: var(--white); color: var(--red); min-height: 54px; font-weight: 700; }
.mob-share { background: var(--green); color: var(--white); min-height: 54px; font-weight: 700; }
.mob-vhf { grid-column: span 2; margin: 0; text-align: center; font-size: 13px; color: #A9BBCD; }
.mob-end { grid-column: span 2; background: transparent; border: 1px solid #3A4C60; color: #D6E2EE; position: relative; overflow: hidden; }
.mob-end .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.18); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 4000; background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90%; text-align: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===== v2: Inicio ===== */
#view-inicio { overflow-y: auto; display: none; flex-direction: column; background: var(--ice); }
#view-inicio.active { display: flex; }
.home-head { background: var(--navy); color: var(--white); padding: calc(14px + var(--safe-t)) max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--sky); }
.home-logo { width: 44px; height: 44px; flex: none; }
.home-ttl { line-height: 1.15; min-width: 0; }
.home-ttl small { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #A9C7E8; font-weight: 600; }
.home-ttl b { display: block; font-size: 21px; letter-spacing: .02em; }
.home-ttl small { margin-top: 2px; }
.home-status { margin-left: auto; flex: none; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 14px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); cursor: pointer; }
.home-status.verde { background: rgba(46,125,50,.4); border-color: #7CCB82; }
.home-status.amarillo { background: rgba(232,164,0,.35); border-color: #F0C040; }
.home-status.rojo { background: rgba(198,40,40,.5); border-color: #F28B8B; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px max(14px, env(safe-area-inset-right, 0px)) 6px max(14px, env(safe-area-inset-left, 0px)); max-width: 820px; width: 100%; margin: 0 auto; }
@media (min-width: 700px) { .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding-top: 26px; } }
.htile { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; padding: 0; text-align: left; color: var(--ink); box-shadow: 0 1px 3px rgba(11,37,69,.08); transition: transform .1s; }
.htile:active { transform: scale(.98); }
.htile .im { height: clamp(70px, 9.5vh, 130px); display: flex; align-items: center; justify-content: center; }
.htile .im svg { height: 80%; width: auto; max-width: 85%; }
.htile .tx { padding: 9px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.htile b { font-size: 15px; color: var(--navy); }
.htile .tx span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.htile.danger { border-color: #F2A9A9; } .htile.danger b { color: var(--red); }
.home-foot { margin-top: auto; text-align: center; padding: 18px max(18px, env(safe-area-inset-right, 0px)) 22px max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.home-foot .l1 { margin: 0; font-weight: 700; font-size: 14px; color: var(--navy); }
.home-foot .l2 { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; max-width: 340px; }

/* ===== v2: Mapa · encabezado y capas ===== */
.topbar-row { justify-content: flex-start; }
.topbar h1 { font-size: 17px; }
.icon-btn.sq { border-radius: 10px; border-color: rgba(255,255,255,.3); }
.layers-btn { margin-left: auto; height: 44px; padding: 0 12px; border-radius: 22px; border: 0; background: var(--sky); color: var(--ink); font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.layers-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2; }
.layers-btn .chev { width: 14px; height: 14px; stroke-width: 2.5; transition: transform .15s; }
.layers-btn.open .chev { transform: rotate(180deg); }
.layers-panel { position: absolute; z-index: 800; right: max(10px, env(safe-area-inset-right, 0px)); top: calc(76px + var(--safe-t)); width: min(290px, calc(100% - 20px)); max-height: calc(100% - 120px); overflow-y: auto; background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(11,31,51,.25); padding: 8px 12px 10px; }
.lgroup { margin: 8px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lrow { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.ldot { width: 20px; height: 20px; border-radius: 10px; flex: none; }
.ldot.ring { border: 3px solid #1A1A1A; box-sizing: border-box; }
.lnote { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.sw { appearance: none; -webkit-appearance: none; margin-left: auto; width: 44px; height: 26px; border-radius: 13px; background: #C8D6E3; position: relative; cursor: pointer; flex: none; transition: background .15s; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 10px; background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.sw:checked { background: var(--blue); }
.sw:checked::after { left: 21px; }
.sw:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ===== v2: ficha de boyas ===== */
.sea-head { display: flex; gap: 14px; align-items: center; padding-right: 36px; }
.sea-img { width: 64px; height: 84px; border-radius: 12px; background: var(--ice); flex: none; display: grid; place-items: center; }
.sea-img svg { width: 50px; height: 76px; }
.sea-kind { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--blue); }
.sea-what { background: var(--ice); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.45; }
.sea-what p { margin: 0; }
.sea-what .sw-t { color: var(--navy); }
.sea-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.sea-facts div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sea-facts span { font-size: 11px; color: var(--muted); }
.sea-facts b { font-size: 14px; overflow-wrap: anywhere; }
.map-loading { position: absolute; z-index: 750; left: 50%; transform: translateX(-50%); bottom: 24px; background: var(--ink); color: var(--white); font-size: 13px; padding: 8px 14px; border-radius: 18px; }

/* ===== v3: costeras ===== */
.costeras { display: flex; flex-direction: column; }
.cst { padding: 10px 0; border-top: 1px solid #DCE9F6; display: flex; flex-direction: column; gap: 6px; }
.cst:first-child { border-top: 0; }
.cst.dep { background: var(--ice); margin: 0 -14px; padding: 10px 14px; border-top-color: transparent; }
.cst-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cst-h b { font-size: 15px; }
.cst-cs { font-size: 12px; color: var(--muted); }
.hor { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.hor.h24 { background: var(--green-bg); color: var(--green); }
.hor.hx { background: var(--amber-bg); color: var(--amber-ink); }
.chs { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-ch { font-family: var(--f-mono); font-weight: 600; font-size: 15px; color: var(--navy); border: 1.5px solid var(--line); border-radius: 8px; padding: 3px 9px; display: inline-flex; align-items: baseline; gap: 5px; }
.chip-ch small { font-family: var(--f-body); font-size: 11px; font-weight: 500; color: var(--muted); }
.chip-ch.red { color: var(--red); border-color: #F2A9A9; }
.cst-n { margin: 0; font-size: 13px; color: var(--blue); font-weight: 600; }

/* ===== v3: río y alertas ===== */
.home-status.naranja { background: rgba(232,89,12,.45); border-color: #F5A06B; }
.rio-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rio-top p { margin: 2px 0 0; }
.rio-now { text-align: right; flex: none; display: flex; flex-direction: column; }
.rio-now .mono { font-size: 28px; font-weight: 600; color: var(--navy); line-height: 1.1; }
.rio-now small { font-size: 12px; color: var(--muted); }
.warn-t { color: var(--amber-ink); }
.rio-chart { width: 100%; height: auto; display: block; }
.rio-chart .grid { stroke: var(--line); stroke-width: 1; }
.rio-chart .ax { font: 10px var(--f-body); fill: var(--muted); }
.rio-chart .area { fill: rgba(29,111,184,.14); }
.rio-chart .ln { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; }
.rio-chart .fut { fill: none; stroke: var(--blue); stroke-width: 2; stroke-dasharray: 5 4; }
.rio-chart .fpt { fill: var(--white); stroke: var(--blue); stroke-width: 2; }
.rio-chart .now { fill: var(--navy); stroke: var(--white); stroke-width: 2; }
.rio-prox { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.rio-prox > div { background: var(--ice); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.rio-prox span { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--blue); }
.rio-prox .bajamar span { color: var(--amber-ink); }
.rio-prox b { font-size: 18px; }
.rio-prox small { font-size: 12px; color: var(--muted); }
.rio-txt { font-size: 14px; }
.rio-txt summary { color: var(--navy); }
.rio-txt p { margin: 6px 0 0; line-height: 1.45; }
.rio-otras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.rio-otras div { display: flex; flex-direction: column; min-width: 0; }
.rio-otras span { font-size: 11px; color: var(--muted); }
.rio-otras b { font-size: 14px; }
.shn-aviso { background: #FDE2E2; color: #7A1010; border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: 14px; }
#smn-alertas { display: flex; flex-direction: column; gap: 8px; }
#smn-alertas p { margin: 0; }
.smn-ok { background: var(--green-bg); color: var(--green); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.smn-al { border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; border: 1px solid; font-size: 14px; line-height: 1.45; }
.smn-al.amarillo { background: #FFF6D6; border-color: #F0CF8A; color: #5C4300; }
.smn-al.naranja { background: #FFE6D5; border-color: #F5A06B; color: #6B2A00; }
.smn-al.rojo { background: #FDE2E2; border-color: #F2A9A9; color: #7A1010; }
.smn-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.smn-h b { font-size: 16px; }
.smn-lvl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.08); }
.smn-when { font-size: 12.5px; font-weight: 600; }
.smn-al summary { font-weight: 600; cursor: pointer; }

.sea-guide { grid-column: span 2; }

/* ===== v4: ingreso ===== */
body.bloqueado { overflow: hidden; }
.ingreso { position: fixed; inset: 0; z-index: 2500; background: var(--navy); color: var(--white); overflow-y: auto; display: flex; flex-direction: column;
  padding: calc(20px + var(--safe-t)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + var(--safe-b)) max(16px, env(safe-area-inset-left, 0px)); gap: 16px; }
.in-top { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding-top: 8px; }
.in-logo { width: 60px; height: 60px; }
.in-nombre { font-size: 24px; }
.in-top small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #A9C7E8; font-weight: 600; }
.in-card { background: var(--white); color: var(--ink); border-radius: 16px; padding: 18px; max-width: 440px; width: 100%; margin: 0 auto; }
.in-paso { display: flex; flex-direction: column; gap: 12px; }
.in-paso h2 { margin: 0; font-size: 18px; color: var(--navy); }
.in-paso p { margin: 0; }
.in-cod { font-family: var(--f-mono) !important; font-size: 26px !important; letter-spacing: .4em; text-align: center; }
.in-links { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.in-error { margin: 0 0 12px; background: #FDE2E2; color: #7A1010; border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; }
.in-equipos { display: flex; flex-direction: column; gap: 8px; }
.in-eq { flex-direction: column; align-items: flex-start; padding: 10px 12px; }
.in-eq small { font-weight: 400; color: var(--muted); font-size: 12px; }
.in-sos { margin-top: auto; max-width: 440px; width: 100%; margin-left: auto; margin-right: auto; display: flex; flex-direction: column; gap: 8px; }
.in-sos p { margin: 0; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: #A9C7E8; }
.in-sos .in-vhf { font-weight: 400; letter-spacing: 0; }
.in-sos-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.in-mob { min-height: 64px; background: var(--red); color: var(--white); border: 3px solid var(--white); border-radius: 14px; font-size: 17px; font-weight: 700; }
.in-106 { min-height: 64px; background: var(--white); color: var(--red); border-radius: 14px; font-size: 17px; font-weight: 700; }
button[aria-busy="true"] { opacity: .6; }
.home-links { display: flex; gap: 16px; justify-content: center; }
.cta-eq { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ===== v5 · Antes de zarpar ===== */
.home-check-wrap { padding: 14px max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px)); max-width: 820px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.home-check { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 0; border-radius: 14px; background: var(--navy); color: var(--white); text-align: left; box-shadow: 0 2px 6px rgba(11,58,102,.25); font-family: inherit; }
.home-check:active { transform: scale(.99); }
.hc-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--sky); display: flex; align-items: center; justify-content: center; flex: none; }
.hc-ic svg { width: 24px; height: 24px; }
.hc-tx { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hc-tx b { font-size: 15.5px; } .hc-tx small { font-size: 12px; color: #A9C7E8; }
.hc-bar { width: 56px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); overflow: hidden; flex: none; }
.hc-bar span { display: block; height: 100%; width: 0; background: #7BD389; }
.hc-go { font-size: 22px; color: #A9C7E8; }
.home-check-wrap + .home-grid { padding-top: 12px; }

#view-check { overflow-y: auto; background: var(--ice); }
#view-check.active { display: flex; flex-direction: column; }
.chk-head { background: var(--navy); color: var(--white); padding: calc(12px + var(--safe-t)) 16px 12px; border-bottom: 3px solid var(--sky); position: sticky; top: 0; z-index: 5; }
.chk-row { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto; }
.chk-row b { font-size: 18px; }
.chk-back { background: none; border: 0; color: #A9C7E8; font-size: 28px; line-height: 1; padding: 0 6px 0 0; }
.chk-prog { margin-left: auto; font-size: 12.5px; color: #A9C7E8; font-family: var(--f-mono); }
.chk-pbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); margin: 10px auto 0; overflow: hidden; max-width: 640px; }
.chk-pbar span { display: block; height: 100%; width: 0; background: #7BD389; transition: width .2s; }
.chk-tipo { display: flex; gap: 6px; margin: 10px auto 0; max-width: 640px; }
.chk-tipo button { flex: 1; padding: 7px 0; border-radius: 10px; border: 1px solid var(--sky); background: none; color: #A9C7E8; font: 500 13px var(--f-body); }
.chk-tipo button.on { background: var(--white); color: var(--navy); font-weight: 700; border-color: var(--white); }
.chk-body { flex: 1; padding: 12px 14px 4px; max-width: 640px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.chk-sec { background: var(--white); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.chk-sh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; font-size: 14px; color: var(--navy); }
.chk-sh span { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.chk-it { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-top: 1px solid #E3EDF7; cursor: pointer; }
.chk-tx { flex: 1; font-size: 13.5px; line-height: 1.3; color: var(--ink); }
.chk-tx small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.chk-it.ok .chk-tx { color: var(--muted); }
.chk-ref { background: #F4F8FC; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; margin-top: 6px !important; color: #33414F !important; }
.chk-bx { width: 22px; height: 22px; border-radius: 5px; border: 2px solid #7A93AD; background: var(--white); flex: none; padding: 0; position: relative; }
.chk-it.ok .chk-bx { background: var(--blue); border-color: var(--blue); }
.chk-it.ok .chk-bx::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.chk-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; }
.chk-tg { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 8px; white-space: nowrap; margin-top: 1px; }
.chk-tg.ob { background: var(--navy); color: var(--white); } .chk-tg.re { background: #E3EEF8; color: var(--navy); }
.chk-i { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #7A93AD; background: var(--white); color: var(--muted); font: italic 700 11px var(--f-body); flex: none; padding: 0; }
.chk-i.on { background: var(--navy); color: var(--white); border-color: var(--navy); }
.chk-nota { margin: 4px 2px 8px; }
.chk-acc { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 14px 12px; background: var(--white); border-top: 1px solid var(--line); }
.chk-acc .btn-primary { flex: 1; background: var(--blue); }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.fld input { font: 400 15px var(--f-body); padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }

/* ===== v6 · aportes de usuarios ===== */
.sheet-conf { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 10px; background: var(--green-bg); color: #1B5E20; font-size: 13px; font-weight: 600; }
.sheet-conf.poca { background: var(--ice); color: var(--navy); }
.sheet-aporte { display: flex; align-items: center; gap: 8px; border-top: 1px solid #E3EDF7; padding-top: 10px; flex-wrap: wrap; }
.sheet-aporte span { flex: 1; min-width: 140px; font-size: 13px; color: var(--muted); }
.ap-btn { height: 36px; padding: 0 12px; border-radius: 18px; background: var(--white); font: 600 13px var(--f-body); }
.ap-btn.ok { border: 1.5px solid var(--green); color: var(--green); } .ap-btn.ok:disabled { background: var(--green-bg); opacity: 1; }
.ap-btn.err { border: 1.5px solid var(--red); color: var(--red); }
.ap-op { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink); }
.ap-op.on { border-color: var(--blue); background: var(--ice); }
.ap-sub { margin: -4px 0 0 18px; padding: 10px; border-radius: 10px; background: #F4F8FC; display: flex; flex-direction: column; gap: 8px; }
.fld textarea { font: 400 15px var(--f-body); padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); resize: vertical; }
.pick-hint { position: absolute; left: 12px; right: 12px; bottom: 16px; z-index: 750; background: var(--navy); color: var(--white); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.25); font-weight: 600; }
.pick-hint span { flex: 1; } .pick-hint .link-btn { color: #A9C7E8; }

/* ===== v6 · suscripción ===== */
.in-planes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.in-plan { border: 2px solid var(--line); border-radius: 12px; padding: 12px 10px; background: var(--white); text-align: left; display: flex; flex-direction: column; gap: 2px; color: var(--ink); font-family: inherit; position: relative; }
.in-plan b { font-size: 14px; color: var(--navy); } .in-plan .pr { font: 700 20px var(--f-body); color: var(--ink); } .in-plan small { font-size: 11.5px; color: var(--muted); }
.in-plan.on { border-color: var(--blue); background: var(--ice); }
.in-plan .ah { position: absolute; top: -9px; right: 8px; background: var(--green); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.in-pagar { display: flex; flex-direction: column; gap: 10px; }
.check a { color: var(--blue); }
.cta-plan { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--ice); }
.cta-plan b { color: var(--navy); }
.home-legal { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.home-legal a, .home-legal button { font-size: 12px; color: var(--muted); }
.in-legal { padding: 4px 16px 18px; } .in-legal a, .in-legal button { color: #A9C7E8; }
.fondo-sel { margin-bottom: 4px; } .fondo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fondo-btns button { min-height: 38px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--white); color: var(--navy); font-weight: 600; font-size: 14px; }
.fondo-btns button.on { border-color: var(--blue); background: var(--ice); }
#modal-body { display: flex; flex-direction: column; gap: 10px; } #modal-body .link-btn { align-self: center; }
.chk-barco { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 640px; margin: 8px auto 0; padding: 6px 10px; border-radius: 9px; border: 1px dashed rgba(169,199,232,.6); background: none; color: #D6E6F6; font: 500 12.5px var(--f-body); text-align: left; }
.chk-barco span { flex: 1; } .chk-barco b { color: var(--white); font-size: 12px; text-decoration: underline; }
