/* Live chat: the agent's page and the chats docked beside the ticket (GitHub issue 578; public/js/app/live-chat-agent.js).
   Long words wrap; nothing is cut with an ellipsis. Every sound has a visual twin here (the pulsing card), and reduced
   motion turns the pulse into an outline that stays. */
.lca-grid { margin-top:var(--space-200); }
.lca-list { list-style:none; margin:0; padding:0; display:grid; gap:var(--space-75); }
.lca-wait, .lca-mine-row { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-75) var(--space-150); padding:var(--space-100) 0; border-bottom:1px solid var(--line); }
.lca-wait:last-child, .lca-mine-row:last-child { border-bottom:0; }
.lca-wait-main { display:grid; gap:var(--space-25); flex:1 1 14rem; min-width:0; overflow-wrap:anywhere; }
.lca-wait-meta { color:var(--ink-2); font-size:var(--text-sm); font-variant-numeric:tabular-nums; }
.lca-wait-actions { display:flex; flex-wrap:wrap; gap:var(--space-100); }
.lca-tag { 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-xs); font-weight:600; }
.lca-tag.warn { background:var(--saffron-pale); color:var(--ink); }
.lca-count, .lca-unread { display:inline-grid; place-items:center; min-width:1.5em; padding:0 var(--space-50); border-radius:var(--radius-pill); background:var(--spruce-dark); color:#fff; font-size:var(--text-xs); font-weight:700; }
.lca-warning { margin:0; padding:var(--space-100) var(--space-150); border:1px solid var(--saffron, var(--line)); border-radius:var(--radius-md); background:var(--saffron-pale); color:var(--ink); }
.lca-sound-row { display:flex; flex-wrap:wrap; align-items:flex-end; gap:var(--space-100); }
.lca-sound-row label, .lca-volume { display:grid; gap:var(--space-50); font-weight:600; }
.lca-volume input { width:min(100%, 16rem); }
.lca-check { display:flex; align-items:center; gap:var(--space-75); font-weight:600; }
.lca-pulse { outline:2px solid var(--spruce); outline-offset:2px; animation:lca-pulse 1.6s ease-in-out infinite; }
@keyframes lca-pulse { 50% { outline-color:transparent; } }
@media (prefers-reduced-motion:reduce) { .lca-pulse { animation:none; } }

/* The dock: beside the ticket on a wide screen, over it on a narrow one, with Minimize to a pill. */
.lca-dock { position:fixed; top:0; right:0; bottom:0; z-index:var(--z-drawer); display:flex; flex-direction:column; width:min(400px, 100vw); border-left:1px solid var(--line); background:var(--surface); box-shadow:-8px 0 24px rgba(39,51,47,.12); }
.lca-dock[hidden], .lca-pill[hidden] { display:none; }
@media (min-width:1100px) { body.lca-docked .main-content { padding-right:400px; } }
.lca-dock-head { display:flex; align-items:flex-start; gap:var(--space-100); padding:var(--space-100); border-bottom:1px solid var(--line); background:var(--surface-2); }
.lca-tabs { display:flex; flex-wrap:wrap; gap:var(--space-50); flex:1; min-width:0; }
.lca-tab { display:inline-flex; align-items:center; gap:var(--space-50); max-width:100%; min-height:36px; padding:0 var(--space-150); border:1px solid var(--line); border-radius:var(--radius-pill); background:var(--surface); color:var(--ink-2); font:inherit; font-size:var(--text-sm); text-align:left; overflow-wrap:anywhere; cursor:pointer; }
.lca-tab.active { border-color:var(--spruce); color:var(--spruce-dark); font-weight:700; }
.lca-tab.ended { border-style:dashed; }
.lca-dock-actions { display:flex; flex-wrap:wrap; gap:var(--space-50); }
.lca-panel { display:flex; flex-direction:column; flex:1; min-height:0; }
.lca-chat-head { padding:var(--space-100) var(--space-150); border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.lca-chat-head p { margin:var(--space-25) 0 0; color:var(--ink-2); font-size:var(--text-sm); }
.lca-log { list-style:none; flex:1; min-height:0; margin:0; padding:var(--space-150); overflow-y:auto; display:flex; flex-direction:column; gap:var(--space-100); }
.lca-msg { max-width:88%; padding:var(--space-75) var(--space-100); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-2); overflow-wrap:anywhere; }
.lca-msg.from-agent { align-self:flex-end; background:var(--spruce-pale); border-color:transparent; }
.lca-msg.note { align-self:flex-end; background:var(--saffron-pale); border-style:dashed; border-color:var(--saffron, var(--line)); }
.lca-msg.from-featsuite { align-self:center; background:transparent; border-style:dashed; color:var(--ink-2); font-size:var(--text-sm); }
.lca-msg p { margin:0; }
.lca-msg-head { display:flex; flex-wrap:wrap; gap:var(--space-50); align-items:baseline; font-size:var(--text-xs); color:var(--ink-2); }
.lca-msg-text { white-space:pre-wrap; }
.lca-seen, .lca-typing { margin:0; padding:0 var(--space-150); min-height:1.25em; color:var(--ink-2); font-size:var(--text-xs); text-align:right; }
.lca-typing { text-align:left; }
.lca-ended { display:grid; gap:var(--space-100); padding:var(--space-150); border-top:1px solid var(--line); background:var(--saffron-pale); }
.lca-ended[hidden], .lca-compose[hidden], .lca-picker[hidden] { display:none; }
.lca-ended p { margin:0; }
.lca-compose { position:relative; display:grid; gap:var(--space-75); padding:var(--space-100) var(--space-150) var(--space-150); border-top:1px solid var(--line); }
.lca-mode { display:flex; flex-wrap:wrap; gap:var(--space-150); font-size:var(--text-sm); font-weight:600; }
.lca-mode label { display:inline-flex; align-items:center; gap:var(--space-50); min-height:32px; }
.lca-text { box-sizing:border-box; width:100%; min-height:72px; resize:vertical; padding:var(--space-100); border:1px solid var(--line); border-radius:var(--radius-md); font:inherit; background:var(--surface); color:var(--ink); }
.lca-text.note { background:var(--saffron-pale); border-style:dashed; }
.lca-tools { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-50) var(--space-100); }
.lca-tools .save-button { margin-left:auto; }
.lca-picker { position:absolute; left:var(--space-150); right:var(--space-150); bottom:calc(100% - var(--space-100)); display:grid; grid-template-rows:auto minmax(0, 1fr); gap:var(--space-75); max-height:min(320px, 60vh); overflow:hidden; padding:var(--space-100); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); box-shadow:0 12px 25px rgba(39,51,47,.16); }
.lca-picker-search { box-sizing:border-box; width:100%; padding:var(--space-75) var(--space-100); border:1px solid var(--line); border-radius:var(--radius-md); font:inherit; }
.lca-picker-list { display:grid; align-content:start; gap:var(--space-50); min-height:0; overflow-y:auto; }
.lca-line { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-50); }
.lca-picker-list button { display:grid; gap:var(--space-25); padding:var(--space-75) var(--space-100); border:1px solid transparent; border-radius:var(--radius-md); background:none; color:var(--ink); font:inherit; text-align:left; overflow-wrap:anywhere; cursor:pointer; }
.lca-picker-list button:hover, .lca-picker-list button:focus-visible { border-color:var(--line); background:var(--surface-2); }
.lca-picker-list small { color:var(--ink-2); }
.lca-pill { position:fixed; right:var(--space-200); bottom:var(--space-200); z-index:var(--z-drawer); min-height:44px; padding:0 var(--space-200); border:0; border-radius:var(--radius-pill); background:var(--spruce-dark); color:#fff; font:inherit; font-weight:700; box-shadow:0 8px 20px rgba(39,51,47,.2); cursor:pointer; }
.lca-outcomes { display:grid; gap:var(--space-75); margin:var(--space-150) 0 0; padding:0; border:0; }
.lca-outcomes legend { font-weight:700; font-size:var(--text-xs); color:var(--muted); }
.modal .lca-outcomes label { display:flex; align-items:center; gap:var(--space-75); margin:0; color:var(--ink); font-weight:500; font-size:var(--text-sm); }
.modal .lca-outcomes input { display:inline-block; width:auto; margin:0; }
@media (max-width:700px) { .lca-dock { width:100vw; border-left:0; } .lca-tab, .lca-tools button, .lca-wait-actions button, .lca-dock-actions button { min-height:44px; } }

/* Toasts keep clear of the docked chat (the review of GitHub issue 578): beside the dock on a wide screen, and at the
   top where the dock fills the screen (a phone, a chat in its own window), never over the reply box, Send, Transfer or
   End chat. One not showing takes no click. */
body.lca-docked .toast { right:calc(400px + var(--space-300) + env(safe-area-inset-right, 0px)); max-width:min(32rem, calc(100vw - 400px - 2 * var(--space-300))); }
@media (max-width:700px) { body.lca-docked .toast { top:calc(var(--viewport-gap) + env(safe-area-inset-top, 0px)); bottom:auto; right:calc(var(--viewport-gap) + env(safe-area-inset-right, 0px)); max-width:none; } }
body.lca-popout .toast { top:calc(var(--viewport-gap) + env(safe-area-inset-top, 0px)); bottom:auto; right:calc(var(--viewport-gap) + env(safe-area-inset-right, 0px)); left:calc(var(--viewport-gap) + env(safe-area-inset-left, 0px)); max-width:none; }
body.lca-docked .toast:not(.show), body.lca-popout .toast:not(.show) { pointer-events:none; }

/* The profile photo in User settings (what an employee sees inside a chat). */
.lca-photo-row { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-150); }
.lca-photo { display:inline-grid; place-items:center; width:64px; height:64px; border-radius:var(--radius-round); object-fit:cover; background:var(--spruce-pale); color:var(--spruce-dark); font-size:var(--text-2xl); font-weight:700; }
.lca-photo-pick { position:relative; display:inline-flex; align-items:center; min-height:var(--control-height); cursor:pointer; }
.lca-photo-pick:focus-within { outline:var(--focus-ring-width) solid var(--spruce); outline-offset:2px; }

