/* 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. Sizes follow the theme's
   tokens (--tap, --t-small; item 189) where the page has them, else the old px. */

.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(var(--tap, 2.75rem) + .5rem + 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: var(--tap, 44px); padding: 0 10px; border-radius: 10px;
  color: var(--accent) !important; font: 500 var(--t-body, 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; }
body:has(> .appbar) { margin: 0; }   /* 1442: a page with no reset (Recommend) had the browser's 8 px, so its back sat at x14 y12, not x6 y4 */
/* 1442: the back sits at the far left of the bar on every page and size, so it never moves between taps */
.appbar #fbhost, #top #fbhost { margin-left: auto; min-width: 0; display: flex; justify-content: flex-end; }

/* 1442 (live review r2): the desk column (public/deskcol.js) on Settings and its screens, the same one home has (632): 900 px and up */
.dcol-nav { display: none; }
@media (min-width: 900px) {
  html body.dcol { --colw: 15rem; padding-inline-start: var(--colw) !important; }
  html[data-theme="large"] body.dcol { --colw: 17rem; }
  .dcol-nav { display: flex; flex-direction: column; gap: var(--s-3, 12px); position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; inline-size: var(--colw); box-sizing: border-box;
    padding: calc(var(--s-4, 16px) + env(safe-area-inset-top, 0px)) var(--s-3, 12px) var(--s-3, 12px); background: var(--bg); }
  .dcol-nav a { display: flex; align-items: center; flex: none; min-height: var(--btn, 3rem); padding: 0 var(--s-3, 12px); border-radius: var(--r-sm, 10px); color: var(--ink);
    font: 500 var(--t-small, 15px)/1 var(--ui, system-ui, sans-serif); text-decoration: none; text-align: start; }
  .dcol-nav a.on { background: var(--seg-on, var(--surface)); color: var(--seg-on-ink, var(--ink)); font-weight: 700; box-shadow: inset 0 0 0 var(--line-w, 1px) var(--seg-ring, var(--line, var(--rule))); }
  .dcol-nav #dc-settings { color: var(--muted); }
  html[data-theme="large"] .dcol-nav #dc-settings { color: var(--ink); }
  .dcol-nav #dc-settings.on { color: var(--ink); }
  body.dcol #tabs { display: none; }
  body.dcol .apphd:not(:has(#back:not([hidden]))) { display: none; }
  /* the back at the column's edge, the same x on every page */
  html body.dcol > .appbar, html body.dcol > .apphd { padding-inline-start: 6px !important; }
}
@media (min-width: 900px) and (max-width: 1199px) { html body.dcol { --colw: 12.5rem; } html[data-theme="large"] body.dcol { --colw: 15rem; } }

/* 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(var(--tap, 2.75rem) + .5rem + 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: var(--tap, 2.75rem); 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 var(--t-small, 15px)/1 var(--ui, system-ui, sans-serif); }
.topfind svg { width: var(--icon-sm, 18px); height: var(--icon-sm, 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: var(--tap, 2.75rem); 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 var(--t-small, 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: var(--tap, 2.75rem); }
.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: var(--icon-sm, 18px); height: var(--icon-sm, 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: 44px; 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; }
/* Bug 352: the wrap is the visible area, not the whole screen - with the keyboard up (iPhone keeps the layout viewport) the
   sheet sits on the keyboard's top edge; --vvh/--vvt come from visualViewport (public/feedback.js fitViewport) */
.fb-wrap { bottom: auto; top: var(--vvt, 0px); height: var(--vvh, 100dvh); }
.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);
  max-height: calc(100% - 12px); overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; }
body.kb-up .fb-sheet, html.fb-kb .fb-sheet { padding-bottom: 12px; }
.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; }
/* the tiles row (#246, docs/design/notes/246.md): Add a photo (the one accent tile), This screen (always goes), each photo with its × */
.fb-att { --fb-x-bg: rgba(0,0,0,.55); --fb-x-ink: #fff; }   /* the × over a photo, light or dark: one fixed value for every theme, as the scrim */
.fb-att { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.fb-att > * { position: relative; box-sizing: border-box; width: 64px; height: 64px; margin: 0; padding: 0; border: 0; border-radius: 10px; overflow: hidden; flex: none;
  background: var(--surface); box-shadow: inset 0 0 0 .5px var(--line, var(--rule)); }
.fb-att .fb-ph { overflow: visible; }   /* the ×'s 44 px target reaches past the tile's corner */
.fb-att img, .fb-att video { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.fb-att .fb-this, .fb-att .fb-add { display: grid; place-items: center; align-content: center; gap: 3px; color: var(--muted); font: 500 12px/1.1 var(--ui, system-ui, sans-serif); text-align: center; }
.fb-att .fb-this svg, .fb-att .fb-add svg { width: 22px; height: 22px; }
.fb-att .fb-x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; overflow: visible;
  background: var(--fb-x-bg); color: var(--fb-x-ink); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.fb-att .fb-x::after { content: ""; position: absolute; inset: -11px; }   /* a 44 px target */
.fb-att .fb-x svg { width: 12px; height: 12px; }
.fb-att .fb-add { color: var(--accent); font-weight: 600; cursor: pointer; box-shadow: inset 0 0 0 1px var(--accent); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.fb-att .fb-add:active { transform: scale(.97); }
.fb-att .fb-ph.up img, .fb-att .fb-ph.up video { opacity: .55; }   /* still going up while Sending… */
body.large .fb-att > * { width: 76px; height: 76px; }
body.large .fb-att .fb-add, body.large .fb-att .fb-this { font-size: 14px; }
body.large .fb-att .fb-add svg, body.large .fb-att .fb-this svg { width: 26px; height: 26px; }
body.large .fb-att .fb-x { width: 28px; height: 28px; }
body.large .fb-sheet .fb-label { font-size: var(--body) !important; }
body.large .fb-sheet textarea { font-size: var(--body); }
body.large .fb-act .fb-send, body.large .fb-cancel { min-height: var(--tap); font-size: var(--body); }
.fb-act { display: flex; gap: 10px; }
.fb-act .fb-send { flex: 1; cursor: pointer; min-height: var(--tap, 44px); border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink, var(--on-accent)); font: 600 17px var(--ui, system-ui, sans-serif); }
.fb-act .fb-send:disabled { opacity: .6; }
.fb-cancel { min-height: var(--tap, 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; }
  .fb-att > * { background: var(--surface-2, var(--bg)); }
}
@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)); }
