/* SOS24 0.4 – zakładki, rodzina, rozmowy, bezpieczeństwo. */
:root { --nav: 68px; --abar: 0px; }
/* ---------- dolne menu ---------- */
.bnav {
  position: fixed; z-index: 700; left: 0; right: 0; bottom: 0; height: calc(var(--nav) + var(--safe-b)); padding: 0 4px var(--safe-b);
  display: grid; grid-template-columns: 1fr 1fr 1fr 1.4fr 1fr; align-items: center; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(16, 24, 40, .08);
}
.bnav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; height: 60px; padding: 0 2px; border: 0; border-radius: 16px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.bnav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bnav button i { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; }
.bnav button[aria-current="page"] { color: var(--brand); font-weight: 800; }
.bnav button[aria-current="page"] i { background: color-mix(in srgb, var(--brand) 16%, transparent); }
.bnav__main i { width: 56px !important; height: 56px !important; margin-top: -30px; background: var(--brand) !important; color: var(--brand-ink); box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 45%, transparent); }
.bnav__main { color: var(--text) !important; font-weight: 700 !important; }
.bnav__n, .cbadge { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 800; }
.bnav__n { position: absolute; top: 0; left: calc(50% + 10px); border: 2px solid var(--card); }
.btn112 { bottom: calc(var(--nav) + 22px + var(--safe-b)); }
.fab-small { bottom: calc(var(--nav) + 22px + var(--safe-b)); }
.fab { bottom: calc(var(--nav) + 22px + var(--safe-b)); }
.sendbar { bottom: calc(var(--nav) + 18px + var(--safe-b)); }
.fnote { bottom: calc(var(--nav) + 90px + var(--safe-b)) !important; }
.leaflet-bottom { bottom: calc(var(--nav) + var(--safe-b)); }
.topbar { top: calc(10px + var(--safe-t) + var(--abar)); }
.hint { top: calc(66px + var(--safe-t) + var(--abar)); }
body:not([data-tab="map"]) :is(.topbar, .btn112, .fab-small, .hint) { display: none; }
body.is-offline::after { content: "Brak połączenia – próbuję ponownie"; position: fixed; z-index: 690; left: 0; right: 0; bottom: calc(var(--nav) + var(--safe-b)); padding: 5px 10px; background: #7f1d1d; color: #fff; font-size: 13px; font-weight: 600; text-align: center; }

svg { display: block; }
.toasts { top: auto; bottom: calc(var(--nav) + 96px + var(--safe-b)); }
.toasts--top { top: calc(64px + var(--safe-t)); bottom: auto; }
.toasts .toast--click { pointer-events: auto; }
.toasts .toast:nth-last-child(n + 3) { display: none; }
.list > *, .stack > * { min-width: 0; }
.stack > p { margin: 0; }
.item > div:not(.end) { flex: 1; }
.item small { max-width: 100%; }
.sheet .vcard { width: 100%; margin: 0; }
.ev-desc + .note, .note--box + .btn { margin-top: 8px; }
.btn--violet { background: #7c3aed; color: #fff; }
.view > .fstate { margin-bottom: 14px; }
.view > .btn--ghost, .view > .row .btn--ghost, .view > .stack > .btn--ghost, .view > .list > .item, .view > .stack > .list > .item { background: var(--card); box-shadow: 0 2px 10px rgba(16, 24, 40, .06); }
.view form.row input { flex: 2; }
@media (max-width: 380px) { .bnav button { font-size: 11px; } }

/* ---------- pasek trwającego alarmu ---------- */
.abars { position: fixed; z-index: 1400; top: var(--safe-t); left: 0; right: 0; display: grid; }
.abar { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 8px 14px; border: 0; background: #6d28d9; color: #fff; font-size: 15px; font-weight: 700; text-align: left; animation: abar 1.6s ease-in-out infinite; }
.abar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abar b { margin-left: auto; flex: none; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .22); font-size: 14px; }
.abar--bad { background: #b91c1c; }
.abar--wait { background: #475569; animation: none; }
.abar--mine { background: #4c1d95; animation: none; }
@keyframes abar { 50% { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .abar { animation: none; } }
.pad, .family-alert { padding-top: calc(14px + var(--safe-t) + var(--abar)) !important; }
.family-alert { z-index: 1390; }

/* ---------- widoki ---------- */
.view { position: fixed; z-index: 600; inset: 0; padding: calc(18px + var(--safe-t) + var(--abar)) 16px calc(var(--nav) + 28px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; background: var(--bg); }
.view > * { max-width: 720px; margin-inline: auto; }
.view h1 { margin: 0 auto 14px; font-size: 28px; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.view h3 { margin: 20px auto 10px; font-size: 16px; }
.view > .btn, .view > .list, .view > .note, .view > .stack, .view > .row, .view > .squick, .view > .stiles { margin-bottom: 12px; }
.view .btn { text-decoration: none; }
.vcard { display: grid; gap: 10px; margin: 0 auto 14px; padding: 16px; border-radius: 20px; background: var(--card); box-shadow: 0 2px 10px rgba(16, 24, 40, .06); }
.vcard > h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; color: var(--text); }
.vcard p { margin: 0; overflow-wrap: anywhere; }
.sheet .vcard { background: var(--card-2); box-shadow: none; }
.vcard .item, .vcard .fambox, .vcard .gcheck { background: var(--card-2); }
.vcard .btn--ghost { background: var(--card-2); }
details.vcard { gap: 8px; }
details.vcard summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
details.vcard[open] summary { margin-bottom: 8px; }
.vcard--now { border-left: 6px solid var(--ok); }
.vcard--dont { border-left: 6px solid var(--danger); }
.vback { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0 0 8px; padding: 0 16px 0 10px; border: 0; border-radius: 999px; background: var(--card); font-weight: 700; box-shadow: 0 2px 10px rgba(16, 24, 40, .08); }
.prow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.prow > span, .prow > b { overflow-wrap: anywhere; min-width: 0; }
.muted { color: var(--muted); }
.wrap { white-space: normal !important; overflow-wrap: anywhere; }
.inline { display: inline !important; }
.row .btn { width: auto; min-width: 0; padding: 0 10px; }
a.btn { text-decoration: none; }
.btn--dark { background: #1f3a5f; color: #fff; }
.btn--sos { min-height: 84px; margin: 0 auto 14px; background: #7c3aed; color: #fff; font-size: 21px; border-radius: 24px; }
.fstate--warn { background: color-mix(in srgb, var(--warn) 18%, var(--card)); color: var(--text); }
.fambox { display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px; background: var(--card-2); }
.citem .end { display: grid; justify-items: end; gap: 4px; }
.item > div:not(.end) { min-width: 0; }
.item b, .item small { overflow-wrap: anywhere; }
.statuses { display: flex; flex-wrap: wrap; gap: 8px; }
.schip { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border: 2px solid var(--line); border-radius: 999px; background: none; font-weight: 600; font-size: 15px; }
.schip span { color: var(--c); display: grid; }
.schip--on { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--card)); }
.codebox b { overflow-wrap: anywhere; text-align: center; }
input[type="date"] { padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
.fbtn small { color: #fff; }
.fcalls__row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.fcalls__row .btn--ghost { width: auto; background: var(--card); }
@media (min-width: 1000px) { .view { padding-left: 24px; padding-right: 24px; } .view > * { max-width: 860px; } .sheet { bottom: calc(var(--nav) + 20px); max-height: calc(100dvh - 200px); } }

/* ---------- ekran alarmu u odbiorcy ---------- */
.falarm { padding-bottom: 20px; }
.falarm > i { width: 92px; height: 92px; }
.falarm > i.calm { animation: none; opacity: .8; }
.falarm__back { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 10px; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .28); color: #fff; font-weight: 700; }
.falarm__steps { list-style: none; width: 100%; margin: 4px 0; padding: 12px 16px; display: grid; gap: 8px; border-radius: 18px; background: rgba(0, 0, 0, .24); text-align: left; }
.falarm__steps li { display: flex; gap: 10px; align-items: flex-start; opacity: .75; font-size: 15px; }
.falarm__steps li.on { opacity: 1; font-weight: 600; }
.falarm__steps i { flex: none; margin-top: 1px; }
.falarm__steps small { font-weight: 400; opacity: .9; }
.falarm .row { width: 100%; }
.kid-pin--old { opacity: .55; border-style: dashed; }

/* ---------- rozmowy ---------- */
.chat { position: fixed; z-index: 1450; inset: 0; display: flex; flex-direction: column; background: var(--bg); padding-top: var(--safe-t); }
.chead { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.chead .iconbtn { box-shadow: none; background: var(--card-2); color: var(--text); text-decoration: none; }
.chead__t { min-width: 0; margin-right: auto; }
.chead__t b, .chead__t small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chead__t b { font-size: 18px; }
.chead__t small { color: var(--muted); font-size: 13px; }
.cnote { margin: 0; padding: 6px 14px; background: color-mix(in srgb, var(--warn) 16%, var(--card)); font-size: 14px; }
.cmsgs { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.cmsgs > :first-child { margin-top: auto; }
.cday { align-self: center; margin: 10px 0 4px; padding: 3px 12px; border-radius: 999px; background: var(--card-2); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.cmsg { align-self: flex-start; max-width: min(82%, 560px); display: grid; gap: 3px; padding: 9px 13px; border-radius: 18px 18px 18px 5px; background: var(--card); box-shadow: 0 1px 4px rgba(16, 24, 40, .08); }
.cmsg > span { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.cmsg--me { align-self: flex-end; border-radius: 18px 18px 5px 18px; background: color-mix(in srgb, var(--brand) 18%, var(--card)); }
.cmsg--wait { opacity: .75; }
.cmsg--alert { border-left: 5px solid #7c3aed; }
.cwho { color: var(--brand); font-weight: 700; }
.cmeta { color: var(--muted); font-size: 12px; justify-self: end; }
.cmeta--bad { color: var(--danger); font-weight: 700; }
.calert, .cplace, .cvoice { display: grid; gap: 4px; justify-items: start; }
.cvoice audio { width: min(64vw, 280px); height: 42px; }
.cmore { align-self: center; padding: 8px; }
.cquick { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; }
.cq { flex: none; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 600; font-size: 14.5px; max-width: 78vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbar { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(10px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); }
.cbar textarea { flex: 1; min-height: 46px; max-height: 140px; padding: 11px 14px; border-radius: 22px; resize: none; }
.cbar .iconbtn { box-shadow: none; background: var(--card-2); width: 46px; height: 46px; }
.cbar .iconbtn--send { background: var(--brand); color: var(--brand-ink); }
.cbar .rec { background: var(--danger); color: #fff; animation: pulse 1s infinite; }

/* ---------- bezpieczeństwo ---------- */
.squick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.squick .btn { min-height: 68px; padding: 0 10px; line-height: 1.2; }
.stiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.stile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 118px; padding: 16px; border: 0; border-radius: 20px; background: var(--card); box-shadow: 0 2px 10px rgba(16, 24, 40, .06); text-align: left; font-size: 16px; line-height: 1.25; }
.stile i { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--c); color: #fff; }
.stile small { color: var(--muted); }
.ghead { display: flex; align-items: center; gap: 16px; margin: 0 auto 14px; padding: 20px; border-radius: 24px; background: var(--c); color: #fff; }
.ghead i { display: grid; place-items: center; width: 64px; height: 64px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .2); }
.ghead h1 { margin: 0 0 4px; font-size: 24px; }
.ghead p { margin: 0; font-size: 15px; opacity: .95; }
.gnow { margin: 0; padding: 0; list-style: none; counter-reset: n; display: grid; gap: 12px; }
.gnow li { position: relative; padding-left: 46px; min-height: 34px; font-size: 18px; line-height: 1.35; font-weight: 600; counter-increment: n; }
.gnow li::before { content: counter(n); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ok); color: #fff; font-weight: 800; }
.brow { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.brow:last-child { border-bottom: 0; }
.brow .check { font-size: 16px; }
.brow--on .check span { color: var(--muted); text-decoration: line-through; }
.brow--on .check small { text-decoration: none; }
.bexp { display: flex; align-items: center; gap: 8px; margin-left: 32px; font-size: 13.5px; color: var(--muted); }
.bwarn { margin-left: 32px; color: var(--danger); font-weight: 700; }
.ptabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 auto 12px; padding-bottom: 2px; }
.ptab { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--card); font-weight: 700; }
.ptab[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.ptab small { opacity: .8; font-weight: 600; }
.wcard { border-left: 6px solid var(--c); }
.wcard summary small { display: block; margin-top: 4px; color: var(--muted); font-weight: 500; }
.lchip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--c); color: #fff; font-size: 13px; font-weight: 700; }
.srow { display: flex; gap: 12px; align-items: flex-start; }
.srow > i { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; color: #fff; background: #64748b; }
.srow > i.ok { background: var(--ok); }
.srow > i.bad { background: var(--danger); }
.srow b, .srow small { display: block; }
.srow small { color: var(--muted); }
.spin { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #1f3a5f; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.scluster { display: flex; align-items: center; justify-content: center; gap: 5px; height: 34px; border-radius: 12px; background: #1f3a5f; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); font-size: 14px; }
.ecluster { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--c); color: #fff; border: 4px solid var(--card); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); font-size: 18px; font-weight: 800; }
.ecluster b { line-height: 1; }

/* ---------- zamazywanie zdjęcia ---------- */
.blur { display: grid; gap: 8px; }
.blur canvas { width: 100%; max-height: 52dvh; object-fit: contain; border-radius: 14px; background: #000; touch-action: none; cursor: crosshair; }

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .cmsg--me, .schip--on, .cnote, .fstate--warn { background: var(--card-2); }
}
