/* ============================================================
   RVA History Scout design system (shared with Wellness Wingman)
   Type:   Roboto Slab (headings)  ·  Inter (body)
   Color:  cool light canvas, glass cards, ink text,
           one brand gradient (indigo → rose) for the primary
           action, active tabs and the hero card.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --head: 'Roboto Slab', 'Rockwell', Georgia, serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --bg: #f3f2f8;
  --card: #ffffff;
  --card-2: #f7f6fb;
  --text: #17132b;
  --muted: #6b6685;
  --line: #e4e1ee;
  --na: #e8e6f0;

  --brand-a: #5b3df5;
  --brand-b: #e0457b;
  --brand: var(--brand-a);
  --brand-soft: #efeafe;
  --brand-grad: linear-gradient(135deg, #5b3df5 0%, #9b3fd6 55%, #e0457b 100%);
  --good: #1f9d6a;
  --danger: #d8384c;
  --warn-bg: #fff1c2; --warn-t: #7a5a00;

  --glass: rgba(255,255,255,.72);
  --glass-2: rgba(255,255,255,.55);
  --glass-edge: rgba(255,255,255,.85);
  --glass-edge-2: rgba(255,255,255,.6);
  --ambient: radial-gradient(900px 600px at 8% -10%, rgba(91,61,245,.14), transparent 60%),
             radial-gradient(800px 600px at 100% 0%, rgba(224,69,123,.12), transparent 60%);
  --r: 18px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(23,19,43,.04), 0 8px 24px -12px rgba(23,19,43,.12);

  --top-h: 60px;
  --sheet-peek: 96px;
  --sidebar-w: 380px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131120; --card: #1c1a2e; --card-2: #232038; --text: #f2f0fa; --muted: #a29dbd; --line: #2f2b45; --na: #2b2840;
    --brand-a: #8b74ff; --brand-b: #ff6b9c; --brand: #a08cff; --brand-soft: #2a2350;
    --good: #4cc48f; --danger: #ff7b8a; --warn-bg: #3f3712; --warn-t: #f6df86;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    --glass: rgba(34,30,56,.62); --glass-2: rgba(44,39,72,.55); --glass-edge: rgba(255,255,255,.10); --glass-edge-2: rgba(255,255,255,.07);
    --ambient: radial-gradient(900px 600px at 8% -10%, rgba(139,116,255,.20), transparent 60%),
               radial-gradient(800px 600px at 100% 0%, rgba(255,107,156,.14), transparent 60%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131120; --card: #1c1a2e; --card-2: #232038; --text: #f2f0fa; --muted: #a29dbd; --line: #2f2b45; --na: #2b2840;
  --brand-a: #8b74ff; --brand-b: #ff6b9c; --brand: #a08cff; --brand-soft: #2a2350;
  --good: #4cc48f; --danger: #ff7b8a; --warn-bg: #3f3712; --warn-t: #f6df86;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  --glass: rgba(34,30,56,.62); --glass-2: rgba(44,39,72,.55); --glass-edge: rgba(255,255,255,.10); --glass-edge-2: rgba(255,255,255,.07);
  --ambient: radial-gradient(900px 600px at 8% -10%, rgba(139,116,255,.20), transparent 60%),
             radial-gradient(800px 600px at 100% 0%, rgba(255,107,156,.14), transparent 60%);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 var(--body); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; overflow: hidden; }
h1, h2, h3, .slab { font-family: var(--head); font-weight: 700; letter-spacing: -0.005em; line-height: 1.15; margin: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--brand); }
button { font: inherit; color: inherit; cursor: pointer; }
svg.ic, .lucide { flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); font-weight: 700; }
.spacer { flex: 1; }
.min0 { min-width: 0; }
[hidden] { display: none !important; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--glass); width: 100%;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 10px 13px; min-height: 44px;
}
textarea { resize: vertical; min-height: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type="range"] { accent-color: var(--brand); min-height: 0; padding: 0; border: 0; background: none; }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--brand); padding: 0; }

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 1100;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(243,242,248,.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: rgba(19,17,32,.85); } }
:root[data-theme="dark"] .top { background: rgba(19,17,32,.85); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.brand-mark { border-radius: 9px; flex: none; }
.brand-name { font-family: var(--head); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.top-actions { display: flex; gap: 6px; align-items: center; }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; z-index: 0; background: #e6e3ef; }
.leaflet-container { font-family: var(--body); }
.leaflet-top { top: calc(var(--top-h) + env(safe-area-inset-top) + 10px); }
.leaflet-control-zoom { border: 1.5px solid var(--line) !important; box-shadow: var(--shadow) !important; border-radius: var(--r-sm) !important; overflow: hidden; }
.leaflet-control-zoom a { background: var(--card) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { display: none; }
.leaflet-bottom.leaflet-right { bottom: calc(var(--sheet-peek) + 8px); }

/* POI markers */
.poi-marker { width: 36px; height: 36px; margin: -18px 0 0 -18px !important; }
.poi-marker .pin {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--card); border: 2.5px solid var(--brand); box-shadow: var(--shadow); color: var(--brand);
  display: grid; place-items: center;
}
.poi-marker .pin svg { transform: rotate(45deg); width: 17px; height: 17px; }
.poi-marker.is-mine .pin { border-color: var(--brand-b); color: var(--brand-b); }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow); background: var(--card); color: var(--text); }
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content { margin: 12px 14px; font-size: .92rem; font-family: var(--body); }
.popup-title { font-family: var(--head); font-weight: 700; font-size: 1rem; }
.popup-link { display: inline-block; margin-top: 6px; font-weight: 600; }

