/* Feedback button and panel (ADR-0018). Tokens only (ADR-0013); no inline styles (CSP). Upper right, clear of the rail,
   the top bar's own controls and the page headers: desktop keeps a strip free at the top of the content, phones put the
   button inside the top bar. At 1025 and up the button sits in the rail's foot (fb-in-rail), never over a page. */
.fb { position: fixed; top: 10px; right: 16px; z-index: 30; font-size: 14px; }
.fb .sr, .fb-panel .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fb-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--accent-text); font: inherit; font-weight: 500; cursor: pointer; }
.fb-btn:hover { background: var(--paper); }
.fb-btn[aria-expanded="true"] { background: var(--navy-soft); border-color: var(--accent-text); }
/* The panel is a modal <dialog> (top layer): centred over the dimmed page on desktop, a sheet from the bottom on phones.
   The dialog has no padding, so a click on the dialog element itself is a click on the backdrop. */
dialog.fb-panel { position: fixed; inset: 0; margin: auto; width: min(440px, calc(100vw - 32px)); max-width: none; height: fit-content; max-height: min(680px, calc(100dvh - 48px));
  padding: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); color: var(--ink); font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 2px 6px rgba(22, 22, 22, .10), 0 16px 40px rgba(22, 22, 22, .22); }
dialog.fb-panel::backdrop { background: rgb(28 28 28 / .35); }
.fb-sheet { padding: 10px 16px 16px; }
.fb-head { display: flex; align-items: flex-start; gap: 8px; margin: 0 -4px 12px; border-bottom: 1px solid var(--line); }
.fb-head .fb-tabs { flex: 1; border-bottom: 0; margin: 0; }
.fb-x { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-top: -2px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.fb-x:hover { background: var(--paper); color: var(--ink); }
.fb-x:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.fb-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px -4px 12px; }
.fb-tabs button { padding: 9px 10px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.fb-tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.fb-kinds { display: flex; gap: 6px; flex-wrap: wrap; border: 0; margin: 0 0 12px; padding: 0; }
.fb-kind { cursor: pointer; }
.fb-kind input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kind span { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 500; }
.fb-kind input:checked + span { border-color: var(--accent-text); background: var(--navy-soft); box-shadow: inset 0 0 0 1px var(--accent-text); }
.fb-kind input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.fb-field textarea { min-height: 96px; resize: vertical; font-size: 16px; }
.fb-hint { margin: 6px 0 8px; }
/* the one screenshot (ADR-0046): an add button, or the thumbnail with its size and a remove button */
.fb-shot { margin: 10px 0 8px; }
.fb-shot-add { min-height: 40px; }
.fb-shot-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.fb-shot-thumb { flex: none; width: 64px; height: 48px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.fb-shot-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fb-shot-remove { flex: none; min-height: 40px; color: var(--accent-text); }
.fb-shot .fb-hint { margin: 6px 0 0; }
.fb-item-shot { display: inline-block; margin-top: 8px; border-radius: 4px; }
.fb-item-shot img { display: block; width: 96px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.fb-item-shot:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.fb-include { margin: 4px 0 10px; }
.fb-include summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--accent-text); }
.fb-include ul { margin: 6px 0 0; padding-left: 18px; }
.fb-error { margin: 8px 0; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.fb-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fb-done { text-align: left; }
.fb-done:focus { outline: none; }
.fb-done .row { margin-top: 8px; }
.fb-pad { padding: 10px 0; }
.fb-list { list-style: none; margin: 0; padding: 0; }
.fb-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fb-item:last-child { border-bottom: 0; }
.fb-msg-line { margin: 4px 0 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
body.dev .fb:not(.fb-in-rail) { right: 74px; }
@media (max-width: 600px) {
  dialog.fb-panel { inset: auto 0 0 0; margin: 0; width: 100%; max-height: calc(100dvh - 24px); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .fb-sheet { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}
@media (max-width: 1024px) {
  .fb { top: 8px; right: 12px; }
  .fb-btn { min-height: 40px; padding: 6px 10px; }
  .fb-btn-text { display: none; }
  body.dev .fb { right: 70px; }
}
/* in the rail: part of the rail, a row of its own; its panel opens to the right of the rail, bottom-aligned */
.fb.fb-in-rail { position: static; z-index: auto; }
.fb-in-rail .fb-btn { width: 100%; justify-content: flex-start; }
@media (prefers-reduced-motion: reduce) { .fb *, .fb-panel * { transition: none !important; animation: none !important; } }

/* the rail scrolls on short screens: its foot (the feedback button, the signed-in user) stays pinned to the bottom of it */
.sidebar-foot { position: sticky; bottom: -14px; background: var(--card); padding-bottom: 14px; z-index: 1; }
