/*!
 * Rahav Support â€” chat / ticket UI.
 */
.rahav-support {
  --rs-gap: 14px;
  /* The conversation surface keeps its own tint so the chat card never melts
     into the page background. */
  --rahav-chat-bg: #edf1f7;
  max-width: 1240px; margin: 0 auto;
}
html.rahav-dark .rahav-support { --rahav-chat-bg: #0d1016; }
/* The block header mirrors the dashboard's `.rahav-panel-block__head`; the rule
   is repeated so the fallback shell (without the LMS panel stylesheet) works. */
.rahav-support .rahav-panel-block__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rahav-support__headline { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rahav-support__headline h2 { margin: 0; }
.rahav-support__count { margin-inline-start: 6px; color: var(--rp-soft); font-weight: 700; font-size: 15px; white-space: nowrap; }
.rahav-chip {
  background: var(--rp-brand-soft); color: var(--rp-brand-deep); border-radius: 999px;
  padding: 3px 12px; font-size: 12px; font-weight: 700;
}
/* Filter row: compact status chips, the optional topic filter and the search
   field share a single line; only phones (<=720px) are allowed to wrap. */
.rahav-support__toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; margin-bottom: 14px; }
.rahav-chips { display: inline-flex; flex: 0 0 auto; background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: 10px; padding: 2px; gap: 2px; }
.rahav-chip-btn {
  border: 0; background: transparent; color: var(--rp-soft); border-radius: 8px; padding: 4px 10px;
  font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.rahav-chip-btn.is-active { background: var(--rp-brand); color: #fff; }
.rahav-input, .rahav-select, .rahav-textarea {
  width: 100%; border: 1px solid var(--rp-line); background: var(--rp-card); color: var(--rp-ink);
  border-radius: 12px; padding: 10px 13px; font: inherit; font-size: 14px;
}
.rahav-input:focus, .rahav-select:focus, .rahav-textarea:focus { outline: 2px solid var(--rp-brand-soft); border-color: var(--rp-brand); }
.rahav-textarea { resize: vertical; line-height: 1.9; }
.rahav-support__toolbar .rahav-select { width: auto; min-width: 140px; flex: 0 1 auto; padding: 5px 10px; font-size: 13px; }
.rahav-support__toolbar .rahav-input { width: auto; min-width: 140px; flex: 1 1 auto; max-width: 320px; padding: 5px 12px; font-size: 13px; }

.rahav-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  border-radius: var(--rp-r-sm); padding: 10px 18px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--rp-ground); color: var(--rp-ink); transition: filter .15s ease;
}
.rahav-btn:hover { filter: brightness(.97); }
.rahav-btn:disabled { opacity: .55; cursor: not-allowed; }
.rahav-btn--primary { background: var(--rp-brand); color: #fff; }
.rahav-btn--ghost { background: transparent; border-color: var(--rp-line); color: var(--rp-soft); }
.rahav-btn--ai { background: var(--rp-brand-soft); color: var(--rp-brand-deep); }
.rahav-btn--sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }

.rahav-support__layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: var(--rs-gap); align-items: start; }
/* The conversation list sits in a native disclosure box: collapsible on
   phones, always open on desktop. The markup ships the `open` attribute, so
   nothing is hidden when JavaScript is unavailable.
   The panel's top bar is sticky, so the list parks below it instead of sliding
   underneath; the LMS shell publishes the bar height as `--rp-top-h` (0 when
   the fallback shell without a sticky bar is in use). */
