/* Layout concept: the map is the whole screen; a pull-up tray holds what's close, and every meal you log prints as a till receipt. */
:root {
  --bg: #FBF8FC;
  --surface: #FFFFFF;
  --sunk: #F1EBF3;
  --line: #E0D6E4;
  --ink: #2B1433;
  --muted: #6E5C77;
  --chilli: #D81E4A;
  --chilli-ink: #FFFFFF;
  --mustard: #F7B801;
  --mustard-ink: #2B1433;
  --paper: #FFFDF2;
  --paper-ink: #2B2520;
  --paper-rule: #B9B09C;
  --shadow: 0 -6px 28px rgba(43, 20, 51, .16);
  --open: #187A43;
  --soon: #A35F00;
  --display: "Bagel Fat One", "Arial Black", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --nav-h: 60px;
  --panel-w: 430px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #160D1A;
    --surface: #211526;
    --sunk: #2E2035;
    --line: #3E2E46;
    --ink: #F5EEF8;
    --muted: #B3A2BC;
    --chilli: #FF5277;
    --chilli-ink: #22040C;
    --mustard: #FFC933;
    --mustard-ink: #2B1433;
    --paper: #F4EFDF;
    --paper-ink: #2B2520;
    --paper-rule: #A49B85;
    --shadow: 0 -6px 28px rgba(0, 0, 0, .5);
    --open: #5AD594;
    --soon: #F4B652;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--body);
  overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--chilli); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

#stage { position: fixed; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: var(--sunk); z-index: 0; }
#noMap { position: absolute; left: 16px; right: 16px; top: 96px; z-index: 5; padding: 12px; border-radius: 12px; background: var(--surface); color: var(--muted); text-align: center; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.88) saturate(.55); }
}
.leaflet-container { font-family: var(--body); background: var(--sunk); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: inherit; }
.leaflet-top { top: calc(env(safe-area-inset-top, 0px) + 70px); }

/* Top bar */
#top {
  position: absolute; z-index: 30; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px));
}
.wordmark { font: 400 21px/1 var(--display); color: var(--chilli); paint-order: stroke fill; -webkit-text-stroke: 4px var(--surface); }
body:not([data-tab="map"]) #top, body:not([data-tab="map"]) #locate { display: none; }
#searchForm { flex: 1; min-width: 0; }
#q {
  width: 100%; height: 44px; padding: 0 14px; font-size: 16px;
  border: 0; border-radius: 22px; background: var(--surface); box-shadow: 0 2px 12px rgba(43, 20, 51, .2);
}
#q::placeholder { color: var(--muted); }
.results {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden auto;
  max-height: 46vh;
}
#searchResults { position: absolute; left: 12px; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 60px); box-shadow: 0 8px 28px rgba(43, 20, 51, .25); }
.results button {
  display: block; width: 100%; padding: 10px 14px; text-align: left; background: none;
  border: 0; border-bottom: 1px solid var(--line);
}
.results button:last-child { border-bottom: 0; }
.results button:hover { background: var(--sunk); }
.results b { display: block; font-weight: 600; }
.results span { display: block; font-size: 13px; color: var(--muted); }
.results .tag { display: inline-block; margin-right: 6px; font: 500 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--chilli); }
.results p { padding: 12px 14px; color: var(--muted); }

