/* Trail Crew — styles matched to the Expo prototype (app/(tabs)/index.tsx `st` StyleSheet). */
:root {
    --bg: #101916; --panel: #1a2620; --raised: #24332a; --line: #344338; --field: #142019; --tagbg: #30402e;
    --text: #f0eee5; --muted: #a7b3a8; --faint: #748578; --accent: #e7ac68; --green: #c3d294; --danger: #f0a096;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
h1 { font-size: 31px; font-weight: 700; line-height: 39px; letter-spacing: -.7px; margin: 0; }
h1:focus { outline: none; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
.icon { flex-shrink: 0; }

/* ---- Shell ---- */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 980px; margin: 0 auto;
    padding-top: env(safe-area-inset-top); }
.header { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 18px 22px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); min-width: 0; }
.brand > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.brand-icon { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; }
.brand-text { font-size: 19px; font-weight: 800; letter-spacing: 2px; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; line-height: 16px; margin: 0; text-transform: uppercase; }
.brand .eyebrow { white-space: nowrap; }
.header-links { display: flex; gap: 6px; flex-shrink: 0; }
.pill-link { background: var(--tagbg); color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
    text-decoration: none; padding: 6px 9px; border-radius: 6px; }
.pill-link.active { color: var(--bg); background: var(--accent); }
.content { flex: 1; overflow-y: auto; padding: 22px 22px 30px; display: flex; flex-direction: column; gap: 20px; }
.content > * { margin-top: 0; margin-bottom: 0; flex-shrink: 0; } /* overflow:hidden children (lists) would otherwise collapse */
.page-head { padding-top: 7px; }
.footer { color: var(--faint); font-size: 9px; letter-spacing: 2px; text-align: center; padding-top: 15px; margin: 0; }
.offline-banner { display: flex; align-items: center; gap: 9px; padding: 11px 22px; background: #233026; color: var(--green); font-size: 11px; line-height: 17px; }

/* ---- Bottom navigation ---- */
.nav { display: flex; border-top: 1px solid var(--line); background: var(--bg); padding: 13px 0 calc(10px + env(safe-area-inset-bottom)); }
.nav-item { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 51px;
    color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 600; }
.nav-item.active { color: var(--accent); }
.nav-item.active::after { content: ""; width: 4px; height: 4px; border-radius: 2px; background: var(--accent); }
.badge { position: absolute; top: -6px; left: calc(50% + 4px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
    background: var(--danger); color: var(--bg); font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.badge.inline { position: static; }

/* ---- Text ---- */
.label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 1px; line-height: 17px; margin: 0; }
.small { color: var(--muted); font-size: 12px; line-height: 19px; }
.body { color: var(--text); font-size: 15px; line-height: 24px; margin: 0; }
.name { color: var(--text); font-size: 14px; font-weight: 600; }
.section { font-size: 20px; font-weight: 600; letter-spacing: -.3px; margin: 0; }
.link { font-size: 12px; color: var(--accent); font-weight: 600; text-decoration: none; background: none; border: none; padding: 0; cursor: pointer; }
.good { color: var(--green); } .bad { color: var(--danger); } .accent { color: var(--accent); }
.center { text-align: center; }
.notice { font-size: 13px; line-height: 20px; margin: 0; }
.trusted-mark { color: var(--text); }

/* ---- Layout helpers ---- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.actions, .request-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }

/* ---- Cards, lists, callouts ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 13px; }
.card > * { margin-top: 0; margin-bottom: 0; }
.card-title { font-size: 23px; font-weight: 600; line-height: 30px; margin: 0; }
.callout { padding: 18px; background: var(--panel); border-radius: 14px; display: flex; gap: 13px; align-items: center; }
.callout > div { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.list { background: var(--panel); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line);
    color: var(--text); text-decoration: none; background: none; }
.list > .person-row:last-child { border-bottom: none; }
.person-row .grow, .request-person > span { display: flex; flex-direction: column; gap: 5px; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; color: var(--muted); }
.mini-tags { font-size: 11px; color: var(--green); }
.empty { color: var(--muted); padding: 24px; line-height: 23px; margin: 0; }
.tag { display: inline-block; align-self: flex-start; background: var(--tagbg); color: var(--green); font-size: 9px; font-weight: 700;
    letter-spacing: .8px; text-transform: uppercase; padding: 5px 9px; border-radius: 6px; }
.tag.warn { color: var(--accent); }
.planned ul { margin: 0; padding-left: 20px; line-height: 1.8; color: var(--muted); }

/* ---- Chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-button { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 25px;
    padding: 10px 18px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.chip-button.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--tagbg); color: var(--green); border-radius: 6px;
    padding: 5px 6px 5px 10px; font-size: 12px; font-weight: 600; }
.chip button { background: none; border: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.chip.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 5px 10px; cursor: pointer; font: inherit; font-size: 12px; }

/* ---- Buttons & fields ---- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: var(--bg);
    border: none; border-radius: 11px; padding: 14px 17px; min-height: 46px; font: inherit; font-size: 13px; font-weight: 700;
    cursor: pointer; text-decoration: none; text-align: center; }
.button.secondary { background: var(--raised); color: var(--text); border: 1px solid var(--line); }
.button.block { display: flex; width: 100%; }
.button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); width: 100%; }
.button.danger-solid { background: var(--danger); color: var(--bg); }
.danger-text { color: var(--danger) !important; }
.button:disabled { opacity: .55; cursor: default; }
.small-button { min-height: 0; padding: 9px 14px; font-size: 12px; position: relative; overflow: hidden; }
.recovery-code.user-id { font-size: 11px; text-transform: none; letter-spacing: 0; }
.recovery-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; letter-spacing: .04em;
    word-break: break-all; line-height: 1.6; text-transform: uppercase; }
/* A file picker styled as a button: the invisible input fills the button, so the button must contain it. */
label.button { position: relative; overflow: hidden; }
.hidden-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.link-button { background: none; border: none; color: var(--accent); padding: 0; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.icon-button { background: var(--raised); color: var(--text); border: 1px solid var(--line); border-radius: 50%;
    width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.field small, small.small { color: var(--muted); font-size: 12px; display: block; }
input:not([type=checkbox]), textarea, select { width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--line);
    border-radius: 10px; padding: 13px; min-height: 48px; font: inherit; font-size: 15px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
textarea { resize: vertical; }
form.card, form { display: flex; flex-direction: column; gap: 16px; }
.inline-form { flex-direction: row !important; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.narrow { max-width: 460px; width: 100%; }
.segmented { display: flex; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.segmented button { flex: 1; background: none; border: none; color: var(--muted); padding: 10px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.segmented button.active { background: var(--raised); color: var(--text); }

/* Switch rows (prototype: title + description + switch) */
.setting { display: flex; align-items: center; gap: 14px; padding: 10px 0; cursor: pointer; }
.setting > span { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 4px 0; color: var(--text); cursor: pointer; }
.setting input[type=checkbox], .toggle input[type=checkbox] { appearance: none; -webkit-appearance: none; flex-shrink: 0;
    width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.setting input[type=checkbox]::after, .toggle input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.setting input[type=checkbox]:checked, .toggle input[type=checkbox]:checked { background: #738954; }
.setting input[type=checkbox]:checked::after, .toggle input[type=checkbox]:checked::after { transform: translateX(18px); }
.setting input[type=checkbox]:disabled, .toggle input[type=checkbox]:disabled { opacity: .5; }
.prefs { width: 100%; border-collapse: collapse; }
.prefs th { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 1px; text-align: center; padding: 6px; }
.prefs td { padding: 10px 6px; border-top: 1px solid var(--line); font-size: 14px; }
.prefs td:not(:first-child) { text-align: center; width: 62px; }
.prefs input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---- Avatars ---- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--raised); }
.avatar.initials { display: grid; place-items: center; color: var(--bg); font-weight: 800; }

/* ---- Login ---- */
.welcome { display: flex; flex-direction: column; gap: 20px; }
.welcome-art { position: relative; height: 230px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #26382b; }
.welcome-art svg { width: 100%; height: 100%; display: block; }

/* ---- Map ---- */
.map-hero { position: relative; }
.trail-map { height: 330px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #26382b; }
/* Tint the light OpenFreeMap style toward the app's dark trail green (canvas only — markers keep their colors). */
.trail-map .maplibregl-canvas { filter: invert(.92) hue-rotate(180deg) sepia(.35) hue-rotate(45deg) saturate(.9) brightness(.95); }
.trail-map .maplibregl-ctrl-attrib { background: rgba(16, 25, 22, .75); color: var(--muted); font-size: 10px; }
.trail-map .maplibregl-ctrl-attrib a { color: var(--muted); }
.trail-map .maplibregl-ctrl-group { background: var(--bg); border: 1px solid var(--line); }
.trail-map .maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.trail-map .maplibregl-ctrl-icon { filter: invert(1); }
.map-badge { position: absolute; top: 14px; left: 14px; z-index: 2; background: var(--bg); padding: 7px 11px; border-radius: 20px;
    display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.map-caption { position: absolute; bottom: 15px; left: 15px; right: 15px; z-index: 2; background: #101916e8; padding: 12px; border-radius: 10px;
    font-size: 13px; color: var(--text); pointer-events: none; }
.map-hero .map-caption { bottom: 34px; }
.map-empty { min-height: 160px; }
.me-marker { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg);
    box-shadow: 0 0 0 7px rgba(231, 172, 104, .3); }
.checkin-map { position: relative; }
.checkin-map .trail-map { height: 200px; }
.checkin-map.large .trail-map { height: 300px; }
.map-overlay-link { position: absolute; inset: 0; z-index: 2; border-radius: 18px; }
.card.checkin.selected { border-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper .button { min-width: 44px; font-size: 20px; line-height: 1; }
.stepper-value { font-size: 24px; font-weight: 600; color: var(--accent); min-width: 64px; text-align: center; }
.stepper-value small { font-size: 12px; color: var(--muted); font-weight: 400; }
.checkin-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); padding: 0;
    cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.point-marker { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent);
    border: 3px solid var(--bg); box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.crew-marker { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--bg); color: var(--bg); font-weight: 800; font-size: 12px;
    display: grid; place-items: center; padding: 0; overflow: hidden; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.crew-marker.trusted { box-shadow: 0 0 0 2px var(--green), 0 2px 8px rgba(0, 0, 0, .45); }
.crew-marker img { width: 100%; height: 100%; object-fit: cover; }
.radius-value { font-size: 29px; color: var(--accent); font-weight: 600; margin: 0; }
.radius-value small { font-size: 12px; color: var(--muted); font-weight: 400; }
.crew-search { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.crew-search input { flex: 1 1 200px; }
.crew-search .radius-select { flex: 0 1 auto; width: auto; min-width: 150px; }

/* ---- Profile & people ---- */
.profile-head { display: flex; gap: 18px; align-items: flex-start; }
.person-head { display: flex; flex-direction: column; gap: 10px; }
.bio { margin: 0; }
.blocked-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.request-person { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }
.qr { background: #f0eee5; border-radius: 14px; padding: 10px; width: min(100%, 260px); align-self: center; line-height: 0; }
.qr svg { width: 100%; height: auto; }
.invite-link { width: 100%; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.invite-card { display: flex; flex-direction: row; align-items: center; gap: 13px; text-decoration: none; color: var(--text); }
.invite-card .grow { display: flex; flex-direction: column; gap: 5px; }
.upload-row { display: flex; align-items: center; gap: 12px; }
.selfie-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); }
.editor-section { display: flex; flex-direction: column; gap: 13px; border-top: 1px solid var(--line); padding-top: 16px; }

/* ---- Photo gallery ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.gallery-tile { aspect-ratio: 1; padding: 0; border: none; border-radius: 10px; overflow: hidden; background: var(--raised); cursor: pointer; }
.gallery-tile img, .gallery-tile .img-placeholder { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-placeholder { display: block; background: var(--raised); }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 10, .94); display: flex; align-items: center;
    justify-content: center; padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom); }
.lightbox-inner { width: 100%; max-width: 860px; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; }
.lightbox-image { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; background: #000; }
.lightbox-caption { text-align: center; margin: 0; }
.lightbox-actions, .lightbox-nav { justify-content: center; flex-wrap: wrap; }

/* ---- Trips ---- */
.trip-card { text-decoration: none; color: var(--text); }
.trip-card .row:last-child { margin-top: 10px; }
.trip-cta { color: var(--accent); font-weight: 700; font-size: 13px; }
.trip-cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; margin-bottom: 16px; background: var(--field); }
.trip-card-cover { display: block; width: calc(100% + 40px); margin: -20px -20px 0; aspect-ratio: 3 / 1; object-fit: cover; border-radius: 16px 16px 0 0; background: var(--field); }
.cover-preview { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.file-row .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { color: var(--green); display: grid; place-items: center; }
.file-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ---- Messages ---- */
.convo-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preview.unread { color: var(--text); font-weight: 600; }
.trip-chat-cover { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.trip-chat-icon { display: grid; place-items: center; background: var(--raised); }
.chat-head { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.chat-head > span:last-child { display: flex; flex-direction: column; }
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 240px; }
.bubble { max-width: 90%; align-self: flex-start; background: var(--raised); border-radius: 15px; padding: 15px;
    display: flex; flex-direction: column; gap: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 22px; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--bg); }
.bubble small { font-size: 11px; opacity: .7; }
.bubble-name { display: block; font-size: 11px; font-weight: 700; color: var(--accent); text-decoration: none; margin-bottom: 4px; }
.chat-input { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0; }

/* ---- Status & legal ---- */
.phases { width: 100%; border-collapse: collapse; }
.phases td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.phases tr:first-child td { border-top: none; }
.legal ul { padding-left: 20px; line-height: 1.7; color: var(--muted); margin: 0; }
.legal p { color: var(--muted); line-height: 1.6; }
.legal h2 { margin-top: 8px; }

/* ---- Admin ---- */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-tabs a { padding: 9px 16px; border-radius: 25px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
.admin-tabs a.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column;
    gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; }
.stat b { font-size: 29px; color: var(--text); font-weight: 600; }
.stat.alert b { color: var(--danger); }
.admin-table { display: flex; flex-direction: column; background: var(--panel); border-radius: 16px; overflow: hidden; }
.admin-row { display: grid; grid-template-columns: 2.2fr 1fr 1.2fr 1.4fr .6fr; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line);
    color: var(--text); text-decoration: none; font-size: 13px; align-items: center; }
.admin-row.head { border-top: none; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.deleted { opacity: .6; }
.warn-card { border-color: var(--accent); }
.report-reason { background: var(--raised); border-radius: 10px; padding: 10px 12px; }
.pager { justify-content: center; align-items: center; }
.user-card .row { align-items: flex-start; }
@media (max-width: 700px) {
    .admin-row { grid-template-columns: 1fr 1fr; }
    .admin-row.head { display: none; }
    .admin-row .name { grid-column: 1 / -1; }
    .file-row { flex-wrap: wrap; }
    .file-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 460px) {
    .header { padding: 16px 18px; }
    .content { padding: 20px 18px 28px; }
    .brand-text { font-size: 17px; }
    .brand .eyebrow { font-size: 8px; letter-spacing: 1.2px; }
}

/* Developer page */
.facts { width: 100%; border-collapse: collapse; font-size: 13px; }
.facts th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 10px 6px 0; vertical-align: top; width: 34%; }
.facts td { padding: 6px 0; word-break: break-word; }
.log-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.log-entry { border-top: 1px solid var(--line); padding-top: 8px; }
.log-head { display: flex; align-items: center; gap: 8px; }
.log-level { font-size: 10px; font-weight: 800; letter-spacing: .06em; border-radius: 6px; padding: 2px 6px; background: var(--raised); }
.log-level.error { background: var(--danger); color: var(--bg); }
.log-level.warn { background: var(--accent); color: var(--bg); }
.log-message { margin: 4px 0 0; font-size: 13px; word-break: break-word; }
.log-exception { font-size: 11px; white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto; }


/* ---- Trail Badges ---- */
.badge-icon { display: inline-grid; place-items: center; flex: none; position: relative; }
.badge-icon svg, .badge-icon .badge-image { width: 100%; height: 100%; display: block; }
.badge-icon .badge-image { border-radius: 50%; object-fit: cover; }
.badge-icon .badge-bg { fill: var(--raised); }
.badge-icon .badge-ring { fill: none; stroke: var(--accent); stroke-width: 3; }
.badge-icon .badge-mark { fill: var(--accent); }
.badge-icon .badge-text { fill: var(--text); font: 700 15px system-ui, sans-serif; text-anchor: middle; letter-spacing: .5px; }
.badge-icon .badge-text.big { font-size: 26px; }
.badge-icon .badge-text.tiny { font-size: 9.5px; letter-spacing: .2px; }
.badge-icon .badge-stroke { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.badge-icon .badge-stroke.thin { stroke-width: 2.2; }
.badge-icon .badge-stroke.dark { stroke: var(--raised); stroke-width: 2; }
.badge-icon .badge-stroke.wide { stroke-width: 8; }
.badge-icon .badge-stroke.check { stroke: var(--bg); stroke-width: 3.5; }
.badge-icon.military .badge-ring { stroke: var(--green); }
.badge-icon.military .badge-mark { fill: var(--green); }
.badge-icon.locked { filter: grayscale(1); opacity: .38; }
.badge-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.badge-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 1px solid transparent;
    border-radius: 12px; padding: 8px 4px; color: var(--text); cursor: pointer; text-align: center; }
.badge-tile.open { border-color: var(--accent); background: var(--panel); }
.badge-tile.added { border-color: var(--accent); }
.badge-tile.added .small { color: var(--accent); font-weight: 700; }
.badge-tile:disabled { cursor: progress; }
.badge-with-value { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.badge-with-value small { font-size: 10px; color: var(--accent); font-weight: 700; letter-spacing: .4px; }
.badge-tile .small { font-size: 11px; line-height: 14px; }
.badge-row { display: flex; align-items: center; gap: 14px; width: 100%; background: none; border: 0; padding: 0; color: var(--text);
    cursor: pointer; text-align: left; font: inherit; }
.badge-row .grow { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.badge-card.earned { border-color: #4d5e3c; }
.badge-detail { border-top: 1px solid var(--line); padding-top: 13px; }
.progress { display: block; height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; max-width: 220px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.warn-callout { border-color: var(--accent); }
.document-view { display: block; width: 100%; max-height: 75vh; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
iframe.document-view { height: 75vh; }
.admin-badge-row .name .tag { margin-left: 6px; vertical-align: middle; }

/* ---- Trail Groups ---- */
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pre-wrap { white-space: pre-wrap; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.inline-label select { width: auto; min-width: 72px; }
.person-link { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-width: 0; }
.request-item { border-top: 1px solid var(--line); padding-top: 12px; }

/* ---- Notifications ---- */
.bell-link { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; color: var(--text); }
.bell-link .badge { top: -2px; left: 18px; }
.bell-link.active { color: var(--accent); }
.nav-item > span { position: relative; }
.notification.unseen { border-color: var(--accent); }
.notification.unseen .name { color: var(--accent); }
.notification-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; flex: none; }

.tiny-link { font-size: 10px; }

/* ---- Recovery Beacon ---- */
.location-row { justify-content: flex-start; flex-wrap: wrap; }
.location-row .beacon-button { margin-left: auto; }
.button.beacon-button { background: #c0392b; color: #fff; border: none; }
.beacon-label { color: #e8735f; }
.beacon-alert { background: #c0392b; color: #fff; text-decoration: none; }
.beacon-alert .name, .beacon-alert .small { color: #fff; }
.beacon-alert .grow { display: flex; flex-direction: column; gap: 4px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(8, 12, 10, .8); display: flex; align-items: flex-end; justify-content: center;
    padding: env(safe-area-inset-top) 0 0; }
.modal { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
    border-radius: 20px 20px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.modal > * { margin: 0; }
@media (min-width: 600px) { .modal-backdrop { align-items: center; } .modal { border-radius: 20px; } }
.beacon-pulse { width: 64px; height: 64px; border-radius: 50%; background: #c0392b; display: grid; place-items: center; align-self: center;
    animation: beacon-pulse 1.6s ease-out infinite; }
@keyframes beacon-pulse { 0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .6); } 100% { box-shadow: 0 0 0 22px rgba(192, 57, 43, 0); } }
@media (prefers-reduced-motion: reduce) { .beacon-pulse { animation: none; } }
.setup-step { display: flex; gap: 12px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 14px; }
.setup-step .stack { gap: 6px; }
.step-mark { width: 28px; height: 28px; border-radius: 50%; background: var(--raised); color: var(--text); display: grid; place-items: center;
    font-weight: 800; font-size: 13px; flex-shrink: 0; }
.setup-step.done .step-mark { background: var(--green); color: var(--bg); }
