* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.4 system-ui, sans-serif; background: #f6f6f4; color: #222; max-width: 640px; margin-inline: auto; }
header#top { display: flex; justify-content: space-between; padding: .6rem .8rem; background: #2b2b2b; color: #fff; }
.view, .tab { padding: .8rem; }
label { display: block; margin: .5rem 0; }
input, select, textarea, button { font: inherit; padding: .5rem; border: 1px solid #bbb; border-radius: 6px; }
input, select, textarea { width: 100%; background: #fff; }
button { background: #fff; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; width: auto; }
.small { font-size: .85rem; color: #666; }
.warn { background: #fff3cd; border: 1px solid #e0c46c; padding: .5rem; border-radius: 6px; }
nav#tabs { display: flex; }
nav#tabs button { flex: 1; border-radius: 0; border-width: 0 0 3px; }
nav#tabs button.on { border-color: #2b2b2b; font-weight: 600; }
#contacts { list-style: none; padding: 0; }
#contacts li { background: #fff; border-radius: 8px; padding: .6rem; margin: .5rem 0; }
#contacts .name { font-weight: 600; cursor: pointer; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: #bbb; margin-right: .3rem; }
.dot.on { background: #2a2; }
.mod-badge { background: #666; color: #fff; border-radius: 1rem; padding: 0 .45rem; font-size: .8rem; }
.mod-badge.urgent { background: #c33; font-weight: 700; }
.badge { background: #c33; color: #fff; border-radius: 1rem; padding: 0 .45rem; font-size: .8rem; }
#chat-head { display: flex; gap: .6rem; align-items: center; }
#msgs { list-style: none; padding: 0; min-height: 40vh; }
#msgs li { max-width: 80%; margin: .35rem 0; padding: .45rem .6rem; border-radius: 10px; background: #fff; word-wrap: break-word; }
#msgs li.out { margin-left: auto; background: #dcf2d6; }
#msgs li img { max-width: 100%; display: block; border-radius: 6px; }
#msgs .st { display: block; font-size: .75rem; color: #666; }
#msgs-new { position: fixed; bottom: 4.4rem; left: 50%; transform: translateX(-50%); background: #2b6be0; color: #fff; border: 0; border-radius: 1.4rem; padding: .5rem 1rem; font-size: .9rem; box-shadow: 0 2px 10px rgba(0,0,0,.25); z-index: 6; }
#composer #text { flex: 1; }
#file-btn { margin: 0; cursor: pointer; font-size: 1.3rem; }
#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: .5rem .9rem; border-radius: 6px; }
label.btn { display: inline-block; width: auto; padding: .5rem .8rem; border: 1px solid #bbb; border-radius: 6px; background: #fff; cursor: pointer; }
ul.plain { list-style: none; padding: 0; }
#pub-photo, .person-photo { display: block; max-width: 100%; max-height: 60vh; border-radius: 10px; margin: .4rem 0; }
#browse-list { list-style: none; padding: 0; }
.card { background: #fff; border-radius: 10px; padding: .6rem; margin: .6rem 0; }
.card-top { display: flex; gap: .6rem; cursor: pointer; }
.thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; }
.thumb.none { background: #ddd; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #777; }
.card-body { min-width: 0; }
.card .intro { margin: .25rem 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.card .row { margin-top: .5rem; }
.active-badge { font-size: .75rem; padding: 0 .45rem; border-radius: 1rem; background: #ddd; color: #555; }
.active-badge.on { background: #2a2; color: #fff; }
.person-intro { white-space: pre-wrap; overflow-wrap: anywhere; }
.report-form { margin-top: .4rem; flex-wrap: wrap; }
.report-form .report-evidence { flex-basis: 100%; font-size: .85rem; }
.pimgs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.pimg { position: relative; }
.pimg img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; }
.pimg-del { position: absolute; top: 2px; right: 2px; padding: 0 .35rem; font-size: .8rem; }
.private-label { background: #eef3ff; border-radius: 6px; padding: .4rem; }
#pf-bar { position: sticky; bottom: 0; display: flex; gap: .6rem; align-items: center; justify-content: flex-end; padding: .6rem 0; background: #f6f6f4; border-top: 1px solid #ddd; margin-top: .8rem; }
#pf-save.dirty { background: #2b6be0; border-color: #2b6be0; color: #fff; font-weight: 600; }
#pf-state.dirty { color: #a55a00; font-weight: 600; }
.like { min-width: 2.6rem; }
.like.on { color: #d0234a; border-color: #d0234a; }
.like.matched { background: #ffe3ea; }
#matches { list-style: none; padding: 0; }
#matches li { display: flex; gap: .6rem; align-items: center; background: #fff; border-radius: 8px; padding: .5rem; margin: .4rem 0; }
#matches .thumb { width: 48px; height: 48px; }
#matches .name { font-weight: 600; cursor: pointer; flex: 1; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal { background: #fff; border-radius: 10px; padding: 1rem; max-width: 22rem; width: calc(100% - 2rem); box-shadow: 0 6px 30px rgba(0,0,0,.3); }
.modal h3 { margin: 0 0 .4rem; }
.modal .row { justify-content: flex-end; margin-top: .8rem; }
.modal button.primary { background: #2b6be0; border-color: #2b6be0; color: #fff; }
#chat-head > div { flex: 1; }
#chat-menu { position: relative; }
#chat-menu summary { list-style: none; cursor: pointer; font-size: 1.4rem; padding: 0 .5rem; }
#chat-menu .menu { position: absolute; right: 0; z-index: 5; background: #fff; border: 1px solid #bbb; border-radius: 8px; padding: .3rem; display: flex; flex-direction: column; gap: .3rem; min-width: 14rem; }
.media { position: relative; display: inline-block; max-width: 100%; }
.media.hid img { filter: blur(24px) brightness(.35); }
.media .reveal { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; border: 0; color: #fff; font-size: 1rem; }
.media .reveal span { display: block; font-size: 2rem; }
.mact { display: flex; gap: .3rem; margin-top: .25rem; flex-wrap: wrap; }
.mact button { padding: .15rem .45rem; font-size: .8rem; }
.saved-tag { font-size: .75rem; background: #e6f3e6; color: #276227; border-radius: 1rem; padding: 0 .45rem; }
#media-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
#media-grid li { background: #fff; border-radius: 8px; padding: .4rem; font-size: .8rem; position: relative; }
#media-grid li.sel { outline: 3px solid #2b6be0; }
#media-grid .tile { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: flex; align-items: center; justify-content: center; background: #eee; font-size: 2rem; }
#media-grid .pick { position: absolute; top: .6rem; left: .6rem; width: auto; transform: scale(1.4); }
#media-grid .meta { overflow-wrap: anywhere; color: #555; }
#storage-chats li { display: flex; justify-content: space-between; align-items: center; background: #fff; border-radius: 8px; padding: .4rem .6rem; margin: .3rem 0; }
.media-notice { white-space: pre-wrap; }
.media:not(.hid) img, #media-grid li img.tile, #browse-list .card-top img.thumb, .person-photo, .pimg img { cursor: zoom-in; }

.lb-back { position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; touch-action: none; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.lb-img { max-width: 100%; max-height: 100%; touch-action: none; user-select: none; transform-origin: center center; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: .6rem; z-index: 2; }
.lb-count { font-size: .9rem; color: #fff; background: rgba(0,0,0,.4); padding: .1rem .6rem; border-radius: 1rem; }
.lb-close { background: rgba(0,0,0,.4); color: #fff; border: 0; border-radius: 50%; width: 2.2rem; height: 2.2rem; font-size: 1.1rem; }
.lb-bar { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: .6rem; padding: .8rem; z-index: 2; }
.lb-bar button { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 1.4rem; padding: .5rem 1rem; font-size: 1rem; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.35); color: #fff; border: 0; width: 2.4rem; height: 2.4rem; border-radius: 50%; font-size: 1.3rem; z-index: 2; }
.lb-prev { left: .5rem; }
.lb-next { right: .5rem; }
@media (prefers-reduced-motion: reduce) { .lb-img, .lb-stage { transition: none !important; } }
.unread { background: #5b3fa8; color: #fff; border-radius: 1rem; padding: 0 .45rem; font-size: .8rem; margin-left: .3rem; }
.top-right { display: flex; align-items: center; gap: .5rem; }
.chip { border-radius: 1rem; padding: .25rem .7rem; font-size: .8rem; border: 1px solid rgba(255,255,255,.4); background: transparent; color: #fff; }
.chip.active { background: #2a2; border-color: #2a2; }
.chip.private { background: #5b3fa8; border-color: #5b3fa8; }
.chip.inactive { background: transparent; color: #f4c56a; border-color: #f4c56a; }
.plans-row { display: flex; gap: .6rem; flex-wrap: wrap; margin: .6rem 0; }
.plan-card { flex: 1 1 9rem; min-width: 9rem; background: #fff; border-radius: 10px; padding: .7rem; display: flex; flex-direction: column; gap: .3rem; }
.plan-card h4 { margin: 0; }
.plan-card .price { font-size: 1.3rem; font-weight: 700; margin: 0; }
.plan-card button { margin-top: auto; }
.linklike { background: none; border: none; padding: 0; color: #2b6be0; text-decoration: underline; width: auto; }
.friend { min-width: 2.6rem; }
.friend.on { color: #a55a00; border-color: #a55a00; }
#friends-list li, #chat-menu .friend-note { display: flex; gap: .6rem; align-items: center; background: #fff; border-radius: 8px; padding: .5rem; margin: .4rem 0; }
#friends-list .name { flex: 1; font-weight: 600; }

/* ── Slide-in chat panel (vl_slide.js). Geometry and motion borrowed from the DashGPS shell's
   right-edge chat slideout (#chatframe): 360 px, flush right, translateX(100%) -> 0 over .25s ease,
   the same left shadow and dark ground; full width on phones. Sits under dialogs (z 10+). */
#vls-stack { position: fixed; top: .5rem; right: 0; z-index: 9; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; max-height: calc(100vh - 1rem); overflow-y: auto; overflow-x: hidden; pointer-events: none; }
.vls-panel { pointer-events: auto; width: 360px; background: #0a0e1a; color: #e8ebf2; border-radius: 10px 0 0 10px; box-shadow: -4px 0 28px rgba(0,0,0,.55); padding: .5rem .6rem .6rem; transform: translateX(100%); transition: transform .25s ease; touch-action: pan-y; }
.vls-panel.in { transform: translateX(0); }
.vls-panel.vls-drag { transition: none; }
.vls-head { display: flex; align-items: center; gap: .4rem; }
.vls-photo { width: 2.2rem; height: 2.2rem; border-radius: 50%; flex: none; overflow: hidden; background: #2a3350; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.vls-photo img { width: 100%; height: 100%; object-fit: cover; }
.vls-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vls-head button { background: transparent; border: 0; color: inherit; padding: .2rem .35rem; opacity: .6; }
.vls-head button:hover, .vls-head button:focus-visible, .vls-head .vls-pin.on { opacity: 1; }
.vls-head .vls-pin.on { background: #2a3350; border-radius: 6px; }
.vls-snooze-menu { display: flex; flex-direction: column; gap: .25rem; margin: .4rem 0; }
.vls-snooze-menu[hidden] { display: none; }
.vls-snooze-menu button, .vls-open, .vls-more, .vls-send { background: #1b2238; color: #e8ebf2; border: 1px solid #333c5a; }
.vls-msgs { list-style: none; padding: 0; margin: .4rem 0; max-height: 40vh; overflow-y: auto; }
.vls-msgs li { max-width: 85%; margin: .25rem 0; padding: .35rem .55rem; border-radius: 10px; background: #1b2238; overflow-wrap: anywhere; font-size: .92rem; }
.vls-msgs li.out { margin-left: auto; background: #1f4a2e; }
.vls-msgs img { max-width: 100%; max-height: 8rem; display: block; border-radius: 6px; }
.vls-msgs .st { font-size: .7rem; opacity: .7; margin-left: .3rem; }
.vls-reason { font-size: .82rem; background: #4a3a10; padding: .35rem; border-radius: 6px; margin: .3rem 0; }
.vls-notice { font-size: .8rem; opacity: .85; margin: .3rem 0; }
.vls-notice p { margin: .3rem 0 0; }
.vls-reply { display: flex; gap: .4rem; }
.vls-reply[hidden] { display: none; }
.vls-reply .vls-text { flex: 1; width: auto; background: #10162a; color: #e8ebf2; border-color: #333c5a; }
.vls-open { width: 100%; margin-top: .4rem; }
.vls-more { pointer-events: auto; border-radius: 1rem 0 0 1rem; padding: .3rem .8rem; box-shadow: -4px 0 14px rgba(0,0,0,.4); }
@media (max-width: 480px) { #vls-stack { left: 0; align-items: stretch; } .vls-panel { width: 100vw; border-radius: 0; } }
@media (prefers-reduced-motion: reduce) {
  .vls-panel, .vls-panel.in { transform: none; }
  .vls-panel { opacity: 0; transition: opacity .15s linear; }
  .vls-panel.in { opacity: 1; }
}
#browse-filters label { margin: 0; }
.dist { white-space: nowrap; }
