/* One conversation on a staff ticket (GitHub issue 599, the owner's U3; docs/adr/0354-one-conversation.md;
   public/js/app/ticket-conversation.js). Above the messages: the filters with their counts at the left, then Summarize,
   the order and Full audit log; under them one line when there is something to say; the summary box; then the messages,
   or Changes in the audit log's format. Wider than a phone there are no tabs. The filters wrap rather than scroll; long
   words wrap, nothing is cut. Colors are the palette's tokens, so the dark theme follows. */

/* Wider than a phone the conversation is the one thing here: no tabs. */
.tp:not(.tpb-phone) .detail-tabs { display:none; }

.cv-bar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:var(--space-100) var(--space-200); margin:0; }
.cv-filters { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-75); min-width:0; }
.cv-filter { display:inline-flex; align-items:center; gap:var(--space-50); min-height:var(--control-height-sm, 34px); padding:var(--space-25) var(--space-150); border:1px solid var(--line-strong); border-radius:var(--radius-pill); background:var(--surface); color:var(--ink-2); font:inherit; font-size:var(--text-sm); font-weight:var(--weight-semibold); white-space:nowrap; cursor:pointer; }
.cv-filter:hover { color:var(--ink); border-color:var(--ink-2); }
.cv-filter[aria-pressed="true"] { border-color:var(--spruce); background:var(--spruce); color:var(--brand-ink, var(--surface)); }
.cv-filter:focus-visible { outline:2px solid var(--spruce); outline-offset:2px; }
.cv-count { font-weight:var(--weight-medium, 500); opacity:.85; }
.cv-tools { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-50) var(--space-150); min-width:0; }
.cv-tools .nt-link { min-height:var(--control-height-sm, 34px); font-size:var(--text-sm); white-space:nowrap; }
.cv-tools .cv-summarize[hidden] { display:none; }
.cv-sort select { min-height:var(--control-height-sm, 34px); padding:var(--space-25) var(--space-100); border:1px solid var(--line-strong); border-radius:var(--radius-md); background:var(--surface); color:var(--ink); font:inherit; font-size:var(--text-sm); }
.cv-sort select:focus-visible { outline:2px solid var(--spruce); outline-offset:2px; }
@media (forced-colors:active) { .cv-filter[aria-pressed="true"] { border-width:2px; forced-color-adjust:none; background:Highlight; color:HighlightText; } }

.cv-status[hidden] { display:none; }
.cv-status { margin:0; color:var(--muted); font-size:var(--text-sm); overflow-wrap:anywhere; }

/* The summary box: the AI card's summary, above the conversation. */
.cv-summary[hidden] { display:none; }
.cv-summary { display:grid; gap:var(--space-100); padding:var(--space-150) var(--space-200); border:1px solid var(--line); border-radius:var(--radius-xl); background:var(--surface-2); color:var(--ink); overflow-wrap:anywhere; }
.cv-summary-head { display:flex; flex-wrap:wrap; align-items:baseline; gap:var(--space-50) var(--space-150); }
.cv-summary-words { flex:1 1 12rem; min-width:0; }
.cv-summary-words h3 { display:inline; margin:0 var(--space-100) 0 0; font-size:var(--text-md); font-weight:var(--weight-semibold); }
.cv-summary-words small { color:var(--muted); font-size:var(--text-sm); }
.cv-summary .ai-answer { font-size:var(--text-md); line-height:var(--leading-normal); }
.cv-summary-wait { margin:0; color:var(--muted); }

/* The filter: an item it leaves out isn't shown; Changes shows its blocks in place of the messages. */
.tp #commentHistory > [hidden] { display:none !important; }
.tp-conversation > .comment-history.cv-away { display:none !important; }
/* A filter of messages shows its list even when the first message is among those it leaves out. */
.tp-conversation > .comment-history.cv-filtered:has(> .comment-item.posted:not([hidden])) { display:grid; }
.cv-changes[hidden] { display:none; }
.cv-changes { min-width:0; }
.cv-changes .at-day-head { position:static; background:transparent; }

/* The audit trail and the tasks in a peek (ticket-peek.js): the trail wider, and a page of its own on a phone. */
.pk-host { min-width:0; }
.pk-host > .audit-panel { display:flex; flex-direction:column; gap:var(--space-150); margin:0; padding:0; border:0; box-shadow:none; background:transparent; }
.pk-host > .audit-panel > .audit-log-heading { display:none; }
.pk-host > .audit-panel > .audit-log { margin-top:0; border-top:0; }
.pk-host > .tasks-panel, .pk-host > section { margin:0; padding:0; border:0; box-shadow:none; background:transparent; }
/* The peek is narrow: the task, who and when two by two, Add task under them. */
.ticket-detail.tp .pk-host .tp-task-add .task-composer-row { grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); }
.ticket-detail.tp .pk-host .tp-task-add .task-composer-row > :first-child, .ticket-detail.tp .pk-host .tp-task-add #addTaskButton { grid-column:1 / -1; }
.pk-panel.pk-wide { width:min(640px, 100vw); }

/* Live chat's block (GitHub issue 572; server-integration.js chatBlockHeadHtml): a line above a chat's first message with
   its time span, the people in it, how many messages and its outcome; after it ends, its messages folded under it in All
   until Show messages. Public and Private list every message they show, folded or not. */
.comment-item.lc-head { border-left-style:double; border-left-width:4px; }
.lc-avatar { background:var(--spruce-pale); color:var(--spruce-dark); }
.lc-avatar svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linejoin:round; }
.lc-line { color:var(--ink-2); overflow-wrap:anywhere; }
.lc-live { display:inline-block; padding:0 var(--space-75); border-radius:var(--radius-pill); background:var(--spruce-pale); color:var(--spruce-dark); font-size:var(--text-2xs); font-weight:var(--weight-semibold); }
.lc-toggle { min-height:var(--control-height-sm, 34px); font-size:var(--text-sm); }
#commentHistory:not(.cv-filtered) .comment-item.lc-folded { display:none; }
.comment-item.lc-msg:not(.lc-head) { margin-left:var(--space-300); }

@media (max-width:700px) {
  .comment-item.lc-msg:not(.lc-head) { margin-left:var(--space-150); }
  .lc-toggle { min-height:44px; }
  .cv-bar { align-items:flex-start; }
  .cv-filter, .cv-tools .nt-link, .cv-sort select, .cv-sort .custom-select-trigger { min-height:44px; }
  .pk-panel.pk-page { top:0; bottom:0; max-height:none; border-top:0; border-radius:0; }
}
@media print { .cv-bar, .cv-status { display:none; } #commentHistory .comment-item.lc-folded { display:flex; } .lc-toggle { display:none; } }