/* The Supervisors' live board (GitHub issue 580; public/js/app/live-chat-board.js), at the top of the Live chat page,
   and what the dock shows of a watch and a whisper. Long words wrap; nothing is cut. */
#lcbBoard { margin-top:var(--space-200); }
.lcb-card { display:grid; gap:var(--space-150); }
.lcb-head h2 { margin:0; }
.lcb-head p { margin:var(--space-25) 0 0; }
.lcb-summary { list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:var(--space-75); }
.lcb-summary li { padding:var(--space-50) var(--space-150); border:1px solid var(--line); border-radius:var(--radius-pill); background:var(--surface-2); font-weight:600; font-variant-numeric:tabular-nums; }
.lcb-summary li.lcb-has-flags { border-color:var(--saffron, var(--line)); background:var(--saffron-pale); color:var(--ink); }
.lcb-section h3 { margin:0 0 var(--space-75); font-size:var(--text-md); }
.lcb-section > .wf-hint { margin:0; }
.lcb-flag { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-75) var(--space-150); padding:var(--space-100) var(--space-150); border-left:4px solid var(--saffron, var(--line)); border-radius:var(--radius-md); background:var(--saffron-pale); color:var(--ink); }
.lcb-flag-words { flex:1 1 16rem; min-width:0; overflow-wrap:anywhere; font-weight:600; }
.lca-watched, .lca-watching-note { margin:0; padding:var(--space-75) var(--space-150); border-bottom:1px solid var(--line); background:var(--spruce-pale); color:var(--spruce-dark); font-size:var(--text-sm); font-weight:600; overflow-wrap:anywhere; }
.lca-watched[hidden] { display:none; }
.lca-msg.whisper { border-style:dotted; border-width:2px; }
/* The AI's summary of a chat it handed over (GitHub issue 579), on the offer and the chat's header, with its line
   breaks; and the AI's own notes in the chat, on the employee's side, never an agent's. */
.lca-ai-summary { display:grid; gap:var(--space-25); margin-top:var(--space-50); padding:var(--space-75) var(--space-100); border-left:3px solid var(--line); border-radius:var(--radius-md); background:var(--surface-2); font-size:var(--text-sm); overflow-wrap:anywhere; }
.lca-ai-summary p { margin:0; }
.lca-ai-summary-text { white-space:pre-line; }
.lca-msg.from-ai { align-self:flex-start; border-style:dashed; }

/* A chat in a window of its own: only the dock, filling it. */
body.lca-popout > *:not(.lca-dock):not(.modal-backdrop):not(.toast):not(#lcaAnnounce):not(script):not(.icon-sprite) { display:none !important; }
body.lca-popout .lca-dock { width:100vw; border-left:0; box-shadow:none; }
