/* Survey — layout and components. Colours come from tokens.css only. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 15px/1.45 var(--font-text);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2 { font-family: var(--font-head); font-weight: 400; margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0;
}

/* ---- stone and plate: the look ----------------------------------------- */
.stone {
  background-image: var(--stone);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 1px 0 var(--hi), inset 0 -1px 0 var(--lo);
}
.plate {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--inlay);
}

/* ---- icons (filled in by ui.js) ---------------------------------------- */
[data-icon] > svg, .icon { width: 20px; height: 20px; flex: none; display: block; }

/* ---- buttons ------------------------------------------------------------ */
.btn {
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-s);
  font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-small { padding: 0 14px; font-size: 13px; }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: default; }

.icon-btn, .tool-btn {
  width: var(--tap); height: var(--tap); padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink);
}
.icon-btn:hover, .tool-btn:hover { background: var(--surface-2); }
.link-btn, .text-btn {
  border: 0; background: none; padding: 0; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
  font-weight: 500; font-size: 14px;
}
.text-btn { color: var(--accent-ink); font-weight: 600; min-height: var(--tap); padding: 0 8px; }
.link-btn:hover { color: var(--ink); }

/* ---- form pieces -------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field small { font-weight: 400; color: var(--muted); }
.field input, .notes, .search {
  min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-size: 15px;
}
.field input:focus, .notes:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-error { min-height: 20px; margin: 0; font-size: 13px; color: var(--danger-ink); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.seg-btn { min-height: var(--tap); border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.seg-btn.is-on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--inlay); }

.chips { display: flex; flex-wrap: wrap; gap: 10px 8px; padding: 2px 0; }
.chip, .pill {
  position: relative;
  min-height: 36px; padding: 0 14px; border-radius: 18px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
/* drawn 36 px tall, touched 44 px tall */
.chip::after, .pill::after, .meta-btn::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: var(--tap); transform: translateY(-50%); }
.chip.is-on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pill { border-color: var(--inlay); }
.pill.is-empty { color: var(--ink-2); border-style: dashed; }

/* ---- sign-in ------------------------------------------------------------ */
.signin {
  position: fixed; inset: 0; overflow: auto;
  display: grid; place-items: center; padding: 24px 16px;
  background-image: var(--stone); background-size: cover; background-position: center;
}
.signin-frame { width: min(440px, 100%); padding: var(--frame); border-radius: 22px; box-shadow: 0 24px 60px var(--shadow); }
.signin-plate { padding: 30px 28px 28px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 34px; letter-spacing: 0.01em; }
.brand-mark {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 0 0 1px var(--inlay);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 22px; height: 22px; }
.signin-lead { margin: -6px 0 0; color: var(--ink-2); }

/* ---- app layout (desktop) ----------------------------------------------- */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--rail) auto minmax(0, 1fr); }

.rail {
  grid-column: 1; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0;
  box-shadow: inset -1px 0 0 var(--lo), inset 1px 0 0 var(--hi), 4px 0 14px var(--shadow);
}
.rail .brand-mark { margin-bottom: 10px; }
.rail-space { flex: 1; }
.rail-btn {
  width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: 12px;
  background: var(--surface); color: var(--ink-2);
  box-shadow: 0 0 0 1px var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
}
.rail-btn[aria-pressed='true'] { color: var(--accent-ink); box-shadow: 0 0 0 1px var(--inlay); }
/* a rail button with its name under the icon */
.rail-btn:has(.rail-label) { width: 58px; height: auto; min-height: 58px; flex-direction: column; gap: 3px; padding: 8px 0 7px; }
.rail-label { font-size: 11px; font-weight: 600; line-height: 1; letter-spacing: .01em; }
.rail-account, .bar-account {
  border-radius: 50%; font-weight: 600; font-size: 13px; color: var(--ink);
  box-shadow: 0 0 0 1px var(--inlay);
}