.rahav-support__list-box { position: sticky; top: var(--rp-top-h, 0px); z-index: 5; background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: var(--rp-r); overflow: hidden; }
.rahav-support__list-box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--rp-ink); cursor: default; list-style: none; }
.rahav-support__list-box-head::-webkit-details-marker { display: none; }
.rahav-support__list-box-head::marker { content: ''; }
.rahav-support__list-box-chevron { display: none; color: var(--rp-soft); transition: transform .2s ease; }
.rahav-support__list-wrap { padding: 8px 10px 10px; }
.rahav-support__list-wrap > [data-rs-more] { width: 100%; margin-top: 10px; }
.rahav-ticket-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rahav-ticket-list--scroll { overflow-y: auto; overscroll-behavior: contain; }
.rahav-ticket-list__item {
  border: 1px solid transparent; border-radius: 12px; padding: 11px 12px; cursor: pointer;
  display: grid; gap: 6px; background: var(--rp-ground);
}
.rahav-ticket-list__item:hover { border-color: var(--rp-line); }
.rahav-ticket-list__item.is-active { border-color: var(--rp-brand); background: var(--rp-brand-soft); }
.rahav-ticket-list__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rahav-ticket-list__subject { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rahav-ticket-list__meta { display: flex; align-items: center; gap: 8px; color: var(--rp-soft); font-size: 12px; flex-wrap: wrap; }
.rahav-ticket-list__code { font-family: monospace; background: var(--rp-line-soft); border-radius: 7px; padding: 2px 7px; }
.rahav-empty { color: var(--rp-soft); text-align: center; padding: 26px 8px; }
.rahav-notice { border-radius: 12px; padding: 12px 16px; margin: 10px 0; line-height: 1.9; }
.rahav-notice--warn { background: #FFF6E5; color: #8a5a00; border: 1px solid #F5D9A6; }
html.rahav-dark .rahav-notice--warn { background: #33270f; color: #f3cf8a; border-color: #57431c; }

.rahav-badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 10px;
  font-size: 11px; font-weight: 700; background: var(--rp-line-soft); color: var(--rp-soft);
}
.rahav-badge--open, .rahav-badge--new { background: #E7F0FF; color: #1d4ed8; }
.rahav-badge--awaiting, .rahav-badge--in_progress { background: #FFF6E5; color: #8a5a00; }
.rahav-badge--waiting_user, .rahav-badge--answered { background: #E8F7EF; color: #0f7a45; }
.rahav-badge--closed { background: var(--rp-line-soft); color: var(--rp-soft); }
html.rahav-dark .rahav-badge--open, html.rahav-dark .rahav-badge--new { background: #17233f; color: #9db9ff; }
html.rahav-dark .rahav-badge--awaiting, html.rahav-dark .rahav-badge--in_progress { background: #33270f; color: #f3cf8a; }
html.rahav-dark .rahav-badge--waiting_user, html.rahav-dark .rahav-badge--answered { background: #10301f; color: #7fd8a6; }

.rahav-support__detail { background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: var(--rp-r); overflow: hidden; display: flex; flex-direction: column; min-height: 480px; }
/* The detail panel is inert until a conversation is open: its `hidden`
   attribute (set in the markup and toggled by `openTicket`) must win over the
   `display: flex` above, otherwise an empty composer with no active ticket
   would stay visible. */
.rahav-support__detail[hidden] { display: none; }
.rahav-thread__head {
  padding: 14px 16px; border-bottom: 1px solid var(--rp-line); display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.rahav-thread__head h3 { margin: 0 0 6px; font-size: 16px; }
.rahav-thread__meta { display: flex; align-items: center; gap: 8px; color: var(--rp-soft); font-size: 12px; margin: 0; flex-wrap: wrap; }
.rahav-thread__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rahav-thread__actions .rahav-select { width: auto; min-width: 140px; padding: 7px 10px; font-size: 13px; }

.rahav-thread { flex: 1; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 56vh; min-height: 220px; background: var(--rahav-chat-bg, #edf1f7); }
.rahav-thread__state { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: var(--rp-soft); font-size: 13px; line-height: 1.9; padding: 24px 12px; }
.rahav-thread__state--error { color: #b42318; }
html.rahav-dark .rahav-thread__state--error { color: #ff9b8f; }
.rahav-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 82%; }
.rahav-msg:not(.rahav-msg--own) { flex-direction: row-reverse; }
.rahav-msg--user { align-self: flex-start; }
.rahav-msg--agent { align-self: flex-end; }
.rahav-msg.rahav-msg--system { align-self: center; max-width: 92%; flex-direction: column; }
.rahav-msg__col { display: flex; flex-direction: column; min-width: 0; }
.rahav-msg__avatar { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: var(--rp-brand-soft); color: var(--rp-brand-deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.rahav-msg__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rahav-msg__meta { color: var(--rp-faint); font-size: 11px; margin: 0 6px 4px; display: flex; align-items: center; gap: 8px; }
.rahav-msg--own .rahav-msg__meta { justify-content: flex-end; }
.rahav-msg__name { font-weight: 700; color: var(--rp-soft); }
.rahav-msg__ticks { font-size: 12px; letter-spacing: -2px; color: var(--rp-faint); }
.rahav-msg__ticks--delivered { color: var(--rp-soft); }
.rahav-msg__ticks--read { color: #12a150; }
html.rahav-dark .rahav-msg__ticks--read { color: #4bd08a; }
.rahav-msg__ticks--sending { letter-spacing: 0; }
.rahav-msg__bubble { background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: 14px; padding: 10px 14px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
.rahav-msg--user .rahav-msg__bubble { border-start-start-radius: 4px; }
.rahav-msg--agent .rahav-msg__bubble { border-start-end-radius: 4px; background: var(--rp-brand-soft); border-color: transparent; }
.rahav-msg--pending { opacity: .75; }

/* Modern message polish: gentle entrance, softer bubbles, a subtle "edited" chip. */
@keyframes rahav-msg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.rahav-msg { animation: rahav-msg-in .18s ease-out both; }
.rahav-msg__bubble { box-shadow: 0 1px 2px rgba(20, 24, 40, .05); transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
html.rahav-dark .rahav-msg__bubble { box-shadow: none; }
.rahav-msg__edited { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--rp-faint); background: var(--rp-line-soft); border-radius: 999px; padding: 1px 7px; }

/* Per-message actions: a single pencil icon, revealed on hover/focus or tap. */
.rahav-msg__actions { display: flex; gap: 6px; max-height: 0; margin-top: 0; opacity: 0; overflow: hidden; transition: max-height .18s ease, opacity .15s ease, margin-top .18s ease; }
.rahav-msg--own .rahav-msg__actions { justify-content: flex-end; }
.rahav-msg:hover .rahav-msg__actions,
.rahav-msg:focus-within .rahav-msg__actions,
.rahav-msg.is-actions-open .rahav-msg__actions { max-height: 40px; margin-top: 5px; opacity: 1; }
.rahav-msg__action {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 1px solid var(--rp-line); background: var(--rp-card); color: var(--rp-soft);
  border-radius: 50%; padding: 0; font: inherit; cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.rahav-msg__action:hover, .rahav-msg__action:focus-visible { color: var(--rp-brand-deep); border-color: var(--rp-brand); background: var(--rp-brand-soft); }

/* Editing happens inside the message's own bubble; a check icon saves it. */
.rahav-msg__bubble--editing { display: flex; align-items: flex-end; gap: 6px; }
.rahav-msg__editor {
  flex: 1 1 auto; min-width: 0; width: 100%; min-height: 40px; max-height: 12em; margin: 0; padding: 0;
  border: 0; background: transparent; color: inherit; font: inherit; line-height: 1.9;
  resize: none; overflow-y: hidden; outline: none;
}
.rahav-msg__save {
  flex: 0 0 auto; width: 32px; height: 32px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--rp-brand); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  transition: filter .15s ease;
}
.rahav-msg__save:hover { filter: brightness(.95); }
.rahav-msg__save:disabled { opacity: .6; cursor: not-allowed; }
.rahav-msg.is-editing .rahav-msg__actions { display: none; }

@media (prefers-reduced-motion: reduce) {
  .rahav-msg { animation: none; }
  .rahav-msg__actions, .rahav-msg__bubble { transition: none; }
}

/* Date separators between conversation days. */
.rahav-day { align-self: center; display: flex; justify-content: center; margin: 4px 0; }
.rahav-day span { background: var(--rp-line-soft); color: var(--rp-soft); border-radius: 999px; padding: 3px 14px; font-size: 11px; font-weight: 700; }

/* Typing indicator. */
.rahav-typing { display: flex; align-items: center; gap: 8px; padding: 6px 18px; color: var(--rp-soft); font-size: 12px; background: var(--rahav-chat-bg, #edf1f7); }
.rahav-typing[hidden] { display: none; }
.rahav-typing__dots { display: inline-flex; gap: 4px; }
.rahav-typing__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--rp-brand); display: inline-block; animation: rahav-blink 1.4s infinite both; }
.rahav-typing__dots i:nth-child(2) { animation-delay: .2s; }
.rahav-typing__dots i:nth-child(3) { animation-delay: .4s; }
@keyframes rahav-blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.rahav-msg--note .rahav-msg__bubble { background: #FFF6E5; border: 1px dashed #E7BE72; }
html.rahav-dark .rahav-msg--note .rahav-msg__bubble { background: #33270f; color: #f3cf8a; border-color: #57431c; }
.rahav-msg--system .rahav-msg__bubble { background: transparent; border-style: dashed; color: var(--rp-soft); font-size: 12px; text-align: center; }
.rahav-msg__attach { margin-top: 6px; max-width: 280px; }
.rahav-msg__attach a { color: var(--rp-brand-deep); font-weight: 700; }
.rahav-msg__attach--image .rahav-msg__thumb { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--rp-line); background: var(--rp-card); }
.rahav-msg__attach--image img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.rahav-msg__attach-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 12px; }
.rahav-msg__attach-name { color: var(--rp-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rahav-msg__attach-dl { flex: 0 0 auto; background: var(--rp-brand); color: #fff !important; border-radius: 999px; padding: 3px 12px; font-size: 12px; text-decoration: none; }
.rahav-msg__attach-dl:hover { background: var(--rp-brand-deep); }
.rahav-msg__file { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--rp-line); border-radius: 12px; background: var(--rp-card); text-decoration: none; color: var(--rp-ink) !important; }
.rahav-msg__file:hover { border-color: var(--rp-brand); }
.rahav-msg__file-icon { font-size: 20px; line-height: 1; }
.rahav-msg__file-body { display: flex; flex-direction: column; min-width: 0; }
.rahav-msg__file-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.rahav-msg__file-size { font-size: 11px; color: var(--rp-faint); }
.rahav-msg__file-dl { margin-inline-start: auto; color: var(--rp-brand-deep); font-weight: 700; }
.rahav-msg--upload { max-width: 82%; }
.rahav-msg--upload .rahav-msg__meta { justify-content: flex-start; }

.rahav-composer { position: relative; border-top: 1px solid var(--rp-line); padding: 12px 16px; display: grid; gap: 10px; background: var(--rp-card); }
.rahav-composer__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rahav-check { color: var(--rp-soft); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.rahav-composer__tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rahav-composer__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rahav-composer__actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.rahav-composer__hint { color: var(--rp-soft); font-size: 12px; }
/* Keyboard hint: desktop only (hidden on the single-column mobile layout). */
.rahav-composer__keys { color: var(--rp-faint); font-size: 12px; white-space: nowrap; }
.rahav-composer__attach { display: flex; align-items: center; gap: 10px; }
.rahav-composer__field { position: relative; }
.rahav-composer__input { resize: none; max-height: 13em; min-height: 5.7em; overflow-y: hidden; }
/* Emoji + attachment share one tool pill so the composer row looks uniform. */
.rahav-composer__tool {
  display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 11px;
  border: 1px solid var(--rp-line); border-radius: 10px; background: var(--rp-ground); color: var(--rp-ink);
  font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1; cursor: pointer; user-select: none;
}
.rahav-composer__tool:hover,
.rahav-composer__tool:focus-visible,
.rahav-composer__tool[aria-expanded="true"] { border-color: var(--rp-brand); background: var(--rp-brand-soft); color: var(--rp-brand-deep); }
.rahav-composer__tool-ico { font-size: 16px; line-height: 1; }

/* Emoji picker. */
.rahav-emoji {
  position: absolute; inset-inline-start: 0; inset-inline-end: auto; inset-block-end: calc(100% + 8px); z-index: 40;
  width: min(380px, 100%); max-height: 340px; display: flex; flex-direction: column;
  background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: 16px; box-shadow: var(--rp-shadow, 0 12px 32px rgba(12,14,20,.18)); padding: 10px;
}
.rahav-emoji[hidden] { display: none; }
.rahav-emoji__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rahav-emoji__search { flex: 1; border: 1px solid var(--rp-line); background: var(--rp-ground); color: var(--rp-ink); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; }
.rahav-emoji__search:focus { outline: 2px solid var(--rp-brand-soft); border-color: var(--rp-brand); }
.rahav-emoji__tones { display: inline-flex; gap: 2px; }
.rahav-emoji__tone, .rahav-emoji__tab { border: 0; background: transparent; cursor: pointer; border-radius: 9px; font-size: 18px; line-height: 1; padding: 5px 6px; }
.rahav-emoji__tone.is-active, .rahav-emoji__tab.is-active { background: var(--rp-brand-soft); }
.rahav-emoji__tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--rp-line); padding-bottom: 6px; margin-bottom: 6px; }
.rahav-emoji__heading { margin: 0 4px 6px; font-size: 11px; font-weight: 700; color: var(--rp-soft); }
.rahav-emoji__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; overflow-y: auto; padding: 2px; }
.rahav-emoji__btn { border: 0; background: transparent; cursor: pointer; border-radius: 9px; font-size: 22px; line-height: 1; padding: 6px 0; }
.rahav-emoji__btn:hover, .rahav-emoji__btn:focus { background: var(--rp-brand-soft); }
.rahav-emoji__empty { grid-column: 1 / -1; color: var(--rp-faint); font-size: 12px; text-align: center; padding: 14px 0; margin: 0; }
.rahav-file__name { color: var(--rp-brand-deep); font-size: 12px; }
.rahav-file__preview { display: inline-flex; align-items: center; }
.rahav-file__preview[hidden] { display: none; }
.rahav-file__preview img { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rp-line); }

.rahav-ai-panel { border: 1px solid #c7d2ff; background: #F7F8FF; border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
html.rahav-dark .rahav-ai-panel { border-color: #3d4d8f; background: #171c33; }
.rahav-ai-panel__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rahav-ai-panel__head strong { font-size: 13px; }
.rahav-ai-panel__head .rahav-btn { margin-inline-start: auto; }
.rahav-ai-panel__note { margin: 0; color: var(--rp-soft); font-size: 13px; line-height: 1.9; }
.rahav-ai-panel__note--warn { color: #b32d2e; }
.rahav-ai-sources ul { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 6px; }
.rahav-ai-sources li { font-size: 12px; color: var(--rp-soft); line-height: 1.8; }
.rahav-ai-sources b { font-size: 12px; }

.rahav-modal[hidden] { display: none; }
.rahav-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 18px; }
.rahav-modal__backdrop { position: absolute; inset: 0; background: rgba(12, 14, 20, .5); }
.rahav-modal__card { position: relative; background: var(--rp-card); border-radius: 18px; width: min(560px, 100%); padding: 22px; display: grid; gap: 12px; box-shadow: var(--rp-shadow); max-height: 90vh; overflow-y: auto; }
.rahav-modal__card h3 { margin: 0; }
.rahav-modal__foot { display: flex; justify-content: flex-start; gap: 10px; margin-top: 6px; }
.rahav-field { display: grid; gap: 6px; font-size: 13px; color: var(--rp-soft); font-weight: 600; }
.rahav-field__help { color: var(--rp-faint); font-weight: 400; line-height: 1.8; }

.rahav-toasts { position: fixed; inset-block-end: 18px; inset-inline-end: 18px; display: grid; gap: 8px; z-index: 300; }
.rahav-toast { background: var(--rp-ink); color: var(--rp-card); border-radius: 12px; padding: 10px 16px; font-size: 13px; box-shadow: var(--rp-shadow); }

@media (max-width: 980px) {
  .rahav-support__layout { grid-template-columns: 1fr; }
  /* Single column: the list stays at the top and the conversation opens below
     it, so there is no need for a "close" step. */
  .rahav-support__list-wrap { display: block; }
  /* Phones: the list box becomes a real disclosure; the chevron flips when open. */
  .rahav-support__list-box-head { cursor: pointer; }
  .rahav-support__list-box-chevron { display: inline-flex; }
  .rahav-support__list-box[open] .rahav-support__list-box-chevron { transform: rotate(-180deg); }
  .rahav-support__detail { min-height: 60vh; }
  /* Touch keyboards have no Shift+Enter, so the hint is omitted on mobile. */
  .rahav-composer__keys { display: none; }
}

@media (max-width: 720px) {
  /* Phones: keep the whole filter row on a single line â€” the status buttons are
     compacted and the search field sits right beside them. `overflow-x: auto` is
     a safety net for very narrow screens (~320px) so nothing gets squashed. */
  .rahav-support__toolbar { flex-wrap: nowrap; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rahav-chips { padding: 2px; gap: 1px; }
  .rahav-chip-btn { padding: 3px 7px; font-size: 11.5px; }
  .rahav-support__toolbar .rahav-select { min-width: 100px; padding: 4px 8px; font-size: 12px; }
  .rahav-support__toolbar .rahav-input { min-width: 64px; max-width: none; flex: 1 1 auto; padding: 5px 10px; font-size: 12.5px; }
  .rahav-msg { max-width: 92%; }
  .rahav-thread { max-height: 62vh; }
  .rahav-composer__input { font-size: 16px; } /* prevents iOS zoom-on-focus */
  .rahav-emoji { inset-inline-start: 0; inset-inline-end: 0; width: auto; }
  .rahav-emoji__grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
}

/* =========================================================================
   Portal UX refresh (1.8.8)
   - full-height two-pane workspace instead of a capped widget
   - decision-oriented conversation rows (preview, relative time, unread)
   - explicit closed/CSAT states and a mobile list <-> thread flow
   ========================================================================= */

.rahav-support {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: none;
	height: calc(100dvh - 170px);
	min-height: 540px;
}
.rahav-support__headline { flex-wrap: wrap; row-gap: 4px; }
.rahav-support__unread {
	display: inline-flex; align-items: center; gap: 6px;
	background: var(--rp-brand-soft); color: var(--rp-brand-deep);
	border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700;
}
.rahav-support__unread[hidden] { display: none; }

.rahav-support__layout {
	flex: 1 1 auto;
	min-height: 0;
	grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
	align-items: stretch;
}

/* List column */
.rahav-support__list-box {
	position: relative;
	top: auto;
	z-index: auto;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	overflow: hidden;
}
.rahav-support__list-head {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	padding: 12px 14px; border-bottom: 1px solid var(--rp-line);
}
.rahav-support__list-head h3 { margin: 0; font-size: 14px; }
.rahav-support__list-state { color: var(--rp-faint); font-size: 12px; }
.rahav-support__list-wrap {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 8px 10px 12px;
}
.rahav-ticket-list { gap: 5px; }
.rahav-ticket-list__item { padding: 0; border: 0; background: transparent; }
.rahav-ticket-list__link {
	display: grid; gap: 5px; padding: 10px 12px;
	border: 1px solid transparent; border-radius: 12px;
	background: var(--rp-ground); color: inherit; text-decoration: none;
	cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.rahav-ticket-list__link:hover { border-color: var(--rp-line); }
.rahav-ticket-list__link:focus-visible { outline: 2px solid var(--rp-brand); outline-offset: 2px; }
.rahav-ticket-list__link[aria-current="true"] { border-color: var(--rp-brand); background: var(--rp-brand-soft); }
.rahav-ticket-list__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.rahav-ticket-list__subject { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rahav-ticket-list__link.is-unread .rahav-ticket-list__subject { color: var(--rp-brand-deep); }
.rahav-ticket-list__snippet {
	color: var(--rp-soft); font-size: 12px; line-height: 1.7;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rahav-ticket-list__meta { display: flex; align-items: center; gap: 8px; color: var(--rp-soft); font-size: 11px; flex-wrap: wrap; }
.rahav-ticket-list__time { color: var(--rp-faint); }
.rahav-ticket-list__unread {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 18px; height: 18px; padding: 0 5px;
	border-radius: 999px; background: var(--rp-brand); color: #fff;
	font-size: 10.5px; font-weight: 800; line-height: 1;
}
.rahav-ticket-list__status { display: inline-flex; align-items: center; gap: 5px; color: var(--rp-soft); }
.rahav-ticket-list__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rp-soft); flex: 0 0 auto; }
.rahav-ticket-list__dot--open { background: #e08a00; }
.rahav-ticket-list__dot--waiting { background: #2f7dd1; }
.rahav-ticket-list__dot--answered { background: #12a150; }
.rahav-ticket-list__dot--closed { background: var(--rp-faint); }

/* Detail column */
.rahav-support__detail { position: relative; height: 100%; min-height: 0; display: flex; flex-direction: column; }
.rahav-thread__head { align-items: center; flex-wrap: nowrap; gap: 10px; padding: 10px 14px; }
.rahav-thread__title-wrap { min-width: 0; flex: 1 1 auto; }
.rahav-thread__head h3 { margin: 0 0 4px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rahav-thread__meta { margin: 0; }
.rahav-thread__back {
	display: none; flex: 0 0 auto; align-items: center; justify-content: center;
	width: 36px; height: 36px; border: 1px solid var(--rp-line); border-radius: 10px;
	background: var(--rp-card); color: var(--rp-ink); cursor: pointer;
}
.rahav-thread__back:hover { border-color: var(--rp-brand); color: var(--rp-brand-deep); }
.rahav-thread__back:focus-visible { outline: 2px solid var(--rp-brand); outline-offset: 2px; }
.rahav-thread { flex: 1 1 auto; max-height: none; min-height: 0; overflow-y: auto; }
.rahav-composer { flex: 0 0 auto; }
.rahav-composer__input { min-height: 4.4em; }

.rahav-scroll-bottom {
	position: absolute; inset-block-end: 150px; inset-inline-start: 50%;
	transform: translateX(50%);
	z-index: 15; border: 1px solid var(--rp-line); border-radius: 999px;
	background: var(--rp-card); color: var(--rp-ink); box-shadow: var(--rp-shadow);
	padding: 7px 14px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.rahav-scroll-bottom[hidden] { display: none; }
.rahav-scroll-bottom:hover { border-color: var(--rp-brand); color: var(--rp-brand-deep); }

/* Unread divider */
.rahav-unread-divider { align-self: center; display: flex; justify-content: center; width: 100%; margin: 2px 0; }
.rahav-unread-divider span {
	background: var(--rp-brand-soft); color: var(--rp-brand-deep);
	border-radius: 999px; padding: 3px 14px; font-size: 11px; font-weight: 800;
}

/* Closed + CSAT */
.rahav-support__closed {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 12px 16px; border-top: 1px solid #F5D9A6; background: #FFF6E5; color: #8a5a00;
}
.rahav-support__closed[hidden] { display: none; }
.rahav-support__closed strong { display: block; font-size: 13px; }
.rahav-support__closed p { margin: 2px 0 0; font-size: 12px; line-height: 1.7; }
html.rahav-dark .rahav-support__closed { background: #33270f; border-color: #57431c; color: #f3cf8a; }

.rahav-csat { border-top: 1px solid var(--rp-line); padding: 14px 16px; background: var(--rp-card); display: grid; gap: 8px; }
.rahav-csat[hidden] { display: none; }
.rahav-csat__title { margin: 0; font-size: 13px; font-weight: 700; }
.rahav-csat__stars { display: flex; gap: 4px; }
.rahav-csat__stars button {
	border: 0; background: transparent; color: var(--rp-line); font-size: 28px; line-height: 1;
	padding: 0 2px; cursor: pointer; transition: color .12s ease, transform .12s ease;
}
.rahav-csat__stars button:hover,
.rahav-csat__stars button.is-active { color: #f5a623; transform: translateY(-1px); }
.rahav-csat__stars button:focus-visible { outline: 2px solid var(--rp-brand); outline-offset: 2px; border-radius: 6px; }
.rahav-csat__actions { display: flex; justify-content: flex-end; }
.rahav-csat__done { margin: 0; color: #0f7a45; font-size: 12px; font-weight: 700; }
.rahav-csat__summary { margin: 0; padding: 10px 16px; border-top: 1px solid var(--rp-line); color: var(--rp-soft); font-size: 12px; }
.rahav-csat__summary[hidden] { display: none; }

/* Placeholder */
.rahav-support__placeholder {
	flex-direction: column; align-items: center; justify-content: center;
	gap: 8px; text-align: center; padding: 28px; color: var(--rp-soft);
	border: 1px dashed var(--rp-line); border-radius: var(--rp-r); background: var(--rp-card);
}
.rahav-support__placeholder:not([hidden]) { display: flex; }
.rahav-support__placeholder[hidden] { display: none; }
.rahav-support__placeholder-icon { font-size: 38px; line-height: 1; }
.rahav-support__placeholder h3 { margin: 0; color: var(--rp-ink); font-size: 16px; }
.rahav-support__placeholder p { margin: 0; max-width: 34ch; line-height: 1.9; font-size: 13px; }

/* Modal tweaks */
.rahav-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rahav-modal__head h3 { margin: 0; }
.rahav-modal__close {
	border: 0; background: var(--rp-ground); color: var(--rp-soft);
	width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer;
}
.rahav-modal__close:hover { color: var(--rp-ink); }
.rahav-modal__form { display: grid; gap: 12px; }
.rahav-field__error { color: #b42318; font-weight: 700; }
.rahav-field__error[hidden] { display: none; }
.rahav-field [aria-invalid="true"] { border-color: #b42318; }

@media (max-width: 980px) {
	.rahav-support { height: calc(100dvh - 140px); min-height: 480px; }
	.rahav-support__layout { grid-template-columns: minmax(0, 1fr); }
	.rahav-support__list-box { height: 100%; }
	.rahav-support__detail { height: 100%; }
	.rahav-support.is-thread-open .rahav-support__list-box { display: none; }
	.rahav-support:not(.is-thread-open) .rahav-support__detail { display: none !important; }
	.rahav-support:not(.is-thread-open) .rahav-support__placeholder { display: none !important; }
	.rahav-thread__back { display: inline-flex; }
	.rahav-thread__head { flex-wrap: wrap; }
	.rahav-thread__actions { width: 100%; justify-content: flex-end; }
	.rahav-support__toolbar { flex-wrap: wrap; overflow: visible; }
	.rahav-support__toolbar .rahav-input { flex: 1 1 100%; max-width: none; }
	.rahav-scroll-bottom { inset-block-end: 170px; }
}

@media (max-width: 720px) {
	.rahav-support { height: calc(100dvh - 120px); min-height: 440px; }
	.rahav-support__toolbar { gap: 6px; }
	.rahav-support__toolbar .rahav-select { min-width: 0; flex: 1 1 auto; }
	.rahav-thread { max-height: none; }
	.rahav-msg { max-width: 92%; }
	.rahav-support__closed { align-items: flex-start; flex-direction: column; }
	.rahav-csat__stars button { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
	.rahav-ticket-list__link, .rahav-csat__stars button { transition: none; }
}


.rahav-composer[hidden] { display: none; }
.rahav-support__list-state[hidden] { display: none; }

.rahav-btn[hidden], .rahav-chip-btn[hidden], .rahav-composer__tool[hidden] { display: none !important; }
.rahav-select[hidden], .rahav-input[hidden], .rahav-textarea[hidden] { display: none !important; }

.rahav-support button:focus-visible,
.rahav-support a:focus-visible,
.rahav-support select:focus-visible,
.rahav-support input:focus-visible,
.rahav-support textarea:focus-visible { outline: 2px solid var(--rp-brand); outline-offset: 2px; }

.rahav-ticket-list__subject { min-width: 0; }
.rahav-ticket-list__top > .rahav-ticket-list__unread { flex: 0 0 auto; }
.rahav-thread__title-wrap h3 { max-width: 100%; }

.rahav-panel__badge[data-rs-nav-badge][hidden] { display: none !important; }

.rahav-support { height: calc(100vh - 170px); height: calc(100dvh - 170px); }
@media (max-width: 980px) {
	.rahav-support { height: calc(100vh - 140px); height: calc(100dvh - 140px); }
}
@media (max-width: 720px) {
	.rahav-support { height: calc(100vh - 120px); height: calc(100dvh - 120px); }
}

.rahav-support [hidden] { display: none !important; }

@media (max-width: 980px) {
	.rahav-support.is-thread-open .rahav-panel-block__head,
	.rahav-support.is-thread-open .rahav-support__toolbar { display: none; }
}

/* =========================================================================
   Agent workspace refresh (1.8.9)
   - three-column queue / thread / customer context
   - compact compose modes, AI as a normal icon button
   - queue tabs + sort
   ========================================================================= */

.rahav-support[data-view="agent"] .rahav-support__layout {
	grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
}

/* Queue tabs */
.rahav-queue-tabs { flex-wrap: wrap; background: transparent; border: 0; padding: 0; gap: 4px; }
.rahav-queue-tabs .rahav-chip-btn {
	border: 1px solid var(--rp-line); background: var(--rp-card); border-radius: 999px;
	padding: 5px 11px; color: var(--rp-soft);
}
.rahav-queue-tabs .rahav-chip-btn.is-active { border-color: var(--rp-brand); background: var(--rp-brand); color: #fff; }
.rahav-sort { min-width: 130px; }

/* Agent list rows */
.rahav-ticket-list__customer { color: var(--rp-ink); font-weight: 700; font-size: 11.5px; }
.rahav-ticket-list__waiting { color: #b45309; font-weight: 700; }
.rahav-ticket-list__priority {
	border-radius: 999px; padding: 2px 8px; font-size: 10.5px; font-weight: 800;
	background: #FFF6E5; color: #8a5a00;
}
.rahav-ticket-list__priority--urgent { background: #FDECEC; color: #b42318; }
html.rahav-dark .rahav-ticket-list__priority { background: #33270f; color: #f3cf8a; }
html.rahav-dark .rahav-ticket-list__priority--urgent { background: #3b1717; color: #ff9b8f; }
.rahav-ticket-list__item.is-priority .rahav-ticket-list__link { border-inline-start: 3px solid #f0a23a; }

/* Customer context */
.rahav-support__context {
	display: flex; flex-direction: column; min-height: 0; height: 100%;
	background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: var(--rp-r);
	overflow: hidden;
}
.rahav-support__context[hidden] { display: none !important; }
.rahav-context__head {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	padding: 12px 14px; border-bottom: 1px solid var(--rp-line);
}
.rahav-context__head h3 { margin: 0; font-size: 14px; }
.rahav-context__close { border: 0; background: transparent; color: var(--rp-soft); font-size: 20px; line-height: 1; cursor: pointer; display: none; }
.rahav-context__body { padding: 12px; overflow-y: auto; display: grid; gap: 12px; }
.rahav-context__person { display: flex; align-items: center; gap: 10px; }
.rahav-context__avatar {
	width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--rp-brand-soft); color: var(--rp-brand-deep); font-weight: 800;
}
.rahav-context__person strong { display: block; font-size: 13px; }
.rahav-context__person small { color: var(--rp-soft); font-size: 11.5px; }
.rahav-context__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rahav-context__stats div {
	background: var(--rp-ground); border-radius: 10px; padding: 8px 6px; text-align: center;
	display: grid; gap: 2px;
}
.rahav-context__stats b { font-size: 14px; color: var(--rp-ink); }
.rahav-context__stats span { font-size: 10.5px; color: var(--rp-soft); }
.rahav-context__details { margin: 0; display: grid; gap: 6px; }
.rahav-context__details div { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.rahav-context__details dt { color: var(--rp-soft); }
.rahav-context__details dd { margin: 0; color: var(--rp-ink); }
.rahav-context__recent h4 { margin: 0 0 6px; font-size: 12px; }
.rahav-context__recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rahav-context__recent a {
	display: grid; gap: 2px; padding: 7px 8px; border-radius: 9px;
	background: var(--rp-ground); color: inherit; text-decoration: none;
}
.rahav-context__recent a:hover { background: var(--rp-brand-soft); }
.rahav-context__recent span { font-size: 11.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rahav-context__recent small { font-size: 10.5px; color: var(--rp-soft); }

/* Composer modes + compact AI */
.rahav-composer__mode {
	display: inline-flex; align-items: center; gap: 2px; padding: 2px;
	background: var(--rp-ground); border: 1px solid var(--rp-line); border-radius: 999px;
	width: max-content;
}
.rahav-mode-btn {
	border: 0; background: transparent; color: var(--rp-soft);
	border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.rahav-mode-btn.is-active { background: var(--rp-brand); color: #fff; }
.rahav-composer.is-note .rahav-composer__mode { border-color: #E7BE72; background: #FFF6E5; }
.rahav-composer.is-note .rahav-mode-btn.is-active { background: #8a5a00; }
.rahav-composer.is-note .rahav-composer__input { background: #FFFDF7; border-color: #E7BE72; }
html.rahav-dark .rahav-composer.is-note .rahav-composer__mode { background: #33270f; border-color: #57431c; }
html.rahav-dark .rahav-composer.is-note .rahav-composer__input { background: #2a2110; border-color: #57431c; }
.rahav-composer__tool--ai {
	width: 34px; height: 34px; padding: 0; justify-content: center;
	border-color: var(--rp-brand-soft); background: var(--rp-brand-soft); color: var(--rp-brand-deep);
}
.rahav-composer__tool--ai:hover { border-color: var(--rp-brand); }
.rahav-composer__tool--ai.is-loading { opacity: .6; cursor: wait; }
.rahav-composer__tool--ai.is-loading .rahav-composer__tool-ico { animation: rahav-blink 1.1s infinite; }

/* Wider context drawer under 1280px */
@media (max-width: 1280px) {
	.rahav-support[data-view="agent"] .rahav-support__layout { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); position: relative; }
	.rahav-support__context {
		position: absolute; inset-block: 0; inset-inline-end: 0; width: min(320px, 92%);
		z-index: 30; display: none; box-shadow: var(--rp-shadow);
	}
	.rahav-support.is-context-open .rahav-support__context { display: flex; }
	.rahav-context__close { display: inline-flex; }
}
@media (max-width: 980px) {
	.rahav-support[data-view="agent"] .rahav-support__layout { grid-template-columns: minmax(0, 1fr); }
	.rahav-support[data-view="agent"] .rahav-support__detail { height: 100%; }
	.rahav-support__context { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(340px, 92vw); z-index: 250; border-radius: 0; }
	.rahav-queue-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
	.rahav-queue-tabs .rahav-chip-btn { flex: 0 0 auto; }
	.rahav-sort { min-width: 0; flex: 1 1 auto; }
}

@media (min-width: 1281px) {
	.rahav-thread__actions [data-rs-context-toggle] { display: none; }
}

.rahav-thread__field { display: grid; gap: 2px; min-width: 0; }
.rahav-thread__field > span { font-size: 10px; font-weight: 700; color: var(--rp-faint); padding-inline-start: 3px; }
.rahav-thread__field .rahav-select { min-width: 130px; }
@media (max-width: 980px) {
	.rahav-thread__field { flex: 1 1 120px; }
	.rahav-thread__field .rahav-select { min-width: 0; width: 100%; }
}

@media (max-width: 1280px) {
	.rahav-support__toolbar { flex-wrap: wrap; }
	.rahav-support__toolbar .rahav-input { flex: 1 1 220px; max-width: none; }
}

.rahav-support[data-view="agent"] .rahav-support__placeholder:not([hidden]) {
	display: flex;
	grid-column: 2 / -1;
}

.rahav-ticket-list__pinned { background: var(--rp-brand-soft); color: var(--rp-brand-deep); border-radius: 999px; padding: 1px 7px; font-size: 10px; font-weight: 800; }

html.rahav-dark .rahav-ticket-list__waiting { color: #f3cf8a; }

/* ===== Agent layout fix: full-width thread, compact header/composer ===== */
.rahav-support[data-view="agent"] .rahav-thread__head {
	flex-wrap: wrap;
	row-gap: 6px;
}
.rahav-support[data-view="agent"] .rahav-thread__title-wrap { flex: 1 1 auto; }
.rahav-support[data-view="agent"] .rahav-thread__actions {
	flex: 1 1 100%;
	justify-content: flex-start;
	align-items: center;
	gap: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--rp-line);
}
.rahav-support[data-view="agent"] .rahav-thread__actions .rahav-btn { height: 34px; }
.rahav-thread__field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rahav-thread__field > span { font-size: 11px; font-weight: 700; color: var(--rp-faint); white-space: nowrap; }
.rahav-thread__field .rahav-select { min-width: 125px; height: 34px; padding: 5px 10px; }
.rahav-support[data-view="agent"] .rahav-composer__input { min-height: 3.2em; }
.rahav-support[data-view="agent"] .rahav-composer__foot { align-items: center; flex-wrap: wrap; }
.rahav-support[data-view="agent"] .rahav-composer__tools { flex: 1 1 auto; }
.rahav-support[data-view="agent"] .rahav-composer__mode { height: 34px; padding: 2px; }
.rahav-support[data-view="agent"] .rahav-mode-btn { padding: 4px 9px; font-size: 11.5px; }
.rahav-support[data-view="agent"] .rahav-msg--user .rahav-msg__name { color: var(--rp-ink); font-size: 11.5px; }

@media (max-width: 1280px) {
	.rahav-composer__keys { display: none; }
}
@media (max-width: 980px) {
	.rahav-support[data-view="agent"] .rahav-support__layout { grid-template-columns: minmax(0, 1fr); }
	.rahav-support[data-view="agent"] .rahav-thread__actions { gap: 6px; }
	.rahav-thread__field { flex: 1 1 120px; }
	.rahav-thread__field .rahav-select { min-width: 0; width: 100%; }
	.rahav-support[data-view="agent"] .rahav-composer__tools { flex: 1 1 100%; }
}

.rahav-support[data-view="agent"] .rahav-composer__input { min-height: 2.8em; }

@media (max-width: 980px) {
	.rahav-support[data-view="agent"] .rahav-thread__field { flex: 0 1 auto; }
	.rahav-support[data-view="agent"] .rahav-thread__field .rahav-select { width: auto; min-width: 145px; max-width: 200px; }
}

.rahav-support[data-view="agent"] .rahav-thread__actions {
	flex: 0 1 auto;
	justify-content: flex-end;
	border-top: 0;
	padding-top: 0;
	margin-top: 0;
}
@media (max-width: 980px) {
	.rahav-support[data-view="agent"] .rahav-thread__actions {
		flex: 1 1 100%;
		justify-content: flex-start;
		border-top: 1px solid var(--rp-line);
		padding-top: 8px;
	}
}

/* ===== Agent chat: no top metadata, all actions in the composer ===== */
.rahav-support[data-view="agent"] .rahav-thread__head {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	z-index: 25;
	width: auto;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
}
.rahav-support[data-view="agent"] .rahav-thread__title-wrap,
.rahav-support[data-view="agent"] .rahav-thread__actions { display: none !important; }
.rahav-support[data-view="agent"] .rahav-thread__back {
	display: none;
	width: 38px; height: 38px;
	background: var(--rp-card);
	border: 1px solid var(--rp-line);
	border-radius: 50%;
	box-shadow: var(--rp-shadow);
}
.rahav-support[data-view="agent"] .rahav-thread { padding-top: 10px; }
@media (max-width: 980px) {
	.rahav-support[data-view="agent"] .rahav-thread__back { display: inline-flex; }
	.rahav-support[data-view="agent"] .rahav-thread { padding-top: 48px; }
}

/* Icon-only composer tools */
.rahav-support .rahav-composer__tool {
	width: 34px;
	height: 34px;
	padding: 0;
	justify-content: center;
}
.rahav-composer__tool-label { display: none; }

/* Compact conversation actions next to send */
.rahav-ticket-actions-wrap { position: relative; display: inline-flex; }
.rahav-ticket-actions {
	position: absolute;
	inset-block-end: calc(100% + 8px);
	inset-inline-start: 0;
	z-index: 120;
	width: 260px;
	max-width: calc(100vw - 40px);
	background: var(--rp-card);
	border: 1px solid var(--rp-line);
	border-radius: 14px;
	padding: 10px;
	display: grid;
	gap: 8px;
	box-shadow: var(--rp-shadow);
}
.rahav-ticket-actions[hidden] { display: none !important; }
.rahav-ticket-actions__title { margin: 0; font-size: 12px; font-weight: 800; color: var(--rp-soft); }
.rahav-ticket-actions .rahav-thread__field { display: grid; gap: 3px; flex: none; }
.rahav-ticket-actions .rahav-thread__field > span { font-size: 10.5px; }
.rahav-ticket-actions .rahav-thread__field .rahav-select { width: 100%; min-width: 0; height: 34px; }
.rahav-ticket-actions .rahav-btn { width: 100%; height: 34px; }

.rahav-ticket-actions {
	inset-inline-start: auto;
	inset-inline-end: 0;
}

/* ===== Clean agent chat composer (single input with inline actions) ===== */
.rahav-support__list-filters { padding: 8px 10px 0; }
.rahav-support__list-filters .rahav-chips { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
.rahav-composer { display: block; padding: 10px 12px 12px; }
.rahav-composer__row { display: flex; align-items: flex-end; gap: 8px; }
.rahav-composer__box {
	flex: 1 1 auto; min-width: 0; position: relative;
	display: flex; align-items: flex-end; gap: 3px;
	border: 1px solid var(--rp-line); border-radius: 18px;
	background: var(--rp-card); padding: 5px 6px 5px 8px;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.rahav-composer__box:focus-within { border-color: var(--rp-brand); box-shadow: 0 0 0 3px var(--rp-brand-soft); }
.rahav-composer .rahav-composer__input {
	flex: 1 1 auto; min-width: 0; width: 100%; min-height: 2.5em; max-height: 10em;
	border: 0 !important; background: transparent !important; box-shadow: none !important;
	padding: 7px 4px; margin: 0; resize: none; line-height: 1.8; color: var(--rp-ink);
}
.rahav-composer .rahav-composer__input:focus { outline: none !important; box-shadow: none !important; }
.rahav-composer__inside {
	width: 32px; height: 32px; flex: 0 0 auto;
	border: 0; border-radius: 50%; background: transparent; color: var(--rp-soft);
	display: inline-flex; align-items: center; justify-content: center;
	font: inherit; font-size: 17px; line-height: 1; cursor: pointer;
}
.rahav-composer__inside:hover, .rahav-composer__inside:focus-visible { background: var(--rp-ground); color: var(--rp-ink); }
.rahav-composer__send {
	width: 36px; height: 36px; flex: 0 0 auto;
	border: 0; border-radius: 50%; background: var(--rp-brand); color: #fff;
	display: inline-flex; align-items: center; justify-content: center;
	font-size: 17px; line-height: 1; cursor: pointer;
}
.rahav-composer__send:hover { filter: brightness(.95); }
.rahav-composer__send:disabled { opacity: .55; cursor: not-allowed; }
.rahav-composer__ai {
	width: 40px; height: 40px; flex: 0 0 auto;
	border: 1px solid var(--rp-brand-soft); border-radius: 50%;
	background: var(--rp-brand-soft); color: var(--rp-brand-deep);
	display: inline-flex; align-items: center; justify-content: center;
	font-size: 18px; line-height: 1; cursor: pointer;
}
.rahav-composer__ai:hover { border-color: var(--rp-brand); }
.rahav-composer__ai.is-loading { opacity: .6; cursor: wait; }
.rahav-composer__box .rahav-emoji { inset-inline-start: 0; inset-inline-end: auto; }

@media (max-width: 500px) {
	.rahav-composer { padding: 8px; }
	.rahav-composer__row { gap: 6px; }
}

@media (max-width: 500px) {
	.rahav-composer { padding: 8px; }
	.rahav-composer__row { gap: 6px; }
}

.rahav-support__list-filters .rahav-chips { flex-wrap: wrap; overflow: visible; }

/* Chat card border requested by the agent UI */
.rahav-support[data-view="agent"] .rahav-support__detail {
	margin: 8px;
	height: calc(100% - 16px);
	border: 1px solid var(--rp-line);
	border-radius: 18px;
	box-shadow: 0 2px 10px rgba(20, 24, 40, .045);
}
.rahav-composer__inside svg,
.rahav-composer__send svg,
.rahav-composer__ai svg { display: block; pointer-events: none; }
.rahav-composer__send svg { transform: translateX(-1px); }
@media (max-width: 980px) {
	.rahav-support[data-view="agent"] .rahav-support__detail {
		margin: 6px;
		height: calc(100% - 12px);
	}
}

/* =========================================================================
   Agent queue: swapped panes + bare, compact rows (1.8.20)
   - chat card on the right, conversation list on the left
   - the list column is narrower so more conversations fit in one view
   - every row shows only: asker name, ticket title, phone, inbox state
   - one shared type scale keeps all four fields readable at a glance
   ========================================================================= */
.rahav-support[data-view="agent"] {
	--rs-queue-name: 13px;
	--rs-queue-meta: 11px;
	--rs-queue-pad-block: 6px;
	--rs-queue-pad-inline: 10px;
}

@media (min-width: 981px) {
	.rahav-support[data-view="agent"] .rahav-support__layout {
		grid-template-columns: minmax(0, 1fr) clamp(268px, 19.5vw, 286px);
	}
	.rahav-support[data-view="agent"] .rahav-support__detail { order: -1; }
	.rahav-support[data-view="agent"] .rahav-support__list-box { order: 1; }
	.rahav-support[data-view="agent"] .rahav-support__placeholder:not([hidden]) { grid-column: 1 / 2; }
}

/* Narrow white frame around the chat card. */
.rahav-support[data-view="agent"] .rahav-support__detail { border-color: #fff; }
html.rahav-dark .rahav-support[data-view="agent"] .rahav-support__detail { border-color: rgba(255, 255, 255, .38); }

/* Tighten the list chrome so the rows themselves get the space. */
.rahav-support[data-view="agent"] .rahav-support__list-head { padding: 8px 10px; }
.rahav-support[data-view="agent"] .rahav-support__list-filters { padding: 6px 6px 0; }
.rahav-support[data-view="agent"] .rahav-queue-tabs { gap: 3px; }
.rahav-support[data-view="agent"] .rahav-queue-tabs .rahav-chip-btn { padding: 3px 8px; font-size: 11px; }
.rahav-support[data-view="agent"] .rahav-support__list-wrap { padding: 6px; }
.rahav-support[data-view="agent"] .rahav-ticket-list { gap: 3px; }

.rahav-support[data-view="agent"] .rahav-ticket-list__link--compact {
	display: grid;
	gap: 2px;
	padding: var(--rs-queue-pad-block) var(--rs-queue-pad-inline);
	border-radius: 10px;
	line-height: 1.45;
}
.rahav-support[data-view="agent"] .rahav-ticket-list__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
}
.rahav-support[data-view="agent"] .rahav-ticket-list__row--foot { align-items: center; }
.rahav-support[data-view="agent"] .rahav-ticket-list__name {
	flex: 0 0 auto;
	max-width: 48%;
	min-width: 0;
	font-size: var(--rs-queue-name);
	font-weight: 700;
	color: var(--rp-ink);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.rahav-support[data-view="agent"] .rahav-ticket-list__link--compact .rahav-ticket-list__subject {
	flex: 1 1 auto;
	min-width: 0;
	font-size: var(--rs-queue-meta);
	font-weight: 600;
	color: var(--rp-soft);
	text-align: end;
}
.rahav-support[data-view="agent"] .rahav-ticket-list__phone {
	flex: 0 1 auto;
	min-width: 0;
	color: var(--rp-faint);
	font-size: var(--rs-queue-meta);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: .2px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.rahav-support[data-view="agent"] .rahav-ticket-list__status {
	flex: 0 0 auto;
	font-size: var(--rs-queue-meta);
	font-weight: 700;
	color: var(--rp-soft);
}
.rahav-support[data-view="agent"] .rahav-ticket-list__status--open { color: #b45309; }
.rahav-support[data-view="agent"] .rahav-ticket-list__status--waiting { color: #2f7dd1; }
.rahav-support[data-view="agent"] .rahav-ticket-list__status--answered { color: #0f7a45; }
html.rahav-dark .rahav-support[data-view="agent"] .rahav-ticket-list__status--open { color: #f3cf8a; }
html.rahav-dark .rahav-support[data-view="agent"] .rahav-ticket-list__status--waiting { color: #9db9ff; }
html.rahav-dark .rahav-support[data-view="agent"] .rahav-ticket-list__status--answered { color: #7fd8a6; }
