/* The corner of every page: the "Report a problem" button and the version
   stamp (js/feedback.js and js/app.js put them here, in the corner's dock),
   and the button's panel. One stylesheet for the website's pages and the
   system's alike: each loads it with the dock (cornerDock, in both
   scripts), so the website's pages, which don't load style.css, have it
   too (O-F18). Colours are the system's (style.css) where a page has them,
   else the site's own (one.css), as css/legacy.css maps them.

   Where it sits (decisions.md, 16 Nov: the same corner on every page):
   - on a computer, always in the bottom-right corner of the window, the
     same place on every page, the website's and the system's. The page
     can pass under it while scrolling, but never stays under it: the end
     of every page has room for it (the footer's, in one.css; a staff
     screen's, below), and a box reached with the keyboard stops clear of
     it (WCAG 2.4.11);
   - on a phone, the button the same (the owner, 2026-11-19), as just its
     round icon, while the version stamp waits at the end of the page's
     content (F-30);
   - in a short window (a laptop zoomed to 200%, a phone on its side), it
     doesn't float at all: it waits at the end of the page's content, above
     the footer (P-09).
   It sits under pop-ups (they start at 50), so it never covers theirs;
   each pop-up has its own Share feedback link instead (below). */
.corner-dock {
  position: fixed; right: 0; bottom: 0; z-index: 40;
  display: flex; flex-direction: row; align-items: flex-end; gap: 10px;
  width: fit-content; margin: 0 0 0 auto; padding: 12px 24px;
  /* Only its button and stamp take a click, never the room around them. */
  pointer-events: none;
}
.corner-dock > * { pointer-events: auto; }
.corner-dock[hidden] { display: none; }
/* Above the panel's shade while the button is the panel's close button. */
.corner-dock:has(.feedback-button.is-open) { z-index: 110; }
/* A box reached with the keyboard stops clear of the floating dock; and a
   staff screen (no footer to hold the room) ends with room for it, so its
   last button is never left under it. */
html:has(body > .corner-dock) { scroll-padding-bottom: calc(38px + 4.5rem); }
html:has(body > .corner-dock):not(:has(body > .site-footer)) { padding-bottom: calc(38px + 4.5rem); }
@media (max-height: 37.5rem) {
  .corner-dock { position: static; }
  html:has(body > .corner-dock) { scroll-padding-bottom: 0; }
  html:has(body > .corner-dock):not(:has(body > .site-footer)) { padding-bottom: 0; }
}
@media (max-width: 899px) {
  .corner-dock { padding: 12px; }
  /* The medicines' Yes/No column sits on the right, where the button
     floats: keep it clear of the pill (in rem too, as it grows with large text). */
  body:has(> .corner-dock .feedback-button) .yes-no-list { padding-right: calc(44px + 4rem); }
}
/* On a phone (under 40rem wide) the button floats in the corner too, as
   on a computer, so it's always there to find (the owner, 2026-11-19: "This
   feedback button is way more hidden in mobile"; it used to wait at the
   end of the page, F-30): just its round icon (below), clear of the
   phone's home bar. Only the button: the dock, and the version stamp in it,
   still waits at the end of the page's content (F-30), so the stamp never
   sits over a page's boxes; with no stamp (the website's pages) it takes
   no room there. The end of the page keeps room for the button, as above,
   and a box reached with the keyboard stops clear of it. Too narrow there
   to keep the medicines' Yes/No column clear of it as well. */
@media (max-width: 40rem) {
  .corner-dock { position: static; padding-block: 0; }
  .corner-dock .feedback-button { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 40; }
  .version-tag { margin-block: 12px; }
  body:has(> .corner-dock .feedback-button) .yes-no-list { padding-right: 0; }
}
/* A phone in a short window as well (on its side, or a laptop zoomed in):
   the button waits at the end of the page with the stamp, as above (P-09). */
@media (max-width: 40rem) and (max-height: 37.5rem) {
  .corner-dock .feedback-button { position: static; margin-block: 12px; }
}
@media print {
  .corner-dock { display: none; }
  /* Nor the room kept for it at the end of a staff screen. */
  html:has(body > .corner-dock):not(:has(body > .site-footer)) { padding-bottom: 0; }
}