.list {
  grid-column: 2; width: var(--list); z-index: 2;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--inlay);
}
.app.list-closed .list { display: none; }
.list-head { padding: 20px 20px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: baseline; gap: 10px; }
.list-title h1 { font-size: 26px; }
.count { font-size: 13px; color: var(--muted); }
.list-close { margin-left: auto; align-self: center; display: none; }
.search { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; min-height: 44px; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.list-note { margin: 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.list-note svg { width: 14px; height: 14px; }
.list-body { flex: 1; min-height: 0; overflow-y: auto; }

.row {
  width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent;
  display: flex; gap: 14px; padding: 12px 20px; min-height: 92px; align-items: center;
}
.row:hover { background: var(--surface-2); }
.row.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.thumb {
  width: 68px; height: 68px; flex: none; border-radius: 10px; overflow: hidden; position: relative;
  background: var(--photo); color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-count {
  position: absolute; right: 4px; bottom: 4px; min-width: 20px; padding: 1px 6px; border-radius: 10px;
  background: var(--ink); color: var(--surface); font-size: 11px; font-weight: 600; text-align: center;
}
.row-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tag { padding: 2px 8px; border-radius: 8px; background: var(--surface-3); color: var(--ink-2); font-weight: 500; }
.empty { padding: 36px 24px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty h2 { font-size: 22px; color: var(--ink); }

/* ---- map ---------------------------------------------------------------- */
.map-wrap { grid-column: 3; position: relative; min-width: 0; }
.map { position: absolute; inset: 0; background: var(--page); }
.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl.maplibregl-ctrl-attrib { background: var(--surface); color: var(--ink-2); }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }
:root[data-theme='dark'] .maplibregl-ctrl-attrib-button { filter: invert(1); }

.pin {
  width: 48px; height: 48px; border-radius: 50%; overflow: hidden; padding: 0;
  border: 3px solid var(--pin-ring); background: var(--photo); color: var(--ink-2);
  box-shadow: 0 2px 8px var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.pin img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin.is-selected {
  width: 64px; height: 64px; border: 4px solid var(--accent);
  box-shadow: 0 0 0 2px var(--inlay), 0 8px 20px var(--shadow); z-index: 2;
}
.pin-group {
  width: 48px; height: 48px; border-radius: 50%; padding: 0;
  border: 3px solid var(--pin-ring); background: var(--ink); color: var(--surface);
  font-weight: 600; font-size: 15px; box-shadow: 0 2px 8px var(--shadow);
}
.pin-new-wrap { width: 36px; height: 44px; cursor: grab; z-index: 3; }
.pin-new {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--accent); border: 3px solid var(--pin-ring); box-shadow: 0 4px 12px var(--shadow);
}

.card { position: absolute; z-index: 2; left: 20px; top: 20px; width: 288px; padding: 8px; border-radius: 18px; box-shadow: 0 14px 34px var(--shadow); }
.card .plate { padding: 14px; border-radius: 11px; display: flex; flex-direction: column; gap: 10px; }
.card-photos { display: flex; gap: 6px; }
.card-photos .thumb { flex: 1; width: auto; height: 62px; border-radius: 7px; }
.card-photos:empty { display: none; }
.card-title { font-family: var(--font-head); font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.card-sub { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-when { font-size: 12px; color: var(--muted); }

.map-tools { position: absolute; right: 20px; bottom: 100px; display: flex; flex-direction: column; gap: 10px; z-index: 1; }
.tool-btn { border-color: var(--inlay); box-shadow: 0 6px 18px var(--shadow); border-radius: 14px; width: 48px; height: 48px; }
.btn-new {
  position: absolute; right: 20px; bottom: 28px; z-index: 1;
  min-height: 58px; padding: 0 26px 0 20px; border: 0; border-radius: 29px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 16px;
  box-shadow: 0 0 0 2px var(--inlay), 0 10px 26px var(--shadow);
  display: inline-flex; align-items: center; gap: 10px;
}
.btn-new:hover { background: var(--accent-hover); }
.app.panel-open .btn-new, .app.panel-open .map-tools { right: calc(var(--panel) + 20px); }

.pick-banner { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); z-index: 3; padding: 6px; border-radius: 16px; box-shadow: 0 10px 26px var(--shadow); }
/* centred in the part of the map the panel leaves free */
.app.panel-open .pick-banner { left: calc((100% - var(--panel)) / 2); }
.pick-banner .plate { padding: 8px 8px 8px 16px; border-radius: 11px; display: flex; align-items: center; gap: 14px; font-weight: 500; white-space: nowrap; }

/* ---- survey panel ------------------------------------------------------- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel); z-index: 4;
  padding: var(--frame); box-shadow: inset 1px 0 0 var(--hi), -14px 0 34px var(--shadow);
}
.panel-plate { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.panel-head { padding: 12px 22px 14px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.panel-bar { display: flex; align-items: center; justify-content: space-between; }
.panel-actions { display: flex; gap: 8px; }
.title-input, .address-input {
  width: 100%; border: 0; border-radius: 8px; background: transparent; color: var(--ink);
  padding: 4px 6px; margin: 0 -6px;
}
.title-input { font: 400 28px/1.2 var(--font-head); min-height: 44px; }
.address-input { font-size: 15px; color: var(--ink-2); min-height: var(--tap); }
.title-input:hover, .address-input:hover { background: var(--surface-2); }
.title-input::placeholder, .address-input::placeholder, .notes::placeholder { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 4px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meta-btn { position: relative; border: 0; background: none; padding: 0 4px; margin: 0 -4px; min-height: 36px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.meta-btn:hover { background: var(--surface-2); color: var(--ink); }
.meta-pos { display: inline-flex; align-items: center; gap: 6px; }
.meta svg { width: 15px; height: 15px; }

.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 24px; }
.block { display: flex; flex-direction: column; gap: 10px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.block-head h2 { font-size: 21px; }

.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.photo-grid:empty { display: none; }
.photo {
  position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px; overflow: hidden;
  background: var(--photo); color: var(--ink-2); display: flex; align-items: center; justify-content: center;
}
.photo:first-child { grid-column: span 2; grid-row: span 2; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tag { position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 8px; background: var(--ink); color: var(--surface); font-size: 11px; font-weight: 600; }
.photo.is-busy::after { content: ''; position: absolute; inset: 0; background: var(--scrim); }
.photo.is-busy .spinner { position: absolute; z-index: 1; }
.photo.is-failed { outline: 2px solid var(--danger-ink); outline-offset: -2px; flex-direction: column; gap: 4px; font-size: 12px; color: var(--danger-ink); text-align: center; padding: 6px; }
.photo-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-actions .btn { flex: 1; }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: inline-flex; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface); border-top-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.details { display: flex; flex-direction: column; gap: 8px; }
.details:empty::before { content: 'Add a contact, an email, a price or anything you want to find again.'; color: var(--muted); font-size: 14px; }
.detail { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 12px 8px 12px 14px; display: flex; gap: 12px; align-items: center; }
.detail-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--inlay); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; color: var(--ink); }
.detail-avatar svg { width: 18px; height: 18px; }
.detail-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.detail-main { font-weight: 600; overflow-wrap: anywhere; }
.detail-sub { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.detail-sub a, .detail-main a { color: var(--accent-ink); }
.detail .icon-btn { border: 0; background: transparent; color: var(--ink-2); }
.detail .icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.detail-form { border: 1px solid var(--inlay); border-radius: 12px; background: var(--surface-2); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.detail-form h3 { margin: 0; font: 600 14px var(--font-text); }
.detail-form .form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.notes { width: 100%; min-height: 110px; padding: 12px 14px; line-height: 1.5; resize: vertical; background: var(--surface-2); }

.panel-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.save-state { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.save-state.is-error { color: var(--danger-ink); }
.save-state svg { width: 16px; height: 16px; color: var(--ok-ink); }
.foot-actions { display: flex; gap: 8px; }

/* ---- menus, dialogs, toasts --------------------------------------------- */
.menu {
  position: fixed; z-index: 30; min-width: 220px; max-width: calc(100vw - 24px); padding: 6px;
  border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--inlay), 0 14px 36px var(--shadow);
  display: flex; flex-direction: column;
}
.menu-item {
  min-height: var(--tap); padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink);
  font-size: 14px; font-weight: 500; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item small { color: var(--muted); font-weight: 400; }
.menu-item.is-danger { color: var(--danger-ink); }
.menu-item.is-on { color: var(--accent-ink); font-weight: 600; }
.menu-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; font-weight: 600; }
.menu-head span { font-size: 13px; color: var(--muted); }
.menu-label { padding: 8px 12px 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.menu .seg { margin: 0 8px 8px; }
.menu-empty { padding: 4px 12px 10px; font-size: 13px; color: var(--muted); }

.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: grid; place-items: center; padding: 16px; }
.dialog { width: min(460px, 100%); padding: 8px; border-radius: 20px; box-shadow: 0 24px 60px var(--shadow); }
.dialog .plate { padding: 22px; border-radius: 13px; display: flex; flex-direction: column; gap: 14px; }
.dialog h2 { font-size: 22px; }
.dialog p { margin: 0; color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.toasts { position: fixed; z-index: 50; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; padding: 12px 14px; border-radius: 12px; background: var(--surface); color: var(--ink);
  box-shadow: 0 0 0 1px var(--inlay), 0 10px 26px var(--shadow); display: flex; gap: 10px; align-items: flex-start; font-size: 14px;
}
.toast.is-error { box-shadow: 0 0 0 1px var(--danger-ink), 0 10px 26px var(--shadow); }
.toast strong { display: block; font-weight: 600; }
.toast span { color: var(--ink-2); }
.toast .icon-btn { margin: -6px -6px -6px auto; border: 0; background: transparent; flex: none; }

/* ---- photo viewer ------------------------------------------------------- */
/* above the panel and menus, below dialogs (40) and toasts (50); dark in both themes */
.viewer { --focus: var(--viewer-ink); position: fixed; inset: 0; z-index: 35; background: var(--viewer-bg); color: var(--viewer-ink); display: flex; flex-direction: column; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-stage .pano { position: relative; width: 100%; height: 100%; }
.pano-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pano-wait .spinner { border-color: var(--viewer-ink); border-top-color: transparent; }
.viewer-btn { position: absolute; z-index: 2; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--viewer-btn); color: var(--viewer-ink); display: flex; align-items: center; justify-content: center; }
.viewer-btn:hover { background: var(--viewer-btn-hover); }
.viewer-close { top: 14px; right: 14px; }
.viewer-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 14px; top: 50%; transform: translateY(-50%); }
.viewer-mode { min-height: var(--tap); padding: 0 18px; border: 0; border-radius: calc(var(--tap) / 2); background: var(--viewer-btn); color: var(--viewer-ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.viewer-mode:hover { background: var(--viewer-btn-hover); }
.viewer-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }

/* ---- phone bottom bar (hidden on desktop) ------------------------------- */
.bar { display: none; }

/* ---- phone --------------------------------------------------------------- */
@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) var(--bar); }
  .rail { display: none; }
  .map-wrap { grid-column: 1; grid-row: 1; }

  .list {
    position: fixed; inset: 0 0 var(--bar) 0; width: auto; z-index: 5; border-right: 0;
    display: none;
  }
  .app.show-list .list { display: flex; }
  .app.list-closed.show-list .list { display: flex; }
  .list-close { display: inline-flex; }

  .bar {
    grid-column: 1; grid-row: 2; z-index: 6; position: relative;
    display: grid; grid-template-columns: 1fr 96px 1fr 56px; align-items: center;
    padding: 0 8px env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--inlay);
  }
  .bar-btn {
    min-height: 56px; border: 0; background: none; color: var(--ink-2);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: 12px; font-weight: 500;
  }
  .bar-btn[aria-pressed='true'] { color: var(--accent-ink); font-weight: 600; }
  .bar-new {
    justify-self: center; width: 72px; height: 72px; margin-top: -30px; padding: 0; border: 0; border-radius: 50%;
    background: var(--accent); color: var(--on-accent);
    box-shadow: 0 0 0 2px var(--inlay), 0 0 0 7px var(--surface), 0 10px 22px var(--shadow);
    display: flex; align-items: center; justify-content: center;
  }
  .bar-new svg { width: 30px; height: 30px; }
  .bar-account { width: var(--tap); height: var(--tap); padding: 0; border: 0; background: var(--surface-2); justify-self: center; }

  .btn-new { display: none; }
  .map-tools { right: 12px; top: 12px; bottom: auto; }   /* clear of the map credit and the survey card */
  .app.panel-open .map-tools { right: 12px; }
  .card { left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
  .card .plate { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .card-photos { flex: none; }
  .card-photos .thumb { width: 64px; height: 64px; flex: none; }
  .card-photos .thumb + .thumb { display: none; }
  .card-text { flex: 1; min-width: 0; }
  .card-foot { width: 100%; }
  .pick-banner, .app.panel-open .pick-banner { left: 50%; top: 12px; width: calc(100% - 24px); }
  .pick-banner .plate { justify-content: space-between; white-space: normal; }

  .panel { left: 0; width: auto; padding: 0; z-index: 8; background-image: none; background: var(--surface); box-shadow: none; }
  .panel-plate { border-radius: 0; box-shadow: none; }
  .panel-head { padding: 6px 16px 12px; }
  .panel-body { padding: 16px; }
  .panel-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .title-input { font-size: 25px; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo:first-child { grid-column: span 1; grid-row: span 1; }

  /* at the top on a phone, clear of the bar, the card and menus */
  .toasts { right: 12px; left: 12px; top: calc(12px + env(safe-area-inset-top)); bottom: auto; width: auto; }
  .menu { max-height: 70vh; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.001ms !important; }
}

/* ---- share dialog --------------------------------------------------------- */
.share-dialog { width: min(540px, 100%); }
.share-dialog .plate { max-height: calc(100vh - 48px); overflow-y: auto; }
.share-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.share-head p { margin: 4px 0 0; overflow-wrap: anywhere; }
.share-info { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink) !important; font-size: 14px; }
.share-form { display: flex; flex-direction: column; gap: 6px; }
.share-send { display: flex; gap: 10px; }
.share-send input { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); }
.share-title { margin: 4px 0 0; font: 600 14px var(--font-text); }
.share-list { display: flex; flex-direction: column; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.share-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.share-who strong { font-weight: 500; overflow-wrap: anywhere; }
.share-who span, .share-foot, .share-empty { font-size: 13px; color: var(--muted) !important; margin: 0; }
.share-empty { padding: 10px 0; border-top: 1px solid var(--line); }

/* ---- the page a shared link opens (shared.html) ---------------------------- */
.shared { position: fixed; inset: 0; overflow-y: auto; background: var(--surface-2); }
.shared-top { position: sticky; top: 0; z-index: 2; padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; box-shadow: 0 2px 10px var(--shadow); }
.shared-top .brand h1 { font-size: 24px; }
.shared-top .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.shared-badge { min-height: 36px; padding: 6px 14px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--inlay); display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.shared-badge svg { width: 16px; height: 16px; }
.shared-main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 48px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.shared-photos { display: flex; flex-direction: column; gap: 10px; }
.shared-big { position: relative; aspect-ratio: 4 / 3; border: 0; padding: 0; border-radius: 16px; overflow: hidden; background: var(--photo); color: var(--ink-2); display: flex; align-items: center; justify-content: center; width: 100%; }
.shared-big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shared-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.shared-strip .photo { border-radius: 10px; }
.shared-strip .photo:first-child { grid-column: auto; grid-row: auto; }
.shared-strip .photo.is-on { outline: 3px solid var(--accent); outline-offset: -3px; }
.shared-map { height: 190px; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--inlay); background: var(--page); }
.shared-facts { display: flex; flex-direction: column; gap: 18px; }
.shared-facts h1 { font-size: 36px; line-height: 1.15; overflow-wrap: anywhere; }
.shared-sub { color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; font-variant-numeric: tabular-nums; }
.shared-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.shared-card h2 { font-size: 21px; }
.shared-card p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.shared-note { font-size: 13px; color: var(--muted); }
.shared-message { max-width: 520px; margin: 12vh auto 0; padding: 0 20px; }
.shared-message .plate { padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.shared-message h1 { font-size: 28px; }
.shared-message p { margin: 0; color: var(--ink-2); }
.shared .details .detail { background: var(--surface); }
@media (max-width: 899px) {
  .shared-main { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 40px; gap: 20px; }
  .shared-facts h1 { font-size: 28px; }
  .shared-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .share-send { flex-direction: column; }
  .share-row { align-items: flex-start; flex-direction: column; }
}
.shared-facts .tag { display: inline-block; margin-bottom: 8px; }
.shared-sub span:empty { display: none; }

/* where the device is (the locate button) */
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f7fe0; border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(47, 127, 224, .25), 0 2px 6px rgba(0, 0, 0, .35); }
.tool-btn[aria-busy="true"] { animation: locating 1s ease-in-out infinite alternate; }
@keyframes locating { from { opacity: 1; } to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .tool-btn[aria-busy="true"] { animation: none; opacity: .6; } }
