/* rag-ai-thread.css 1.5.4 (07.11.2026: the attach menu in the thread no longer shifted off the left edge on the phone); 1.5.3 (07.11.2026: the maximized field's buttons centred on its row);1.5.2 (07.11.2026: the check mark of a closed thread in its chip) —the thread panel and its buttons (user, 03.11.2026, D1a). Colors from rag-ai.css tokens. */

/* "Răspunde în fir" in the corner of a message or an answer, and the "N în fir" chip under an answer */
.thread-open { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0;
  color: var(--muted); background: transparent; border: none; border-radius: 4px; cursor: pointer; opacity: .55; }
.thread-open:hover, .thread-open:focus-visible { opacity: 1; color: var(--acc); }
.thread-chip { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 2px 10px; font: inherit;
  font-size: 12px; font-weight: 600; color: #fff; background: var(--acc); border: 1px solid var(--acc);
  border-radius: 999px; cursor: pointer; }

/* The state of the thread's last message in the chip (1.3.2): a dot — amber and pulsing while the agent works, green when
   finished, grey for a message waiting or cancelled — and, in the chip under the answer, its word */
.thread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9aa4b2; box-shadow: 0 0 0 1px #fff; }
.thread-dot-running { background: #f5a524; animation: thread-pulse 1.2s ease-in-out infinite; }
.thread-dot-processed { background: #2ecc71; }
@keyframes thread-pulse { 50% { opacity: .35; } }
/* Waiting for the user's answer to a question: a pulsing question mark in place of the dot (1.3.3) */
.thread-ask { font-size: 13px; line-height: 1; color: #f5a524; animation: thread-pulse 1.2s ease-in-out infinite; }

/* A thread marked closed: a green check mark in its chip, in the conversation (1.5.2) */
.thread-done-mark { font-size: 14px; line-height: 1; color: #2ecc71; }

/* The count in the message's header: shown only while the message is collapsed (the answer, with its own chip, is
   hidden then); the header wraps on a narrow screen */
.thread-chip-head { display: none; margin-top: 0; }
.msg.mine.qa-collapsed .thread-chip-head { display: inline-flex; }
.msg.mine .meta { flex-wrap: wrap; }

/* The message the open thread started from: orange frame around the question and its answer (1.5.0) */
.msg.thread-origin { outline: 3px solid var(--flag-orange, #ca5010); outline-offset: 2px; }

/* A message and its answer that have a thread are marked on the left, so they stand out in the conversation */
.msg.has-thread { border-left: 4px solid var(--acc); }

/* The top bar's "Fire" button, with the number of threads */
.bar-btn[hidden] { display: none; }
#thread-list-bar { position: relative; }
#thread-list-bar .bar-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; color: #fff; background: var(--acc);
  border-radius: 999px; }

/* The panel: on the right on a computer, the whole screen on a phone */
.thread-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(440px, 100vw); display: flex;
  flex-direction: column; background: var(--bg); color: var(--fg); border-left: 3px solid var(--acc);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .25); }
.thread-panel[hidden] { display: none; }
.thread-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--panel); }
.thread-title { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Maximized thread (1.4.1): the panel covers the whole screen and looks like the standard conversation — the same
   70% column (15% side margins, as in rag-ai.css) and the same one-row message field with the buttons on its line */
.thread-panel.thread-maximized { width: 100vw; border-left: none; }
.thread-maximized .thread-list { padding: 16px calc(15% + 14px); gap: 14px; }
.thread-maximized .thread-files { padding-left: calc(15% + 14px); padding-right: calc(15% + 14px); }
.thread-maximized .thread-composer { padding: 10px calc(15% + 14px); }
.thread-maximized .th-mine { max-width: 92%; margin-left: 0; }
.thread-maximized .thread-box { display: flex; align-items: center; gap: 4px; padding: 4px; }
.thread-maximized .thread-composer textarea { order: 1; flex: 1; min-width: 0; width: auto; min-height: 0; max-height: 160px;
  padding: 7px 8px; }
.thread-maximized .thread-tools { display: contents; }
.thread-maximized .thread-tools-gap { display: none; }
.thread-maximized .thread-attach { order: 0; }
.thread-maximized .thread-mic, .thread-maximized .thread-send { order: 2; }
.thread-close, .thread-back, .thread-done, .thread-max { font: inherit; width: 28px; height: 28px; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.thread-back[hidden], .thread-done[hidden] { display: none; }
/* Mark the thread closed / reopen it (1.3.0): filled once the thread is closed */
.thread-done.is-closed { color: var(--bg); background: var(--acc); border-color: var(--acc); }
.thread-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.th-root { padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.th-mine { align-self: flex-end; margin-left: 24px; padding: 8px 11px; background: var(--mine);
  border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.th-ai { margin-top: 8px; padding: 8px 11px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow-wrap: anywhere; }
.th-who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.th-reply { display: flex; flex-direction: column; }
.thread-title { cursor: text; }
.thread-title-input { flex: 1; min-width: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--fg);
  background: var(--bg); border: 1px solid var(--acc); border-radius: 4px; padding: 3px 6px; }

/* The list of the conversation's threads */
.th-row { display: flex; flex-direction: column; gap: 3px; text-align: left; font: inherit; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--acc); border-radius: var(--radius);
  padding: 9px 11px; cursor: pointer; }
.th-row:hover { border-color: var(--acc); }
.th-row-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; }
.th-row-meta { font-size: 12px; color: var(--muted); }
.th-busy { color: var(--run); font-weight: 700; }
/* A thread marked closed: dimmed, grey bar, the "închis" tag and a check mark before the title */
.th-row-closed { border-left-color: var(--muted); }
.th-row-closed .th-row-title { color: var(--muted); }
.th-closed-tag { font-weight: 700; }
.th-done-mark { color: var(--acc); }

/* The pictures of a message: thumbnails; a click opens the chat's preview. The other files use the chat's .file buttons. */
.th-pics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.th-pic { width: 96px; height: 72px; padding: 0; overflow: hidden; display: inline-flex; align-items: center;
  justify-content: center; font-size: 11px; color: var(--muted); background: var(--code); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; }
.th-pic:hover { border-color: var(--acc); }
.th-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th-mine .files, .th-ai .files { margin-top: 6px; }

/* The files picked for the thread's next message, and the composer */
.thread-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 0; background: var(--panel); }
.thread-files[hidden] { display: none; }
.thread-files .file { font-size: 12px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
.thread-files .file-remove { font: inherit; margin-left: 4px; color: var(--muted); background: transparent; border: none; cursor: pointer; }
.thread-files .attach-error { font-size: 12px; color: var(--off); }
.thread-composer { position: relative; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.thread-composer[hidden] { display: none; }
/* One large field; the attach, dictation and send buttons float inside it, on a bar along its bottom edge */
.thread-box { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.thread-box:focus-within { border-color: var(--acc); }
/* Same text size as the conversation (1.5.1): the size chosen with the menu button's A-/A+ (--ragai-scale, set by rag-ai.js) */
.thread-list { zoom: var(--ragai-scale, 1); }
.thread-composer textarea { display: block; width: 100%; box-sizing: border-box; min-height: 96px; max-height: 40vh;
  font: inherit; color: var(--fg); background: transparent; border: none; outline: none; resize: none;
  padding: 10px 12px 46px; overflow-y: auto; }
.thread-tools { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px;
  pointer-events: none; }
.thread-tools > * { pointer-events: auto; }
.thread-tools-gap { flex: 1; }
.thread-tool { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); background: transparent; border: none; border-radius: 50%; cursor: pointer; }
.thread-tool[hidden] { display: none; }
.thread-tool:hover { color: var(--acc); }
.thread-mic.listening { color: #fff; background: var(--off); }
.thread-send { width: 36px; height: 36px; color: #fff; background: var(--acc); border: none; border-radius: 50%;
  cursor: pointer; }
.thread-send:disabled { opacity: .5; cursor: default; }
/* The attach menu opens above the field, like the message field's. The main menu's bottom sheet centres itself with
   translateX(-50%) (rag-ai.css); here it sits at left: 12px, so the shift is cancelled and the width stays inside the panel. */
.thread-attach-menu { position: absolute; left: 12px; right: auto; top: auto; bottom: calc(100% + 4px); z-index: 2;
  transform: none; width: calc(100% - 24px); max-width: 520px; }
.thread-attach-menu[hidden] { display: none; }
/* The field's text size follows the conversation's (after the rules above, whose `font: inherit` would reset it) */
.thread-composer textarea { font-size: calc(1rem * var(--ragai-scale, 1)); }
