/* GeoMuster styles. Plain CSS, no build step. Mobile-first. */

:root {
    --ink: #1b1f1d;
    --paper: #ffffff;
    --accent: #111111; /* black bars and buttons (Tony, 2026-10-18), to go with the logo */
    --muted: #5b6660;
    --radius: 12px;
    --touch: 40px; /* minimum touch target */
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    color: var(--ink);
    background: var(--paper);
}

button { font: inherit; min-height: var(--touch); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 8px 0 12px; }
h2 { font-size: 1.2rem; margin: 28px 0 12px; }
.muted { color: var(--muted); }

/* Ordinary pages */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    min-height: 56px;
    background: var(--accent);
    color: #fff;
}
.topbar a, .topbar .link-button { color: #fff; }
.topbar .brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.15rem; text-decoration: none; }
.brand-logo { height: 32px; width: auto; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar form { margin: 0; }
.page { max-width: 640px; margin: 0 auto; padding: 16px; }

.notice {
    padding: 12px 16px;
    border-radius: var(--radius);
    background: #e6f2ea;
}

/* Forms */
.form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form label { font-weight: 600; margin-top: 10px; }
.form label.check { font-weight: normal; display: flex; align-items: center; gap: 10px; min-height: var(--touch); }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=tel],
.form input[type=date], .form textarea, select {
    font: inherit;
    min-height: var(--touch);
    padding: 8px 12px;
    border: 1px solid #b8c2bc;
    border-radius: 8px;
}
.form input[type=checkbox] { width: 22px; height: 22px; }
.form .button { margin-top: 16px; }
.error { color: #b00020; margin: 2px 0 0; }

.button {
    padding: 0 14px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.button-danger { background: #9b2226; }
.link-button {
    min-height: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

/* Lists */
.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e3e7e4;
}
.row-link { color: inherit; text-decoration: none; min-height: var(--touch); }
.row-link:hover { background: #f4f6f5; }
.row-actions { display: flex; gap: 8px; align-items: center; }
[x-cloak] { display: none !important; } /* hidden until the page's scripts have started */

/* Projects page: the heading is one button; tap it and the list of projects pops down, New project last. */
.proj-head { min-height: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }

.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.heading-row .button { display: inline-flex; align-items: center; min-height: var(--touch); text-decoration: none; }
select { background: #fff; }
.row-actions form { margin: 0; }
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: #e6f2ea;
    font-size: 0.8rem;
}

/* ---- Full-screen map page ---- */
.map-page { overflow: hidden; }
.small { font-size: 0.875rem; }
.pre-line { white-space: pre-line; }

.map-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 8px;
    padding-top: env(safe-area-inset-top);
    background: var(--accent);
    color: #fff;
}
/* The brand in the top bar (so a screenshot of the map says whose it is): the pin, then the name, then the project's address. */
.map-home { display: inline-flex; align-items: center; gap: 8px; flex: none; color: inherit; text-decoration: none; } /* the logo: takes you to the Projects page */
.map-logo { flex: none; height: 32px; width: auto; }
.map-brand { flex: none; font-weight: 700; font-size: 1.05rem; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.35); }
@media (max-width: 520px) { .map-brand { display: none; } }
.map-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.icon-button {
    width: var(--touch);
    height: var(--touch);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
}
a.icon-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.chip {
    flex: none;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.chip-ok { background: #16a34a; }
.chip-warn { background: #ca8a04; }
.chip-bad { background: #dc2626; }

.map-page #map {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
}
#map.is-placing { cursor: crosshair; }
.legend details.lg-more { margin: 6px 0; }
.legend details.lg-more > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
/* The open layers menu never runs off the bottom of the screen: it scrolls inside itself (the header and bottom bar take about 160px). */
/* The open menu is grabbed by its frame: a roomy frame to put a finger on, which drags the whole box (the list inside still scrolls). */
.leaflet-control-layers-expanded { padding: 14px; cursor: grab; touch-action: none; }
.leaflet-control-layers-expanded .leaflet-control-layers-list { cursor: auto; touch-action: pan-y; }
.leaflet-control-layers-list { max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); height: auto !important; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* The layer checkboxes, folded into groups (Points, Lines and routes, ...). */
.layers-group-head { display: flex; align-items: center; gap: 6px; min-height: 25px; margin-top: 2px; }
.layers-group-head a { flex: 1; display: flex; align-items: center; min-height: 25px; color: inherit; font-weight: 600; text-decoration: none; }
.layers-group-head input { min-height: 0; margin: 0; }
.layers-group-body { margin-left: 18px; }
.layers-group-body label { padding: 2px 0; } /* taller rows only: the width is unchanged */
/* The open layers menu stops above the round buttons in the bottom corner (it scrolls inside instead). */
.leaflet-control-layers-list { max-height: max(200px, calc(100dvh - 350px)); }
@media (pointer: coarse) { .leaflet-control-layers-list { max-height: max(200px, calc(100dvh - 290px - env(safe-area-inset-bottom))); } }
.layers-legend-link { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid #ccc; font-size: 0.9rem; }
/* While drawing, markers let the tap through to the map so a point can be placed on top of one. */
#map.is-drawing .wp-icon, #map.is-drawing .team-icon, #map.is-drawing .found-icon { pointer-events: none; }
/* Keep Leaflet's bottom controls (zoom, attribution) above the action bar */
.map-page .leaflet-bottom { bottom: env(safe-area-inset-bottom); } /* no bottom bar any more: the Project menu floats */
/* The scale bar (feet) floats at the top middle of the map, so the Project menu button sits right under the header. */
.map-page .leaflet-control-scale { position: absolute; left: 50vw; transform: translateX(-50%); margin: 10px 0 0; }

/* The Project menu: a floating card (movable: grab its frame); the list inside scrolls. */
.project-menu {
    position: fixed;
    z-index: 1100;
    width: 216px; /* the longest row ("Connect research points") plus the frame */
    max-width: 92vw;
    padding: 12px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.project-menu-head { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; font-weight: 600; }
.project-menu-x { margin-left: auto; min-height: 0; padding: 0 10px; font-size: 1.2rem; line-height: 1.3; background: none; border: 0; cursor: pointer; }
.project-menu-items {
    max-height: calc(100vh - 220px);
    max-height: calc(100dvh - 220px);
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    cursor: auto;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}
.project-menu-items button {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.project-menu-items button:last-child { border-bottom: 0; }
.project-menu-items button:disabled { color: #9ca3af; cursor: default; }
.project-menu-items .menu-back { color: var(--muted); font-weight: 600; }
.project-menu-items .menu-stop { color: #dc2626; font-weight: 600; }
/* A list row with a small action at its end (Saved aerials: the photo, then Remove). */
.project-menu-items .menu-row { display: flex; border-bottom: 1px solid #e5e7eb; }
.project-menu-items .menu-row:last-child { border-bottom: 0; }
.project-menu-items .menu-row button { border-bottom: 0; }
.project-menu-items .menu-row .menu-row-x { width: auto; flex: none; color: #dc2626; font-size: 13px; }

/* Admin menu: a plain vertical list of big tappable lines. */
.admin-menu { max-width: 420px; border: 1px solid #e5e7eb; border-radius: var(--radius); overflow: hidden; background: #fff; }
.admin-menu a { display: block; padding: 14px 16px; border-bottom: 1px solid #e5e7eb; color: var(--ink); text-decoration: none; font-weight: 600; }
.admin-menu a:last-child { border-bottom: 0; }

/* A small button for an extra action in a detail panel (the full-size .button is for the main actions). */
.mini-button { min-height: 0; padding: 5px 12px; border: 1px solid #d1d5db; border-radius: 6px; background: #f3f4f6; color: var(--ink); font-size: 0.85rem; cursor: pointer; }

/* Export for drone: a small floating box (movable: grab its frame). */
.drone-box {
    position: fixed;
    z-index: 1100;
    width: 210px;
    padding: 8px 10px 10px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    cursor: grab;
    touch-action: none;
    user-select: none;
    font-size: 0.85rem;
}
.drone-box select, .drone-box input { min-height: 0; height: 32px; padding: 0 6px; font-size: 0.85rem; margin: 0; }
.drone-box select { width: 100%; }
.drone-box.wide { width: 270px; }
.pl-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 0.85rem; }
.pl-bar a { color: var(--accent); }
.pl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-height: 250px; overflow-y: auto; touch-action: pan-y; cursor: auto; }
.pl-cell { position: relative; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: #e5e7eb; outline: 3px solid transparent; outline-offset: -3px; }
.pl-cell.is-ticked { outline-color: var(--accent); }
.pl-cell img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.pl-cell input { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; min-height: 0; margin: 0; }
.pl-view img { display: block; width: 100%; max-height: 220px; object-fit: contain; background: #111; border-radius: 6px; margin-bottom: 6px; }
.pb-img { display: block; width: 100%; max-height: 150px; object-fit: cover; border-radius: 6px; background: #e5e7eb; }
.pb-row { display: flex; gap: 6px; }
.pb-row .db-go { flex: 1; width: auto; }
.drone-box input[type=text] { box-sizing: border-box; }
.fb-list { margin: 0; padding: 0; list-style: none; max-height: 220px; overflow-y: auto; touch-action: pan-y; cursor: auto; }
.fb-list li { padding: 5px 0; border-top: 1px solid #e5e7eb; }
.fb-list li:first-child { border-top: 0; }
.fb-name { font-weight: 600; word-break: break-all; }
.fb-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 0.8rem; }
.fb-actions a { color: var(--accent); }
.fb-actions .fb-del { color: #b91c1c; margin-left: auto; }
.db-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.db-row label { flex: 1; margin: 0; font-size: 0.8rem; }
.db-row input { width: 64px; }
.db-go { width: 100%; margin-top: 8px; font-weight: 600; }
.db-note { margin-top: 6px; color: var(--muted); font-size: 0.75rem; line-height: 1.25; }

/* Team Space: a small floating voice box (movable: grab its frame). */
.team-space {
    position: fixed;
    z-index: 1100;
    width: 190px;
    padding: 8px 10px 10px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    cursor: grab;
    touch-action: none;
    user-select: none;
    font-size: 0.85rem;
}
.ts-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.ts-status { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.ts-x { margin-left: auto; min-height: 0; padding: 0 8px; font-size: 1.2rem; line-height: 1.2; background: none; border: 0; cursor: pointer; }
.ts-row { display: flex; gap: 6px; }
.ts-row button { min-height: 40px; border: 1px solid #d1d5db; border-radius: 6px; background: #f3f4f6; color: var(--ink); cursor: pointer; }
.ts-speak { flex: 1; font-weight: 600; }
.ts-speak.is-on { background: #16a34a; border-color: #16a34a; color: #fff; }
.ts-who { padding: 0 12px; }
.ts-row button:disabled { color: #9ca3af; cursor: default; }
.ts-error { margin-bottom: 6px; color: #b91c1c; font-size: 0.78rem; line-height: 1.25; }
.ts-hear { width: 100%; min-height: 40px; margin-top: 6px; border: 1px solid #d97706; border-radius: 6px; background: #fef3c7; color: #92400e; font-weight: 600; cursor: pointer; }
.ts-talking { margin-top: 6px; color: #15803d; font-size: 0.78rem; }
.ts-list { margin: 6px 0 0; padding: 0; list-style: none; max-height: 140px; overflow-y: auto; touch-action: pan-y; cursor: auto; }
.ts-list li { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.ts-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; flex: none; }
.ts-list li.is-speaking .ts-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.3); }
.ts-muted { margin-left: auto; color: var(--muted); font-size: 0.72rem; }

.fab {
    position: fixed;
    right: 10px;
    bottom: calc(100px + env(safe-area-inset-bottom)); /* a mouse: above the zoom buttons */
    z-index: 1000;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #1d4ed8;
    font-size: 1.6rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.fab-home { bottom: calc(160px + env(safe-area-inset-bottom)); color: var(--accent); }
.fab-directions { bottom: calc(220px + env(safe-area-inset-bottom)); background: #1d4ed8; color: #fff; }
/* A finger: no zoom buttons (pinch and double-tap do it), so the round buttons take the bottom corner. */
@media (pointer: coarse) {
    .map-page .leaflet-control-zoom { display: none; }
    .fab { bottom: calc(14px + env(safe-area-inset-bottom)); }
    .fab-home { bottom: calc(74px + env(safe-area-inset-bottom)); }
    .fab-directions { bottom: calc(134px + env(safe-area-inset-bottom)); }
}

/* Next stop banner under the top bar; the map's top controls move down while it shows */
.stop-banner {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    z-index: 1090;
    min-height: 32px;
    padding: 4px 12px;
    border: 0;
    background: #1d4ed8;
    color: #fff;
    font-size: 0.9rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.directions-steps { margin: 6px 0 0; padding-left: 22px; }
.directions-steps li { margin-bottom: 4px; }
.directions-instruction { font-size: 1.6rem; font-weight: 700; margin: 4px 0; }
.muted-light { opacity: 0.8; }
.has-stop-banner .leaflet-top { top: 32px; }
.you-arrow { background: none; border: 0; pointer-events: none; }

.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    gap: 8px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}
/* Slim like keyboard keys (Tony): 40 px buttons and menu items, full width of their slot. */
.action-slot { position: relative; flex: 1; display: flex; }
.action-bar .action { flex: 1; min-height: 40px; padding: 0 8px; font-size: 1rem; }
.action-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    min-width: 100%;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.action-menu-right { left: auto; right: 0; }
.action-menu .menu-back { color: var(--muted); font-weight: 600; }
/* Freehand tracing: the finger draws instead of panning or scrolling */
#map.is-tracing { touch-action: none; cursor: crosshair; }
/* Snap to trail: numbered points tapped */
.snap-pt { background: none; border: 0; }
.snap-pt span {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: #ea580c; color: #fff; border: 2px solid #fff;
    font-size: 0.75rem; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.snap-credit { display: block; width: 100%; margin-top: 4px; font-weight: normal; }
.placing-banner { flex-wrap: wrap; }
.action-menu button {
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    color: var(--ink);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.action-menu button:last-child { border-bottom: 0; }
.action-menu button:disabled { color: #9ca3af; cursor: default; }
.badge {
    display: inline-block;
    min-width: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.8rem;
    line-height: 20px;
    text-align: center;
}
.button-slim { min-height: 40px; }
.button:disabled { opacity: 0.6; cursor: wait; }
.button-light { background: #e8ece9; color: var(--ink); }

.placing-banner {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 8px 8px 16px;
    border-radius: var(--radius);
    background: #fff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Bottom sheet: only shown for an action or a selected waypoint */
.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    max-height: 70vh;
    overflow-y: auto;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--paper);
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.25);
}
/* Info pop-ups that float and can be moved (team, credits, legend): grab the frame or an empty spot; the body inside scrolls. */
.sheet.sheet-float {
    right: auto;
    bottom: auto;
    width: 380px;
    max-width: 92vw;
    max-height: none;
    overflow: hidden;
    border-radius: var(--radius);
    padding: 14px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.sheet-float .sheet-body {
    max-height: calc(100vh - 220px);
    max-height: calc(100dvh - 220px);
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    cursor: auto;
    user-select: text;
}
/* Directions: a floating card (listened to, not read). It leaves the bottom bar and the side buttons clear,
   and can be dragged by its grip. */
.sheet-directions {
    max-height: 40vh;
    right: auto;
    width: calc(100% - 78px);
    bottom: calc(8px + env(safe-area-inset-bottom));
    border-radius: var(--radius);
    padding-top: 0;
}
.sheet-directions h2 { touch-action: none; cursor: grab; }
.sheet-directions .button { min-height: 40px; padding: 0 12px; }
.sheet-directions .row-actions { gap: 6px; margin-bottom: 6px; }
.sheet-grip {
    height: 36px;
    margin: 0 44px 0 0;
    touch-action: none;
    cursor: grab;
    position: relative;
}
.sheet-grip::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 14px;
    width: 56px;
    height: 6px;
    margin-left: -28px;
    border-radius: 3px;
    background: #8a8a8a;
}
.sheet h2 { margin: 4px 0 10px; padding-right: 44px; }
.sheet-close { position: absolute; top: 6px; right: 6px; color: var(--muted); }
.sheet-option { display: block; width: 100%; margin-bottom: 8px; }
.sheet .form { margin-bottom: 0; }
.coord-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coord-row input { width: 100%; }
.coords { font-variant-numeric: tabular-nums; }
.row-actions.wrap { flex-wrap: wrap; }
.conflict {
    padding: 10px 12px;
    border-radius: var(--radius);
    background: #fff4e5;
}

/* ☰ drawer */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.4);
}
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: min(320px, 85vw);
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top));
    overflow-y: auto;
    background: var(--paper);
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.3);
}
.drawer h2 { margin: 0 0 4px; padding-right: 44px; }
.drawer > a, .drawer .link-button {
    display: flex;
    align-items: center;
    min-height: var(--touch);
    font-size: 1.05rem;
}
.drawer form { margin: 0; }
.drawer-close { position: absolute; top: 8px; right: 8px; color: var(--muted); }

.toast {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1400;
    max-width: calc(100% - 32px);
    padding: 10px 16px;
    border-radius: var(--radius);
    background: #1b1f1d;
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Search panel, under the top bar */
.search-panel {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    z-index: 1150;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding: 10px 12px 12px;
    background: var(--paper);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.search-row { display: flex; gap: 6px; align-items: center; }
.search-row input {
    flex: 1;
    min-width: 0;
    min-height: var(--touch);
    padding: 8px 12px;
    border: 1px solid #b8c2bc;
    border-radius: 8px;
    font: inherit;
}
.search-row .icon-button { color: var(--muted); font-size: 1.2rem; }
.search-help { margin: 8px 2px 0; }
.search-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #e3e7e4;
    border-radius: 8px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.search-result:hover { background: #f4f6f5; }
.found-icon { background: none; border: 0; }

/* Coordinates block: Lat/Lng, USNG, UTM */
.coords {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    margin: 8px 0 12px;
    font-variant-numeric: tabular-nums;
}
.coords dt { color: var(--muted); }
.coords dd { margin: 0; }

.action-bar .action-finding { background: #c2410c; }
.action-bar .action { padding: 0 6px; font-size: 1rem; line-height: 1.15; }
.status-buttons .is-current { outline: 3px solid #16a34a; outline-offset: -3px; }
.placing-banner { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
.placing-banner > .row-actions { justify-content: flex-end; flex-wrap: wrap; }
.drawer h3 { margin: 14px 0 4px; font-size: 1rem; }

/* Team positions: reports, never live. Fresh = recent report, stale = greyed. */
.team-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}
.team-row:disabled { cursor: default; }
.team-row.is-done strong { color: #6b7280; text-decoration: line-through; }
.profile-fields { margin: 8px 0; }
.profile-fields p { margin: 0 0 8px; }
.team-phone { display: inline-block; margin: 0 0 6px 44px; }

/* Profile pictures: the photo sits over the initials; if it fails to load it's removed and the initials show */
.avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: #0f766e;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 22px; height: 22px; font-size: 0.6rem; vertical-align: middle; margin-right: 4px; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-row { display: flex; align-items: center; gap: 14px; }
/* Page title with the person's picture at the top right */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.new-user { margin-bottom: 20px; }
.new-user-exp { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }
.new-user-exp select { width: auto; }
.user-link { display: inline-block; padding: 6px 0; }
.user-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; }
.user-edit { display: inline-flex; align-items: center; text-decoration: none; }
.new-user summary { display: inline-flex; align-items: center; min-height: var(--touch); list-style: none; cursor: pointer; }
.new-user summary::-webkit-details-marker { display: none; }
.new-user[open] summary { margin-bottom: 8px; }
.team-dot { position: relative; overflow: hidden; }
.team-stale img { opacity: 0.55; filter: grayscale(1); }
.team-dot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Message board: full screen under the top bar */
.board-panel {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1150;
    display: flex;
    flex-direction: column;
    padding: 0 12px calc(8px + env(safe-area-inset-bottom));
    background: var(--paper);
}
.board-head { display: flex; align-items: center; justify-content: space-between; }
.board-head h2 { margin: 8px 0; }
.board-pinned { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.board-pin {
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
}
.board-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.msg { margin: 0 0 8px; padding: 8px 10px; border-radius: var(--radius); background: #f1f5f2; }
.msg-mine { background: #e3efe7; }
.msg-important { border-left: 4px solid #dc2626; }
.msg-meta { margin: 0 0 2px; font-size: 0.85rem; color: var(--muted); }
.msg-meta .tag { margin-left: 4px; }
.msg-body { margin: 0; }
.msg-actions { display: flex; gap: 14px; }
.msg-actions .link-button { min-height: 32px; padding: 0; font-size: 0.85rem; }
.board-compose textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid #c9d1cc; border-radius: 8px; }
.board-compose-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; }
.board-note { margin: 4px 0 0; }

/* Project email (same panel as the board) */
.mail-new { width: 100%; margin-bottom: 8px; }
.mail-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 0;
    border-radius: var(--radius);
    background: #f1f5f2;
    text-align: left;
    cursor: pointer;
}
.mail-to { margin-top: 6px; }
.mail-rcpt { margin-right: 8px; white-space: nowrap; }
.rcpt-sent { color: #15803d; }
.rcpt-failed { color: #b00020; font-weight: 600; }
.mail-to-head { display: flex; align-items: center; justify-content: space-between; }
.mail-picks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.mail-pick { min-height: 36px; }
.mail-compose input[type=text], .mail-compose textarea { width: 100%; }
.team-row-text { display: flex; flex-direction: column; }
.team-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.team-fresh { background: #0f766e; }
.team-stale { background: #9ca3af; color: #1f2937; border-style: dashed; border-color: #4b5563; }
.team-none { background: #e5e7eb; color: #6b7280; box-shadow: none; }
.team-icon { background: none; border: 0; }

/* Status tags */
.tag-new { background: #ffedd5; }
.tag-reviewed { background: #fed7aa; }
.tag-significant { background: #fecaca; font-weight: 700; }
.tag-dismissed { background: #e5e7eb; color: #4b5563; }
.tag-not_started { background: #dbeafe; }
.tag-in_progress { background: #fef3c7; }
.tag-partial { background: #ffedd5; }
.tag-searched { background: #dcfce7; }
.status-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.status-buttons .button { min-height: 44px; font-size: 0.95rem; }

.area-label {
    background: rgba(255, 255, 255, 0.85);
    border: 0;
    box-shadow: none;
    font-weight: 600;
    padding: 1px 6px;
}
.area-label::before { display: none; }

/* Guidance */
.guidance {
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: #f1f5f3;
}
.guidance p { margin: 4px 0 0; }
.guidance-main { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; }
.guidance-arrow {
    display: inline-block;
    font-size: 2rem;
    line-height: 1;
    color: #1d4ed8;
    transition: transform 0.2s linear;
}

/* Notes & photos */
.attachments { margin-top: 16px; border-top: 1px solid #e3e7e4; padding-top: 4px; }
.attachments h3 { font-size: 1rem; margin: 8px 0; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.photo-grid figcaption { display: flex; justify-content: space-between; gap: 4px; }
.note { padding: 6px 0; border-bottom: 1px solid #eef1ef; }
.note p { margin: 2px 0; }
.note-form { display: flex; gap: 6px; align-items: flex-end; margin: 8px 0; }
.note-form textarea {
    flex: 1;
    font: inherit;
    padding: 8px 10px;
    border: 1px solid #b8c2bc;
    border-radius: 8px;
}
.file-button { display: inline-flex; align-items: center; min-height: var(--touch); cursor: pointer; }
.finding-icon.is-dismissed { opacity: 0.6; }
.link-button.small { font-size: 0.875rem; }

/* Waypoint symbols */
.wp-icon { background: none; border: 0; }
.wp-icon svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.wp-icon.is-selected svg { transform: scale(1.3); }
.wp-icon.is-others { opacity: 0.55; } /* someone else's research point */
.save-as-menu { margin-top: 8px; }

@media (min-width: 768px) {
    .sheet {
        left: 12px;
        right: auto;
        bottom: 12px;
        width: 400px;
        border-radius: var(--radius);
    }
    .sheet-directions { width: 400px; bottom: 12px; }
    .action-bar {
        left: 12px;
        right: auto;
        bottom: 12px;
        width: 400px;
        border-radius: var(--radius);
    }
    .map-page .leaflet-bottom.leaflet-right { bottom: 0; }
    .search-panel { left: auto; right: 12px; top: 60px; width: 440px; border-radius: var(--radius); }
}

/* Landing page: the whole mountain scene, main logo in the sky, Log in under it */
.landing-page {
    background: #eacba6 url('../images/home-bg.jpg') no-repeat 35% bottom / cover;
}
.landing {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 28px;
    padding: 9vh 16px 24px;
}
.landing-logo { width: min(90vw, 640px); height: auto; }
.landing-login { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 40px; font-size: 1.1rem; text-decoration: none; }

/* Projects page: the same scene "zoomed in" on the hiker. The project list is plain text at the top left, over the sky.
   A soft cream glow behind the letters keeps them readable wherever the picture is busier. */
.projects-page { background: transparent; }
.projects-page::before,
.projects-page::after {
    content: '';
    position: fixed; /* fixed layers, not background-attachment: iPhones ignore that */
    inset: 0;
    pointer-events: none;
}
.projects-page::before { z-index: -2; background: #eacba6; } /* the cream paper colour, full page */
.projects-page::after { z-index: -1; background: url('../images/projects-bg.jpg') no-repeat right bottom / cover; } /* the picture on top */
.projects-page .page { margin: 0; }
.projects-page h1,
.projects-page .row-link strong,
.projects-page .row-link .muted,
.projects-page .muted {
    text-shadow: 0 0 3px #f5e3c4, 0 0 7px #f5e3c4, 0 0 14px #f5e3c4, 0 0 22px rgba(245, 227, 196, 0.9);
}
.projects-page .muted { color: #3e3a2c; }
.projects-page .row { border-bottom-color: rgba(80, 55, 20, 0.28); }
.projects-page .row-link:hover { background: rgba(255, 244, 222, 0.35); }
@media (min-width: 900px) {
    /* A wide screen: the wide picture of the hiker fills the page, and the list moves in from the edge, over the sky. */
    .projects-page::after { background-image: url('../images/projects-bg-wide.jpg'); background-position: right bottom; }
    .projects-page .page { padding-left: clamp(24px, 16vw, 280px); }
}

/* ☰ menu: who's logged in at the top, then a short menu; expedition things one level down */
.drawer-me { display: flex; align-items: center; gap: 12px; padding-right: 44px; margin-bottom: 8px; }
.drawer-me > div { display: flex; flex-direction: column; }
.avatar-md { width: 48px; height: 48px; font-size: 1rem; }
.drawer-menu { display: flex; flex-direction: column; gap: 4px; }
.drawer-menu > a, .drawer-menu > .link-button, .drawer-menu form .link-button {
    display: flex; align-items: center; min-height: 40px; padding: 0; text-align: left; color: var(--ink); text-decoration: none; font-size: 1rem;
}
.drawer-menu .menu-back { color: var(--muted); font-weight: 600; }
.drawer-exp { margin-top: 10px; }

/* Outbox: saved on the phone, waiting for signal */
.chip-button { border: 0; cursor: pointer; font: inherit; min-height: 0; }
.outbox-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
.outbox-row p { margin: 2px 0 0; }
.msg-waiting { opacity: 0.75; border: 1px dashed #9ca3af; }

/* Track recording */
.action-menu .menu-stop { color: #dc2626; font-weight: 600; }

/* Reports */
.report-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.report-tab {
    padding: 6px 10px; border-radius: 999px; background: #eef1ef; color: var(--ink);
    font-size: 0.85rem; text-decoration: none;
}
.report-tab.is-current { background: var(--accent); color: #fff; }
.report-day { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.report-day input[type=date] { min-height: 40px; padding: 0 8px; border: 1px solid #c9d1cc; border-radius: 8px; font: inherit; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-bottom: 16px; }
.report-table th, .report-table td { padding: 6px 6px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; }
.report-table th { font-weight: 600; color: var(--muted); }
.report-card { padding: 8px 10px; margin-bottom: 8px; border-radius: var(--radius); background: #f6f7f6; }
.report-card.is-significant { border-left: 4px solid #dc2626; }
.report-card p { margin: 2px 0; }
.report-card-head .tag { margin-right: 4px; }
@media print {
    .no-print, .topbar { display: none !important; }
    .report-card { break-inside: avoid; }
}

/* AI pop-up */
.ai-reply { background: #fff; border: 1px solid #e5e7eb; }
.ai-panel .board-list { padding-bottom: 8px; }

/* Offline map (☰ → Expeditions) */
.offline-box { margin: 10px 0 4px; padding: 10px; border-radius: var(--radius); background: #f3f5f4; }
.offline-box p { margin: 4px 0; }
.offline-box progress { width: 100%; height: 10px; }

/* PM's project setup checklist (☰ → Expeditions) */
.setup-box { margin: 6px 0 10px; padding: 8px 10px; border-radius: var(--radius); background: #f3f5f4; }
.setup-box summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.setup-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 0; border: 0; background: none; text-align: left; color: var(--ink); cursor: pointer; }
.setup-item.is-done { cursor: default; }
.setup-mark { width: 20px; text-align: center; font-weight: 700; color: #b45309; }
.setup-item.is-done .setup-mark { color: #15803d; }
.setup-item:not(.is-done) .setup-text > span:first-child { text-decoration: underline; }

/* Map legend */
.legend h3 { margin: 12px 0 4px; font-size: 0.95rem; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 10px; min-height: 30px; font-size: 0.9rem; }
.legend li > svg, .legend li > span:first-child { flex: none; }
.lg-line { display: inline-block; width: 28px; height: 0; }
.lg-area { display: inline-block; width: 24px; height: 16px; border: 3px solid; border-radius: 3px; }
.lg-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.legend .lg-small { width: 24px; height: 24px; font-size: 0.6rem; }

/* Terms of Service: the scrolling box above the "I agree" tick. */
.terms-box { height: 50vh; overflow-y: auto; border: 1px solid #c9d1cc; border-radius: var(--radius); padding: 0 14px; background: var(--paper); }
.form input[type=checkbox]:disabled { opacity: 0.4; }

/* Admin users list: tight rows with small buttons, so a long list stays short. */
.user-row { padding: 6px 0; gap: 6px; }
.user-row form { margin: 0; }
.user-buttons { display: flex; gap: 4px; }
.button.button-mini { display: inline-flex; align-items: center; min-height: 28px; padding: 0 8px; border-radius: 6px; font-size: 0.8rem; text-decoration: none; }

/* "? AI" help button (above the layers button) and its small box. */
.help-ai-button { min-height: 0; width: 44px; height: 34px; padding: 0; border: 0; border-radius: 5px; background: #fff; color: var(--ink); font: 700 13px sans-serif; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4); cursor: pointer; }
.help-list { max-height: 38vh; overflow-y: auto; touch-action: pan-y; cursor: auto; margin: 4px 0 6px; user-select: text; }
.help-q { font-weight: 600; margin-top: 8px; }
.help-a { margin-top: 2px; }
.help-box input[type=text] { width: 100%; margin-bottom: 4px; font-size: 16px; }