/* Buddy's panel (editor/buddy-panel.js; docs/research/2026-11-04-buddy-panel.md section 3): open beside the screen,
   minimised to a round button with a dot, or closed with a "Buddy" button in the top bar; full screen on a phone with
   the input above the keyboard. Controls at least 44 by 44 pixels; the dot is never colour alone (its words are in the
   button's name). */
.buddy-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.buddy-head h2 { margin: 0; flex: 1 1 auto; font-size: 20px; }
.buddy-face { flex: none; display: inline-flex; padding-top: 6px; }
/* The head's own actions are quiet: smaller outlined buttons, still 44 pixels high. */
/* On a laptop the actions get a row of their own under Buddy; on a phone they stay beside him, so the head stays low. */
@media (width >= 700px) { .buddy-actions { flex: 1 1 100%; } }
.buddy-head .secondary { padding: 6px 14px; border-width: 1px; border-color: var(--line); color: var(--text); font-weight: 600; font-size: 14px; }
.buddy-head .secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--paper); }
.buddy-actions { gap: 6px; }
.buddy-head button, .buddy-send button, .older { min-height: 44px; min-width: 44px; }
.buddy-send { display: flex; flex-direction: column; gap: 8px; }
.msg.pending { opacity: .7; }
/* Buddy's answer while he writes it: a cursor at its end, still for whoever asks for less motion. */
.msg.streaming::after { content: "▍"; margin-left: 1px; opacity: .6; animation: buddy-cursor 1s steps(2, start) infinite; }
@keyframes buddy-cursor { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .msg.streaming::after { animation: none; } }
.buddy-status { margin: 0; }
.buddy-status:empty { display: none; }
.conversation-list h3 { font-size: 16px; margin: 4px 0; }
.conversation-list ul.conversations { list-style: none; padding: 0; margin: 0 0 8px; }
.conversation-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.conversation-list li.current > button.link { font-weight: 700; }
.conversation-list li button { min-height: 44px; min-width: 44px; }
.conversation-list li > .muted { font-size: 13px; }
.conversation-list form { flex: 1 1 100%; }
.conversation-list input { flex: 1 1 10rem; min-height: 44px; font-size: 16px; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; padding: 8px 0; text-align: left; cursor: pointer; flex: 1 1 10rem; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); margin-right: 6px; vertical-align: middle; }
.has-dot { position: relative; }
/* A ring around the dot, so it stands out on the round button's accent colour too (WCAG 1.4.11, 3:1). */
.has-dot::after { content: ''; position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--panel); }
.buddy-fab.has-dot::after { top: 8px; right: 8px; box-shadow: 0 0 0 2px var(--on-orange); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.buddy-fab { display: none; position: fixed; right: 20px; bottom: 20px; z-index: 20; width: 64px; height: 64px; border-radius: 20px; border: 0; background: var(--orange); color: var(--on-orange); font: inherit; font-weight: 800; cursor: pointer; box-shadow: var(--shadow-lift); }
.buddy-top { display: none; min-height: 44px; margin-left: auto; }

@media (width >= 700px) {
  body[data-buddy="minimised"] aside#buddy, body[data-buddy="closed"] aside#buddy { display: none; }
  body[data-buddy="minimised"] .buddy-fab { display: block; }
  body[data-buddy="closed"] .buddy-top { display: inline-flex; align-items: center; }
  .only-wide { display: inline-flex; align-items: center; }
}
@media (width >= 1100px) {
  body[data-buddy="minimised"] .layout, body[data-buddy="closed"] .layout { grid-template-columns: 180px minmax(0, 1fr); }
}
@media (width < 700px) {
  .only-wide { display: none; }
  .buddy-head .only-narrow { display: inline-flex; align-items: center; }
  .buddy-fab, .buddy-top { display: none !important; }
  .buddy-face svg { width: 2rem; height: 2rem; }
  /* Full screen, the panel scrolls as a whole when its parts do not fit (a photo waiting, long lines), so Versturen
     is always within reach: a fixed height without scrolling pushed it out of sight on a narrow screen. */
  body[data-screen='buddy'] aside#buddy { overflow-y: auto; }
  /* While typing the bottom bar steps aside; the panel then takes the visual viewport, which the keyboard shrinks and
     Safari also scrolls (--vv-height and --vv-top, set by buddy-panel.js from visualViewport). */
  body.typing[data-screen="buddy"] aside#buddy { position: fixed; left: 0; right: 0; top: var(--vv-top, 0); height: var(--vv-height, 100dvh); z-index: 15; }
}
.buddy-offer { margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.buddy-offer p { margin: 6px 0; overflow-wrap: anywhere; }
.buddy-offer .note { font-weight: 600; }
.buddy-offer input[type="text"] { width: 100%; box-sizing: border-box; }

/* Photos for Buddy (B2): the button beside Versturen, the box with the line, and photos small in a message. */
.buddy-send-buttons { display: flex; gap: 8px; }
.buddy-send-buttons .buddy-photo-button { flex: 0 0 auto; min-height: 44px; }
.buddy-send-buttons button[type="submit"] { flex: 1 1 auto; }
.buddy-attach { margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.buddy-attach p { margin: 6px 0; overflow-wrap: anywhere; }
.buddy-attach .note { font-weight: 600; }
.buddy-attach .attached { display: flex; gap: 8px; flex-wrap: wrap; }
.buddy-attach .attached-photo { display: grid; gap: 4px; justify-items: start; }
.buddy-attach .attached-photo img, .msg-photos .msg-photo { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius); }
.msg-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