/* ---------- compare slider ---------- */
.compare { position: fixed; top: calc(var(--top-h) + env(safe-area-inset-top)); bottom: 0; left: 50%; width: 0; z-index: 900; pointer-events: none; }
.compare-line { position: absolute; top: 0; bottom: 0; left: -1.5px; width: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.compare-handle {
  position: absolute; top: 44%; left: -25px; width: 50px; height: 50px; border-radius: 50%;
  border: 3px solid #fff; background: var(--brand-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px -8px #5b3df5;
  pointer-events: auto; cursor: ew-resize; touch-action: none;
}
.compare-bar { position: fixed; left: 12px; right: 12px; top: calc(var(--top-h) + env(safe-area-inset-top) + 10px); z-index: 950; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.compare-pick { pointer-events: auto; display: flex; align-items: center; gap: 6px; max-width: 48%; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--glass-edge-2); border-radius: 999px; padding: 4px 6px 4px 12px; box-shadow: var(--shadow); font-size: .72rem; font-weight: 700; color: var(--muted); font-family: var(--head); }
.compare-pick select { width: auto; min-width: 0; max-width: 100%; min-height: 30px; padding: 2px 26px 2px 8px; border-radius: 999px; font-size: .82rem; font-weight: 600; font-family: var(--body); background: var(--card); border-color: transparent; text-overflow: ellipsis; }
.compare-pick.right { flex-direction: row-reverse; padding: 4px 12px 4px 6px; }

/* ---------- banners (align mode, add place) ---------- */
.banner {
  position: fixed; left: 12px; right: 12px; top: calc(var(--top-h) + env(safe-area-inset-top) + 10px); z-index: 1050;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--glass-edge-2); border-radius: var(--r); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
  padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
}
.banner-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; flex: none; }
.banner-text { display: flex; flex-direction: column; gap: 2px; font-size: .84rem; color: var(--muted); flex: 1 1 200px; min-width: 0; }
.banner-text strong { color: var(--text); font-family: var(--head); font-size: 1rem; }
.banner-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.opacity-inline { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.banner-status { flex-basis: 100%; margin: 0; font-size: .82rem; color: var(--brand); font-weight: 600; }
.opacity-inline input { width: 90px; }

/* ---------- bottom sheet / sidebar ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--glass-edge-2); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px -20px rgba(23,19,43,.4);
  display: flex; flex-direction: column;
  height: 55vh; max-height: calc(100vh - var(--top-h) - env(safe-area-inset-top) - 8px);
  transition: height .28s cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}
@supports not (backdrop-filter: blur(1px)) { .sheet, .banner, .modal { background: var(--card); } }
.sheet[data-state="peek"] { height: var(--sheet-peek); }
.sheet[data-state="half"] { height: 55vh; }
.sheet[data-state="full"] { height: calc(100vh - var(--top-h) - env(safe-area-inset-top) - 8px); }
.sheet.is-dragging { transition: none; }
.sheet-grip { background: none; border: none; height: 22px; display: grid; place-items: center; flex: none; touch-action: none; }
.sheet-grip span { width: 42px; height: 5px; border-radius: 999px; background: var(--line); }

.tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 0 8px 6px; flex: none; }
.tabbar .tab { background: none; border: 0; padding: 2px 0; font-size: .72rem; font-weight: 500; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabbar .tab .pillbg { display: flex; align-items: center; justify-content: center; width: min(56px, 100%); height: 30px; border-radius: 999px; transition: background .15s; }
.tabbar .tab.on { color: var(--brand); font-weight: 700; }
.tabbar .tab.on .pillbg { background: var(--brand-soft); }

.sheet-body { flex: 1; overflow: auto; padding: 4px 12px 12px; overscroll-behavior: contain; }
.tab-panel { display: none; }
.tab-panel.on { display: block; }
.sheet-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; font-size: .68rem; color: var(--muted); border-top: 1px solid var(--line); }
.sheet-foot a { color: inherit; }
.attrib { text-align: right; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--glass-edge-2); margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.section-title svg { color: var(--brand); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 2px 8px; }
.list-head select { width: auto; min-height: 36px; padding: 4px 28px 4px 10px; font-size: .85rem; background: var(--card); }
.search { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 0 10px; min-height: 36px; max-width: 50%; }
.search svg { color: var(--muted); width: 16px; height: 16px; }
.search input { border: 0; background: none; padding: 0; min-height: 0; font-size: .9rem; }
.empty { color: var(--muted); text-align: center; padding: 24px 10px; font-size: .9rem; }

/* hero card: the map currently showing */
.hero-card { background: var(--brand-grad); color: #fff; border: 0; box-shadow: 0 16px 40px -18px #5b3df5; }
.hero-card .eyebrow, .hero-card .muted { color: rgba(255,255,255,.85); }
.hero-card h2 { font-size: 1.2rem; color: #fff; }
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.hero-card .icon-btn.ghost { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; width: 36px; height: 36px; }
.slider-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin: 6px 0 10px; }
.slider-row output { min-width: 3.2ch; text-align: right; font-family: var(--head); font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-card .chip { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; }
.hero-card .chip.on { background: #fff; color: var(--brand-a); border-color: #fff; }

/* ---------- buttons, chips ---------- */
.btn { border: 1.5px solid var(--line); background: var(--card); border-radius: var(--r-sm); padding: 9px 16px; min-height: 44px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; }
a.btn { text-decoration: none; }
.btn.primary { background: var(--brand-grad); border: 0; color: #fff; font-weight: 700; box-shadow: 0 8px 20px -10px #5b3df5; transition: transform .1s; }
.btn.primary:active { transform: scale(.98); }
.btn.wide { width: 100%; min-height: 52px; font-size: 1.05rem; border-radius: 16px; }
.btn.sm { min-height: 38px; padding: 6px 13px; font-size: .9rem; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: none; }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.signed-in { background: var(--card); color: var(--text); border: 1.5px solid var(--line); box-shadow: none; max-width: 150px; }
.btn.signed-in span { overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-sm); width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.icon-btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.actions.end { justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; min-height: 36px; font-size: .86rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.chip svg { width: 15px; height: 15px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg-mini { display: inline-flex; background: var(--card-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-mini button { border: 0; background: none; border-radius: 8px; padding: 5px 9px; color: var(--muted); display: inline-flex; align-items: center; }
.seg-mini button svg { width: 15px; height: 15px; }
.seg-mini button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.icn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.icn svg { width: 20px; height: 20px; }

/* ---------- lists ---------- */
.map-list, .poi-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.map-item {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1.5px solid transparent; border-radius: 14px; padding: 8px; cursor: pointer; box-shadow: var(--shadow);
}
.map-item:hover { border-color: var(--line); }
.map-item.is-active { border-color: var(--brand); }
.map-item img, .map-item .thumb-fallback { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.map-item .title { font-weight: 600; font-size: .95rem; line-height: 1.25; }
.map-item .meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.badge { font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); font-weight: 700; margin-top: 4px; margin-right: 4px; display: inline-block; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.warn { background: var(--warn-bg); color: var(--warn-t); }
.map-item .toggle { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card-2); display: grid; place-items: center; color: var(--muted); }
.map-item .toggle svg { width: 16px; height: 16px; }
.map-item.is-active .toggle { background: var(--brand); color: #fff; border-color: var(--brand); }

.poi-item { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; background: var(--card); border: 1.5px solid transparent; border-radius: 14px; padding: 8px 10px; cursor: pointer; box-shadow: var(--shadow); }
.poi-item:hover { border-color: var(--line); }
.poi-item .title { font-weight: 600; font-size: .95rem; }
.poi-item .meta { font-size: .78rem; color: var(--muted); }

/* timeline */
.dual-range { position: relative; height: 32px; margin: 6px 0 2px; }
.dual-range input { position: absolute; left: 0; right: 0; top: 0; width: 100%; pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual-range input::-webkit-slider-runnable-track { height: 4px; background: var(--line); border-radius: 2px; }
.dual-range input::-moz-range-track { height: 4px; background: var(--line); border-radius: 2px; }
.dual-range input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: var(--shadow); }
.dual-range input::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: var(--shadow); }
.check { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-size: .9rem; color: var(--muted); }

/* add tab */
.big-action {
  width: 100%; display: grid; grid-template-columns: 44px 1fr 20px; gap: 12px; align-items: center; text-align: left;
  background: var(--card); border: 1.5px solid transparent; border-radius: var(--r); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.big-action:hover { border-color: var(--brand); }
.big-action .icn { width: 44px; height: 44px; }
.big-action strong { display: block; font-family: var(--head); font-size: 1rem; }
.big-action small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.big-action .chev { color: var(--muted); }

/* ---------- modals ---------- */
.modal { border: 0; padding: 0; width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92vh; background: transparent; color: var(--text); }
.modal::backdrop { background: rgba(23,19,43,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-body {
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--glass-edge-2); box-shadow: inset 0 1px 0 var(--glass-edge), 0 24px 60px -24px rgba(0,0,0,.5);
  border-radius: 24px 24px 0 0; padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; max-height: 92vh; overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
@media (min-width: 700px) {
  .modal { margin: auto; width: min(560px, calc(100vw - 32px)); }
  .modal-wide { width: min(720px, calc(100vw - 32px)); }
  .modal-body { border-radius: 24px; }
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid2 > * { min-width: 0; }
.status { border-radius: var(--r-sm); padding: 10px 14px; font-size: .9rem; background: var(--brand-soft); color: var(--brand); }
.status.ok { background: #e3f5ec; color: #14704a; }
.status.err { background: #ffbcae; color: #8f2213; }

.file-drop { position: relative; border: 2px dashed var(--line); border-radius: var(--r); background: var(--card-2); min-height: 120px; display: grid; place-items: center; overflow: hidden; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.file-drop-inner { text-align: center; padding: 16px; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.file-drop-inner small { color: var(--muted); max-width: 320px; }
.file-drop img { width: 100%; max-height: 220px; object-fit: contain; pointer-events: none; }
.file-drop.has-file .file-drop-inner { display: none; }
.file-btn { position: relative; overflow: hidden; color: var(--brand); border-color: var(--brand); align-self: flex-start; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.progress { position: relative; height: 28px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--brand-grad); transition: width .2s; }
.progress-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }

.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-strip:empty { display: none; }
.photo-strip .ph { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--card-2); border: 1px solid var(--line); }
.photo-strip .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo-strip .ph button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(23,19,43,.65); color: #fff; display: grid; place-items: center; }
.photo-strip .ph button svg { width: 12px; height: 12px; }

.poi-view-photos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.poi-view-photos:empty { display: none; }
.poi-view-photos img { height: 220px; max-width: 100%; border-radius: 12px; scroll-snap-align: start; flex: none; object-fit: cover; cursor: zoom-in; }
.poi-view-notes { white-space: pre-wrap; line-height: 1.5; }

.basemap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.basemap-opt { border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--card-2); padding: 12px; text-align: left; font-weight: 600; display: flex; flex-direction: column; gap: 3px; }
.basemap-opt small { color: var(--muted); font-weight: 500; }
.basemap-opt.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* ---------- old photos (Yesterdays) ---------- */
.switch { width: 46px; height: 28px; border-radius: 999px; background: var(--line); border: 0; position: relative; padding: 0; flex: none; transition: background .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch.on { background: var(--brand); }
.switch.on .knob { transform: translateX(18px); }
.center { text-align: center; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card-2); border: 1.5px solid transparent; padding: 0; cursor: pointer; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell:hover, .photo-cell.is-hot { border-color: var(--brand); }
.photo-cell .yr { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 999px; background: rgba(23,19,43,.7); color: #fff; font-size: .68rem; font-weight: 700; font-family: var(--head); }
.photo-marker { width: 28px; height: 28px; margin: -14px 0 0 -14px !important; }
.photo-marker .cam { position: relative; width: 28px; height: 28px; border-radius: 50%; background: var(--card); border: 2px solid var(--brand-b); color: var(--brand-b); display: grid; place-items: center; box-shadow: var(--shadow); }
.photo-marker .cam svg { width: 14px; height: 14px; }
.photo-marker .cone { position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 34px solid color-mix(in srgb, var(--brand-b) 35%, transparent); transform-origin: 50% 100%; transform: translate(-50%, -100%) rotate(var(--dir, 0deg)); pointer-events: none; }
.photo-marker.is-hot .cam { border-color: var(--brand); color: var(--brand); transform: scale(1.15); }
.photo-marker.is-hot .cone { border-bottom-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.photo-view-img { display: block; border-radius: 14px; overflow: hidden; background: var(--card-2); }
.photo-view-img img { display: block; width: 100%; max-height: 60vh; object-fit: contain; }
.popup-photo { display: flex; gap: 10px; align-items: center; }
.popup-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; }
.leaflet-popup-content { min-width: 200px; }
.attrib-photos { display: block; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sheet-peek) + 16px); transform: translate(-50%, 20px); z-index: 1200;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* distortable image toolbar */
.leaflet-toolbar-0 { border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }

/* ---------- desktop: the panel sits beside the map ---------- */
@media (min-width: 900px) {
  .sheet {
    top: calc(var(--top-h) + env(safe-area-inset-top)); bottom: 0; left: 0; right: auto; width: var(--sidebar-w);
    height: auto !important; max-height: none; border-radius: 0; border-right: 1px solid var(--glass-edge-2); border-top: 0; box-shadow: none; transition: none;
  }
  .sheet-grip { display: none; }
  .tabbar { padding-top: 12px; }
  .leaflet-left { left: var(--sidebar-w); }
  .leaflet-bottom.leaflet-right { bottom: 12px; }
  .compare { left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2); }
  .compare-bar { left: calc(var(--sidebar-w) + 12px); }
  .banner { left: calc(var(--sidebar-w) + 12px); max-width: 760px; }
  .toast { bottom: 24px; left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2); }
}
@media (max-width: 600px) {
  .brand-sub { display: none; }
  .brand-name { font-size: 1.1rem; }
  .btn.signed-in { max-width: 110px; }
}
@media (max-width: 480px) {
  /* Four buttons up top: sign-in becomes an icon so the name is not clipped */
  #btn-auth { width: 42px; padding: 0; border-radius: var(--r-sm); max-width: none; }
  #btn-auth span { display: none; }
  #btn-auth svg { width: 20px; height: 20px; }
}
@media (max-width: 360px) {
  .top-actions .icon-btn { width: 38px; height: 38px; }
  .brand-name { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
