/* B's T218 hand-off: a ticket reads like a message conversation. The plain look for E to restyle and fold into
   app.css (it overrides app.css's old timeline rules, which stay for nothing else).
   The person who asked: bubbles on the left, the surface colour. Everyone answering: on the right, a tint of the
   brand's accent. State changes: one small centred line. The message bar: pinned under the thread. */

/* ---- the head: title, then state · id · who · when, with Approve and More actions on the same row ---- */
.ticket-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: -8px; }
.ticket-top .ticket-buttons { margin: 0; }
.ticket-notes[hidden] { display: none; }

/* ---- the thread ---- */
.timeline-list.chat-thread { padding: 0; border-left: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline-list.chat-thread > li.bubble {
  max-width: min(78%, 620px); width: fit-content; min-width: 0; padding: 8px 12px 10px; display: grid; gap: 4px;
  border: var(--line); border-radius: 16px; font-size: var(--t-ui); overflow-wrap: anywhere;
}
.timeline-list.chat-thread > li.bubble.side-opener { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
.timeline-list.chat-thread > li.bubble.side-desk {
  align-self: flex-end; border-bottom-right-radius: 4px; color: var(--fg);
  background: var(--accent-soft); background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--surface));
}
.timeline-list.chat-thread > li.bubble.grouped { margin-top: -6px; }
.timeline-list.chat-thread > li.bubble .tl-head { font-size: var(--t-small); color: var(--fg-soft); }
.timeline-list.chat-thread > li.bubble .tl-head strong { color: var(--fg); }
.timeline-list.chat-thread > li.bubble .ticket-body { background: transparent; border: 0; padding: 0; white-space: pre-wrap; }
.timeline-list.chat-thread > li.bubble .ticket-action { font-size: var(--t-small); padding-top: 4px; border-top: 1px dashed var(--outline); }
.timeline-list.chat-thread > li.bubble .ticket-pics { margin-top: 2px; }
/* the automatic reply: on the right, quieter */
.timeline-list.chat-thread > li.bubble.tl-auto { background: transparent; border-style: dotted; font-size: var(--t-small); color: var(--ink-soft); }
/* only visible to staff (and the ticket helper's drafts): a dashed bubble */
.timeline-list.chat-thread > li.bubble.tl-internal { background: var(--warn-bg); border: 2px dashed var(--outline); }
.timeline-list.chat-thread > li.bubble.sending { opacity: .6; }

/* a state change or event: one small centred line */
.timeline-list.chat-thread > li.tl-event {
  align-self: center; max-width: 90%; text-align: center; background: transparent; border: 0; padding: 2px 8px;
  font-size: var(--t-small); color: var(--fg-soft); display: block;
}
.timeline-list.chat-thread > li.tl-event .state { font-size: var(--t-tiny); padding: 0 8px; }

/* ---- the message bar, pinned under the thread ---- */
.chat-bar {
  display: grid; gap: 6px; padding: 10px 12px;
  background: var(--surface); border: 0; border-radius: var(--panel-r, 14px); box-shadow: none;   /* T213 (E): the panel surface, no ring; the text box keeps its focus edge */
}
.chat-bar .bar-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-bar textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; resize: none; font: 400 var(--t-ui)/var(--lh-body) var(--body); }
.chat-bar .attach, .chat-bar .send { min-height: 44px; flex: none; }
.chat-bar .attach { min-width: 44px; padding: 0 10px; cursor: pointer; font-size: 18px; }
.chat-bar .attach:focus-within { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; }
.chat-bar .bar-pics { align-items: center; }
.chat-bar .bar-pics[hidden], .chat-bar .bar-error[hidden] { display: none; }
.chat-bar .bar-pics .ticket-pic { width: 72px; height: 54px; }
.chat-bar .bar-hint { margin: 0; font-size: var(--t-tiny); }
.chat-bar .note-kind { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.chat-bar .note-kind .note-where { flex-basis: 100%; margin: 0; }
.chat-bar .staff-only, .chat-bar .note-kind .tick { min-height: 32px; }
.ticket-foot { position: sticky; bottom: 0; z-index: 2; padding: 8px 0 10px; background: var(--bg); }   /* the bar stays in view as the thread scrolls */

@media (max-width: 899px) {
  .timeline-list.chat-thread > li.bubble { max-width: 86%; }
  .chat-bar { padding: 8px; border-radius: var(--r-md); }
  .chat-bar .bar-hint { display: none; }
  .chat-bar .staff-only, .chat-bar .note-kind .tick { min-height: 44px; }
}

/* staff-only: no picture (everyone on the ticket sees pictures) */
.chat-bar .attach.off { opacity: .4; cursor: not-allowed; }
.chat-bar .bar-no-picture { margin: 0; font-size: var(--t-small); }
.chat-bar .bar-no-picture[hidden] { display: none; }
/* pictures the server gives no time for: one neutral row under the thread */
.timeline-list.chat-thread > li.tl-files .ticket-pics { justify-content: center; margin-top: 4px; }

/* the phone: the bar sits above the fixed SIVRO mark in the corner, never under it */
@media (max-width: 899px) {
  .ticket-foot { padding-bottom: 30px; }
}