/* Floating location button */
.fab {
  position: absolute; z-index: 15; right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--sheet-visible, 200px) + var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--surface); color: var(--ink); box-shadow: 0 2px 12px rgba(43, 20, 51, .28);
}
.fab.on { color: var(--chilli); }
.fab.busy svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.ic { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Tray */
#sheet {
  position: absolute; z-index: 20; left: 0; right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  transform: translateY(var(--sheet-y, 50%)); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
#sheet.dragging { transition: none; }
#grab { flex: none; height: 26px; padding: 0; display: grid; place-items: center; background: none; border: 0; touch-action: none; }
#grab span { width: 42px; height: 5px; border-radius: 3px; background: var(--line); }
#sheetScroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px)); -webkit-overflow-scrolling: touch; }

.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.list-head > div { min-width: 0; }
h1.title { font: 400 25px/1.1 var(--display); text-wrap: balance; overflow-wrap: anywhere; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px;
  padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn.primary { background: var(--chilli); border-color: var(--chilli); color: var(--chilli-ink); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.danger { color: var(--chilli); }
.btn[disabled] { opacity: .5; }
.btn .ic { width: 18px; height: 18px; }
.iconbtn { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--chilli); color: var(--chilli-ink); }
.backbtn { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }

.chips { display: flex; gap: 6px; overflow-x: auto; margin: 10px -16px 0; padding: 2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip-spot { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 3px 10px; border-radius: 14px; border: 0; background: var(--sunk); font-size: 13px; }

.callout { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--sunk); }
.note { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: var(--sunk); font-size: 13px; }
.note button { flex: none; padding: 4px 0; background: none; border: 0; font-weight: 600; color: var(--chilli); }
.linkbtn { padding: 0; background: none; border: 0; font-weight: 600; color: var(--chilli); }

.rows { list-style: none; margin: 8px 0 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.place-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 0; background: none; border: 0; text-align: left; }
.place-row .txt { flex: 1; min-width: 0; }
.place-row b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.place-row .sub { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.place-row .dist { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.place-row .dist b { font-weight: 700; }
.place-row .dist span { display: block; font-size: 12px; color: var(--muted); }
.ex { display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 4px; background: var(--sunk); font: 500 10px/16px var(--mono); letter-spacing: .04em; color: var(--muted); vertical-align: 1px; }

/* State marks: an empty ring is still to try, a filled mustard dot with a tick means been */
.mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.mark.want { background: var(--surface); box-shadow: inset 0 0 0 3px var(--chilli); }
.mark.been { background: var(--mustard); color: var(--mustard-ink); }
.mark.been svg { width: 13px; height: 13px; stroke-width: 3.2; }

/* Map pins */
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 2px; transform: rotate(-45deg); display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: scale .15s; }
.pin::after { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.pin.want { background: #D81E4A; }
.pin.want::after { background: #fff; }
.pin.been { background: #F7B801; }
.pin.been::after { background: #2B1433; }
.pin.sel { scale: 1.3; }
.cluster { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #2B1433; color: #fff; border: 3px solid #F7B801; font: 400 15px/1 var(--display); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.ppin { position: relative; width: 46px; height: 46px; transition: scale .15s; transform-origin: 50% 120%; }
.ppin img { display: block; width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 3px solid #F7B801; background: #F7B801; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.ppin::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -7px; border: 7px solid transparent; border-top: 9px solid #F7B801; border-bottom: 0; }
.ppin.want img { border-color: #D81E4A; background: #D81E4A; }
.ppin.want::after { border-top-color: #D81E4A; }
.ppin.sel { scale: 1.25; z-index: 2; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #1F7AE0; border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(31, 122, 224, .22); }
.spot-dot { width: 16px; height: 16px; rotate: 45deg; background: #2B1433; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .5); }

/* Place detail */
.detail-head { display: flex; gap: 10px; align-items: flex-start; }
.detail-head > div { min-width: 0; flex: 1; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.actions .wide { grid-column: 1 / -1; }
.ledger { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 14px; background: var(--line); border-block: 1px solid var(--line); }
.ledger div { padding: 10px 2px; background: var(--bg); }
.ledger dt { font-size: 12px; color: var(--muted); }
.ledger dd { margin: 0; font: 500 18px/1.3 var(--mono); }
.ledger dl { margin: 0; }
.block { margin-top: 16px; }
.block h2, .form-h { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.block p { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.player-slot { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.player-slot:empty { display: none; }
.player-slot iframe { display: block; width: 100%; max-width: 325px; aspect-ratio: 9 / 16; max-height: 70vh; border: 0; border-radius: 12px; background: #000; }
.tiktok { display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; }
.tiktok img { width: 54px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--sunk); flex: none; }

/* Till receipts */
.receipts { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.receipt {
  --zig: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% 100% / 14px 100%;
  background: var(--paper); color: var(--paper-ink);
  font: 400 13px/1.5 var(--mono); padding: 14px 14px 24px;
  -webkit-mask: var(--zig); mask: var(--zig);
  box-shadow: inset 0 0 0 1px rgba(43, 37, 32, .06);
}
.receipt-wrap { filter: drop-shadow(0 2px 3px rgba(43, 20, 51, .22)); }
.rc-photos { display: flex; gap: 6px; overflow-x: auto; margin: -2px 0 12px; scrollbar-width: none; }
.rc-photos button { flex: none; padding: 0; border: 0; background: var(--paper-rule); border-radius: 4px; overflow: hidden; }
.rc-photos img { display: block; height: 124px; width: auto; min-width: 90px; max-width: 220px; object-fit: cover; }
.rc-top { display: flex; justify-content: space-between; gap: 10px; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.rc-items { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--paper-rule); }
.rc-items li { display: flex; justify-content: space-between; gap: 14px; }
.rc-items span:first-child { min-width: 0; overflow-wrap: anywhere; }
.rc-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--paper-rule); font-weight: 500; font-size: 17px; }
.rc-note { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.rc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; }
.rc-foot button { padding: 2px 0; background: none; border: 0; color: inherit; text-decoration: underline; font: inherit; }
.stars { letter-spacing: 1px; }

/* Full pages */
#page {
  position: absolute; z-index: 25; inset: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)) 0;
  overflow-y: auto; background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 18px) max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
}
#page > * + * { margin-top: 14px; }
.lede { color: var(--muted); }
.card { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.card h2 { font-size: 15px; font-weight: 700; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; height: 132px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; text-align: center; min-width: 0; }
.bar i { display: block; min-height: 2px; background: var(--chilli); border-radius: 3px 3px 0 0; }
.bar.now i { background: var(--mustard); }
.bar em { font: 400 10px var(--mono); font-style: normal; color: var(--muted); margin-bottom: 2px; white-space: nowrap; }
.bar span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-row dt { font-size: 12px; color: var(--muted); }
.stat-row dd { margin: 0; font: 500 19px/1.3 var(--mono); }
.stat-row div { min-width: 0; }
.stat-row { margin: 0; }
.month-h { margin-top: 20px !important; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.visit-row { width: 100%; display: flex; gap: 12px; align-items: center; padding: 10px 0; background: none; border: 0; text-align: left; }
.visit-row .thumb { flex: none; width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--sunk); }
.visit-row .txt { flex: 1; min-width: 0; }
.visit-row b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.visit-row .sub { display: block; font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.visit-row .amt { flex: none; font: 500 15px var(--mono); }
.sort-item { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.sort-item img { flex: none; width: 54px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--sunk); }
.sort-item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sort-item p { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sort-item .row { display: flex; flex-wrap: wrap; gap: 6px; }
.sort-item .btn { min-height: 34px; padding: 0 10px; font-size: 13px; border-radius: 9px; }

.bring summary { font-size: 15px; font-weight: 700; cursor: pointer; }
.bring[open] summary { margin-bottom: 4px; }
.ai-card { border-color: var(--chilli); }
.progress { height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--chilli); transition: width .2s; }
.sugg { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--sunk); }
.sugg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sugg-top b { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.sugg .row { margin-top: 6px; }
.sugg p { -webkit-line-clamp: unset; display: block; }
.conf { flex: none; padding: 0 7px; border-radius: 9px; font: 500 11px/18px var(--mono); }
.conf.high { background: var(--mustard); color: var(--mustard-ink); }
.conf.medium { background: var(--surface); color: var(--ink); }
.conf.low { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); color: var(--muted); }
.ai-ok { color: var(--ink); font-weight: 500; }
.filelink { position: relative; align-self: flex-start; overflow: hidden; cursor: pointer; font-size: 14px; }
.filelink input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.claude-opt summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.claude-opt[open] summary { margin-bottom: 6px; }
.claude-opt { display: flex; flex-direction: column; gap: 8px; }
.check { margin-top: 4px; font-weight: 500; }
.check.bad { color: var(--chilli); }

/* Opening hours */
.hrs { font-weight: 600; }
.hrs.open { color: var(--open); }
.hrs.soon { color: var(--soon); }
.hrs.shut { color: var(--muted); }
.hrs-line { margin-top: 4px; }
.hours-table { margin-top: 6px; border-collapse: collapse; font-size: 14px; }
.hours-table th { padding: 3px 18px 3px 0; text-align: left; font-weight: 500; color: var(--muted); }
.hours-table td { padding: 3px 0; }
.hours-table tr.today th, .hours-table tr.today td { color: var(--ink); font-weight: 700; }
.contact { display: flex; gap: 14px; margin-top: 6px; }
.contact a { color: var(--chilli); font-weight: 600; }
.hours-edit summary { cursor: pointer; padding: 4px 0; }
.hours-edit[open] summary { margin-bottom: 6px; }
.hours-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; margin-top: 8px; }
.hours-grid label { font-size: 13px; font-weight: 600; }
.hours-grid input { min-height: 40px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Walk / drive switch and sorting */
.seg { flex: none; display: inline-flex; padding: 2px; border-radius: 17px; background: var(--sunk); }
.seg button { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border: 0; border-radius: 15px; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button .ic { width: 16px; height: 16px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(43, 20, 51, .18); }
.count-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sortpick select { height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; }
.grp-town { margin-top: 16px; font: 400 19px/1.2 var(--display); }
.grp-town span, .grp-area span { font: 500 12px var(--mono); color: var(--muted); }
.grp-area { margin-top: 10px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.grp-area + .rows { margin-top: 2px; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check-row input { width: 20px; height: 20px; accent-color: var(--chilli); }

/* Friends and accounts */
.fpin { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #0E8C7F; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); color: #fff; font: 700 13px/1 var(--body); transition: scale .15s; }
.fpin.sel { scale: 1.3; }
.fpin.small { width: 22px; height: 22px; font-size: 11px; border-width: 1.5px; box-shadow: none; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.person .txt { flex: 1; min-width: 0; }
.person b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.person .sub { display: block; font-size: 13px; color: var(--muted); }
.row-btns.tight { margin-top: 0; flex-wrap: nowrap; }
.row-btns.tight .btn { min-height: 36px; padding: 0 12px; }
.uname { font: 400 24px/1.2 var(--display); overflow-wrap: anywhere; }
.friend-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.friend-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; }
.saved-by { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.fvisits { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.fvisit .rc-photos { margin: 0 0 6px; }
.fvisit .rc-photos button { background: var(--sunk); }
.signin { display: flex; flex-direction: column; gap: 10px; }
.signin .inline .btn { flex: none; }
.pwForm { display: flex; flex-direction: column; gap: 10px; }
.pwForm .row-btns { margin-top: 0; }
.pwForm .links { justify-content: space-between; }
.google { background: var(--surface); }
.google .g { width: 18px; height: 18px; }
.or { text-align: center; font-size: 12px; color: var(--muted); }
.cloud-line { display: flex; align-items: center; gap: 6px; }
.cloud-line .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }

/* Forms */
.overlay { position: fixed; inset: 0; z-index: 50; }
#modal { background: var(--bg); overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 28px) max(16px, env(safe-area-inset-left, 0px)); }
.form { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.form-top { display: flex; align-items: center; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field .lab { font-size: 13px; font-weight: 600; }
.field input, .field textarea, .field select, .card select, .card textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font-size: 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
}
.field textarea { min-height: 84px; resize: vertical; }
.help { font-size: 13px; color: var(--muted); }
.err { font-size: 13px; color: var(--chilli); font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--sunk); }
.picked .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.rate { display: flex; gap: 2px; }
.rate button { width: 40px; height: 40px; padding: 0; font-size: 24px; line-height: 1; background: none; border: 0; color: var(--line); }
.rate button.on { color: var(--mustard); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs figure { position: relative; margin: 0; width: 78px; height: 78px; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.thumbs button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); line-height: 1; }
.addphoto { position: relative; width: 78px; height: 78px; display: grid; place-items: center; text-align: center; border: 1.5px dashed var(--muted); border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.addphoto input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

#lightbox { background: rgba(10, 4, 12, .94); display: grid; place-items: center; padding: 12px; }
#lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

#toast { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px); width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }

/* Tabs */
#tabs {
  position: absolute; z-index: 40; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
}
#tabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
#tabs button[aria-current="page"] { color: var(--chilli); }
#tabs .badge { position: absolute; top: 5px; left: calc(50% + 7px); min-width: 17px; padding: 0 4px; border-radius: 9px; background: var(--chilli); color: var(--chilli-ink); font: 500 10px/17px var(--mono); }

/* Pin-drop mode */
#crosshair { display: none; position: absolute; left: 50%; top: 50%; z-index: 24; width: 30px; height: 30px; margin: -36px 0 0 -15px; border-radius: 50% 50% 50% 2px; transform: rotate(-45deg); background: #D81E4A; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .45); pointer-events: none; }
.pinning #crosshair { display: block; }
.pinning #sheet, .pinning #tabs, .pinning #top, .pinning #locate { display: none; }
#pinBar { position: absolute; z-index: 45; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); padding: 14px; border-radius: 14px; background: var(--surface); box-shadow: 0 6px 24px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 10px; }
#pinBar .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Bigger screens: tray and pages become a fixed left panel beside the map */
@media (min-width: 900px) {
  #top { right: auto; width: var(--panel-w); background: var(--bg); padding: 10px 16px; border-right: 1px solid var(--line); }
  #q { background: var(--sunk); box-shadow: none; }
  #searchResults { left: 16px; right: 16px; }
  #sheet { right: auto; width: var(--panel-w); top: 64px; bottom: var(--nav-h); border-radius: 0; box-shadow: none; border-right: 1px solid var(--line); transform: none !important; }
  #grab { display: none; }
  #sheetScroll { padding-top: 6px; }
  #page { right: auto; width: var(--panel-w); border-right: 1px solid var(--line); padding-top: 18px; }
  #tabs { right: auto; width: var(--panel-w); border-right: 1px solid var(--line); }
  .fab { bottom: 28px; right: 16px; }
  #toast { left: calc(var(--panel-w) / 2); }
  .leaflet-top { top: 0; }
  #modal { background: rgba(20, 8, 26, .5); display: grid; justify-items: center; align-items: start; }
  #modal .form { width: 100%; max-width: 520px; margin: 24px auto; padding: 22px; background: var(--bg); border-radius: 16px; }
  #pinBar { left: auto; right: 16px; width: 340px; }
  .chips { flex-wrap: wrap; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