/* The version stamp: there to confirm a deploy landed, not to be read, but
   readable (12px at least) and full strength (WCAG 1.4.3). Beside the button,
   on its left, so the button sits in the same place on the system's pages,
   which have the stamp, as on the website's, which don't. */
.version-tag {
  order: -1;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted, var(--color-muted));
  cursor: pointer;
  user-select: none;
  background: var(--bg, var(--color-page));
  padding: 2px 6px;
  border-radius: 6px;
}
.version-tag:hover { opacity: 0.9; }
/* Drawn from this browser's memory, before the server has said which
   version is live (js/app.js): unseen, but keeping its place, so nothing
   moves when it's shown. Right after an update, the memory is the version
   before, and the stamp is the proof of which one is live. */
.version-tag.unconfirmed { visibility: hidden; }

/* "Report a problem": a deep-green pill, "Share feedback" on a computer and
   just "Feedback" on a phone. It sits beneath pop-ups (they start at 50),
   so it never covers their buttons; while its own panel is open it becomes
   that panel's round close button (below). */
.feedback-button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 7px 18px 7px 7px; font-family: inherit; font-size: 0.9rem; font-weight: 700; line-height: 1.3; text-align: left; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.10); background: linear-gradient(180deg, var(--primary, var(--olive)) 0%, var(--primary-dark, var(--color-band)) 100%); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 2px 6px rgba(20, 24, 18, 0.18), 0 12px 28px rgba(20, 24, 18, 0.28); cursor: pointer; }
.feedback-icon { flex: none; position: relative; width: 34px; height: 34px; border-radius: 50%; background: rgba(207, 164, 78, 0.18); box-shadow: inset 0 0 0 1px rgba(207, 164, 78, 0.45); color: var(--accent, var(--gold)); }
.feedback-icon::before { content: ""; --icon: var(--i-chat); position: absolute; inset: 7px; }
.feedback-long { font-size: 0.92rem; letter-spacing: 0.01em; }
.feedback-button:focus-visible { outline: 3px solid var(--accent, var(--gold)); outline-offset: 3px; }
.feedback-short { display: none; }
@media (hover: hover) {
  .feedback-button:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 10px rgba(20, 24, 18, 0.22), 0 16px 34px rgba(20, 24, 18, 0.32); }
  .feedback-button:hover .feedback-icon { background: rgba(207, 164, 78, 0.28); }
}
@media (max-width: 899px) {
  .feedback-button { gap: 8px; padding: 6px 16px 6px 6px; font-size: 0.85rem; }
  .feedback-icon { width: 32px; height: 32px; }
  .feedback-long { display: none; }
  .feedback-short { display: inline; }
}
/* On a narrow phone even "Feedback" would sit over a row's arrow: just the
   round icon there, 48px, its name (aria-label) the same for a screen
   reader. */
@media (max-width: 40rem) {
  .feedback-button { padding: 8px; }
  .feedback-short { display: none; }
}

/* A pop-up's own way in (js/feedback.js), where the corner's button is
   under its dimmed page (the owner, 2026-11-19): a small link at the
   pop-up's end, on its right, that opens the panel above it. */
.feedback-in-dialog { display: flex; width: fit-content; min-height: 32px; margin: 16px 0 0 auto; font-size: 0.85rem; }

/* The icons: the site's own copies (img/icons), each named once, drawn in
   the text's colour through this stylesheet's one icon utility (style.css
   has its own; the website's pages have only this one). */
