/* The app's top bar (#120, #133): one layout on every page the app shows. Left: back (or Find in Pin chat); right: @handle
   and Feedback. A solid band at the top (the phone's status bar area included) that the page scrolls under: nothing ever
   floats over a heading or a button, and nothing lies over the pills, so a tap on a pill is that pill's (feedback 2026-11-17).
   Used by the app's pages (after app.css), by his public pages when seen in the app (src/lib.js shell), the café card page and
   the help pages (public/wayback.js). Colours come from the page: app.css names them --line/--ui/..., style.css --rule/--body. */

.appbar { position: sticky; top: 0; z-index: 30; box-sizing: border-box; display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 8px; width: 100%;
  height: calc(52px + env(safe-area-inset-top, 0px)); margin: 0;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px));
  background: var(--bg); border-bottom: .5px solid var(--line, var(--rule));
  font-family: var(--ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif); }
.ab-back { position: relative; flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 10px;
  color: var(--accent) !important; font: 500 17px/1 var(--ui, -apple-system, BlinkMacSystemFont, system-ui, sans-serif) !important;
  text-decoration: none !important; white-space: nowrap; background: none !important; }
.ab-back:active { opacity: .6; }
.appbar #fbhost, #top #fbhost { margin-left: auto; min-width: 0; display: flex; justify-content: flex-end; }

/* his public pages in the app: the page's own bar (‹ All pins) scrolls with the page under the app's bar */
body.inapp .bar { position: static; padding-top: 0; }
body.inapp .pv-banner { top: calc(52px + env(safe-area-inset-top, 0px)); }

/* Pin chat: the same band, Find on the left (#88, #89). The chat scrolls inside #log, so the band never moves. */
#top { order: 0; flex: none; position: relative; z-index: 30; display: flex; align-items: center; gap: 8px; width: 100%; margin: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(16px, calc((100% - 760px) / 2 + 16px)) 8px; background: var(--bg);
  border-bottom: .5px solid var(--line, var(--rule)); }
#top:not([hidden]) ~ #log { padding-top: 10px !important; }
.topfind { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 11px; border: 0;
  border-radius: 999px; cursor: pointer; background: var(--surface); box-shadow: inset 0 0 0 .5px var(--line, var(--rule)); color: var(--ink); font: 500 15px/1 var(--ui, system-ui, sans-serif); }
.topfind svg { width: 18px; height: 18px; color: var(--muted); }
.topfind::after { content: ""; position: absolute; inset: -4px -2px; }   /* a 44 px tall target */
.topfind:active { transform: scale(.97); }

/* the pills: @handle (which account, feedback #8) and Feedback, in the bar's right end */
.fb-bar { position: static; display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.fb-btn, .who-btn { position: relative; flex: none;
  display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 12px 0 9px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--surface); box-shadow: inset 0 0 0 .5px var(--line, var(--rule)); color: var(--muted); font: 500 14px/1 var(--ui, system-ui, sans-serif); }
.who-btn { flex: 0 1 auto; min-width: 0; max-width: 46vw; padding: 0 12px; }
.who-at { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 36px; }
.who-label { margin: 0; color: var(--muted); font: 500 13px/1.3 var(--ui, system-ui, sans-serif); }
.who-handle { margin: -6px 0 6px; color: var(--muted); font: 15px/1.4 var(--ui, system-ui, sans-serif); overflow-wrap: anywhere; }
.who-handle a { color: var(--accent); }
.fb-btn svg { width: 18px; height: 18px; flex: none; }
.fb-btn::after, .who-btn::after { content: ""; position: absolute; inset: -4px -3px; }   /* a 44 px tall target, within the 8 px gaps */
.fb-btn:active, .who-btn:active { transform: scale(.97); }

/* a narrow phone (320-374 px): Feedback and Find become icons, "Back to" goes, the handle keeps what fits */
@media (max-width: 374px) {
  .fb-btn { width: 40px; padding: 0; justify-content: center; }
  .fb-btn span, .topfind span, .ab-long { display: none; }
  .topfind { width: 44px; padding: 0; justify-content: center; }
  .who-btn { max-width: 38vw; padding: 0 10px; }
  .ab-back { padding: 0 8px 0 6px; }
}

/* ---------- the Feedback sheet (public/feedback.js) ---------- */
.fb-wrap { position: fixed; inset: 0; z-index: 50; }
.fb-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.fb-sheet { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 10px; margin: 0; background: var(--bg);
  border-radius: 16px 16px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px rgba(0,0,0,.18);
  color: var(--ink); font-family: var(--ui, -apple-system, BlinkMacSystemFont, system-ui, sans-serif); }
.fb-grab { width: 36px; height: 5px; border-radius: 3px; background: var(--line, var(--rule)); margin: 2px auto 4px; }
.fb-sheet h3 { font: 700 22px/1.2 var(--ui, system-ui, sans-serif); margin: 0; }
.fb-sheet .fb-label { font: 500 16px/1.35 var(--ui, system-ui, sans-serif) !important; color: var(--ink); }
.fb-sheet textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 104px; padding: 10px 12px; line-height: 1.4 !important;
  font: 17px var(--ui, system-ui, sans-serif); color: var(--ink); border: 0; border-radius: 10px; box-shadow: inset 0 0 0 .5px var(--line, var(--rule)); background: var(--surface) !important; }
.fb-fine { margin: 0; color: var(--muted); font: 13px/1.4 var(--ui, system-ui, sans-serif); }
.fb-act { display: flex; gap: 10px; }
.fb-act .fb-send { flex: 1; cursor: pointer; min-height: 44px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: 600 17px var(--ui, system-ui, sans-serif); }
.fb-act .fb-send:disabled { opacity: .6; }
.fb-cancel { min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); font: 500 17px var(--ui, system-ui, sans-serif); cursor: pointer; box-shadow: inset 0 0 0 .5px var(--line, var(--rule)); }
.fb-msg { margin: 0; min-height: 0; color: var(--muted); font: 14px var(--ui, system-ui, sans-serif); }
.fb-msg:empty { display: none; }
.fb-msg.bad { color: var(--bad, #b3261e); }
.fb-done { margin: 0 0 8px; color: var(--ok, #1f7a46); font: 600 16px var(--ui, system-ui, sans-serif); }
.fb-offer { align-self: flex-start; margin: -4px 0 0 4px; }
.fb-offer button { background: none; border: 0; padding: 6px 2px; min-height: 32px; color: var(--muted); font: 14px var(--ui, system-ui, sans-serif); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); text-underline-offset: 3px; cursor: pointer; }
/* dark: a sheet the same black as the page has no edge; lift it like an iOS sheet */
@media (prefers-color-scheme: dark) {
  .fb-sheet { background: var(--surface); }
  .fb-sheet textarea, .fb-cancel { background: var(--surface-2, var(--bg)) !important; }
}
@media (min-width: 900px) {
  .fb-sheet { left: auto; right: 24px; bottom: 24px; width: 420px; border-radius: 16px; padding-bottom: 18px; }
  .fb-grab { display: none; }
}

/* a link to a part of the page (#connections, #plan) lands below the bar, not under it */
html:has(.appbar) { scroll-padding-top: calc(60px + env(safe-area-inset-top, 0px)); }