:root {
  --i-x: url("../img/icons/x-bold.svg?v=d540487912a2");
  --i-chat: url("../img/icons/chat-teardrop-dots-duotone.svg?v=35a2b8181955");
  --i-problem: url("../img/icons/warning-circle-duotone.svg?v=d0b7e244c1e5");
  --i-idea: url("../img/icons/lightbulb-filament-duotone.svg?v=914c449a6475");
  --i-done: url("../img/icons/check-circle-duotone.svg?v=d9c7016e83a8");
  --i-send: url("../img/icons/paper-plane-tilt-bold.svg?v=e7e5b9e91760");
}
:is(.feedback-icon, .feedback-x, .feedback-kind-icon, .feedback-send, .feedback-done-icon)::before {
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* ── The feedback panel ───────────────────────────────────────────────────
   Opens from the Feedback button: on a computer it grows out of the
   bottom-right corner, just above the button (which becomes its close
   button); on a phone it's a sheet from the bottom edge that rides up with
   the keyboard (--kb, set by feedback.js). Either way it stays clear of
   a staff login's warning, which sits above it (--login-time-room: set by
   js/app.js while one shows; style.css .login-time). Same colours and
   fonts as everywhere else; the icons are the site's own copies
   (img/icons). */
.feedback-dialog { position: fixed; inset: 0; z-index: 100; background: rgba(20, 24, 18, 0.16); animation: feedback-fade 0.15s ease-out both; }
@keyframes feedback-fade { from { opacity: 0; } }
.feedback-panel {
  position: fixed; right: 24px; bottom: max(92px, var(--login-time-room, 0px)); width: min(400px, calc(100vw - 48px)); max-height: calc(100vh - 32px - max(92px, var(--login-time-room, 0px)));
  display: flex; flex-direction: column; overflow: hidden; background: var(--popup-bg, var(--color-surface)); border-radius: 22px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10), 0 28px 70px rgba(20, 24, 18, 0.35);
  transform-origin: bottom right; animation: feedback-rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes feedback-rise { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
.feedback-grip { display: none; }

.feedback-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 14px 18px 18px; color: #fff;
  background: var(--side-bg, var(--color-band));
}
.feedback-badge { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.feedback-badge .feedback-icon { width: 40px; height: 40px; background: transparent; box-shadow: none; }
.feedback-badge .feedback-icon::before { inset: 6px; }
.feedback-head-text { flex: 1; min-width: 0; }
.feedback-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: #fff; }
.feedback-head p { margin: 2px 0 0; font-size: 0.85rem; line-height: 1.4; color: rgba(255, 255, 255, 0.82); }
.feedback-x { flex: none; position: relative; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.10); color: #fff; cursor: pointer; }
.feedback-x::before { content: ""; --icon: var(--i-x); position: absolute; inset: 12px; }
@media (hover: hover) { .feedback-x:hover { background: rgba(255, 255, 255, 0.2); } }
.feedback-x:focus-visible { outline: 3px solid var(--accent, var(--gold)); outline-offset: 2px; }

.feedback-body { padding: 18px; overflow-y: auto; }
.feedback-kinds { border: 0; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feedback-kinds legend { font-weight: 700; font-size: 0.85rem; color: var(--label, var(--color-ink-2)); margin-bottom: 8px; padding: 0; }
.feedback-kind {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; text-align: left;
  border: 1.5px solid var(--border, var(--color-line)); border-radius: 14px; background: var(--field-bg, var(--color-field)); cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.feedback-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.feedback-kind-icon { flex: none; position: relative; width: 32px; height: 32px; border-radius: 10px; }
.feedback-kind-icon::before { content: ""; position: absolute; inset: 5px; }
.feedback-kind-icon.kind-problem { background: var(--danger-bg, var(--color-error-bg)); color: var(--danger, var(--color-error)); }
.feedback-kind-icon.kind-problem::before { --icon: var(--i-problem); }
.feedback-kind-icon.kind-idea { background: var(--warn-bg, var(--color-warning-bg)); color: var(--warn-text, var(--color-warning)); }
.feedback-kind-icon.kind-idea::before { --icon: var(--i-idea); }
.feedback-kind-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.feedback-kind-text strong { font-size: 0.88rem; color: var(--text, var(--color-ink)); }
.feedback-kind-text small { font-size: 0.75rem; color: var(--muted, var(--color-muted)); }
@media (hover: hover) { .feedback-kind:hover { border-color: var(--primary, var(--olive)); } }
.feedback-kind:has(input:checked) { border-color: var(--primary, var(--olive)); background: color-mix(in srgb, var(--primary, var(--olive)) 7%, var(--field-bg, var(--color-field))); box-shadow: 0 0 0 1px var(--primary, var(--olive)); }
.feedback-kind:has(input:focus-visible) { outline: 3px solid var(--accent, var(--gold)); outline-offset: 2px; }

.feedback-field { display: block; font-weight: 700; font-size: 0.85rem; color: var(--label, var(--color-ink-2)); }
.feedback-field > span { display: block; margin-bottom: 6px; }
.feedback-dialog .feedback-message {
  display: block; width: 100%; min-height: 110px; padding: 12px 14px; font: inherit; font-weight: 400; font-size: 1rem; line-height: 1.5;
  border: 1px solid var(--field-border, var(--color-control)); border-radius: 14px; background: var(--field-bg, var(--color-field)); color: var(--text, var(--color-ink)); resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.feedback-dialog .feedback-error { margin: 10px 0 0; }

.feedback-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 18px; border-top: 1px solid var(--border, var(--color-line)); }
.feedback-note { margin: 0; font-size: 0.78rem; color: var(--muted, var(--color-muted)); }
.feedback-foot .btn-primary { min-height: 44px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.feedback-send::before { content: ""; --icon: var(--i-send); width: 17px; height: 17px; }
.feedback-panel.is-done .feedback-foot { justify-content: center; border-top: 0; padding-top: 0; }
.feedback-done { text-align: center; padding: 10px 0 2px; }
.feedback-done-icon { display: block; position: relative; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok-bg, var(--color-success-bg)); color: var(--ok-text, var(--color-success)); animation: feedback-pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1.4) both; }
.feedback-done-icon::before { content: ""; --icon: var(--i-done); position: absolute; inset: 14px; }
@keyframes feedback-pop { from { transform: scale(0.6); opacity: 0; } }
.feedback-done h3 { margin: 0 0 4px; font-size: 1.2rem; font-weight: 800; color: var(--emphasis, var(--color-ink)); }
.feedback-done p { margin: 0; color: var(--muted, var(--color-muted)); }

/* While it's open, the button is the panel's close button: a round X. */
.feedback-button.is-open { z-index: 110; padding: 7px; }
.feedback-button.is-open :is(.feedback-long, .feedback-short) { display: none; }
.feedback-button.is-open .feedback-icon::before { inset: 10px; --icon: var(--i-x); }

@media (max-width: 899px) {
  .feedback-dialog { background: rgba(20, 24, 18, 0.38); }
  .feedback-panel {
    left: 0; right: 0; bottom: var(--login-time-room, var(--kb, 0px)); width: 100%; max-height: calc(100dvh - 24px - var(--login-time-room, var(--kb, 0px)));
    border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom);
    transform-origin: bottom center; animation: feedback-sheet 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  @keyframes feedback-sheet { from { transform: translateY(100%); } }
  .feedback-grip { display: block; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 99px; background: rgba(255, 255, 255, 0.45); }
  .feedback-head { padding-top: 24px; }
  .feedback-kind { flex-direction: column; align-items: flex-start; gap: 8px; }
  .feedback-button.is-open { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .feedback-dialog, .feedback-panel, .feedback-done-icon { animation: none; }
}

/* On the website's own pages (no style.css): the panel's Send button in the
   site's own primary look, and its message in the site's notice colours. */
:root:not(:has(link[href*="css/style.css"], link[href*="css/legacy.css"])) .feedback-dialog .btn-primary {
  border: 0; border-radius: var(--radius-s, 4px); background: var(--btn-primary-bg); color: var(--btn-primary-ink);
  font: 700 0.95rem / 1.2 var(--font-head); cursor: pointer;
}
:root:not(:has(link[href*="css/style.css"], link[href*="css/legacy.css"])) .feedback-dialog .notice {
  padding: 10px 14px; border-radius: var(--radius-s, 4px); background: var(--color-warning-bg); color: var(--color-warning); font-size: 0.875rem; line-height: 1.5;
}
