/**
 * Support desk.
 *
 * Layered on /theme.css, which owns the tokens, the base typography and every
 * shared component. This file holds only the conversation: the transcript, the
 * bubbles and the composer.
 *
 * The bubbles deliberately do not use the brand colour as a fill. --accent is
 * whatever the panel administrator set it to, and white-on-arbitrary-hue is a
 * coin flip for legibility; the visitor's own messages are distinguished by an
 * accent rail and a tinted surface instead, both of which keep body text on a
 * theme-aware --ink token in either theme.
 */

/* ------------------------------------------------------------------ */
/* Start form                                                          */
/* ------------------------------------------------------------------ */

.hero {
  margin-bottom: 20px;
}

.hero .lead {
  margin-top: 8px;
  max-width: 62ch;
}

.contact-links {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 18px;
}

/* ------------------------------------------------------------------ */
/* My conversations                                                    */
/* ------------------------------------------------------------------ */

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 14px;
}

.ticket-row {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
  text-align: start;
  font: inherit;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 15px;
  cursor: pointer;
  transition: border-color var(--step), background var(--step);
}

.ticket-row:hover {
  border-color: var(--accent);
  background: var(--paper-2);
}

.ticket-row-subject {
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  flex: 1;
  min-width: 0;
}

.unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* ------------------------------------------------------------------ */
/* Chat shell                                                          */
/* ------------------------------------------------------------------ */

.chat-panel {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.chat-title h1 {
  font-size: 18px;
}

.chat-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.code-card {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
  padding: 11px 20px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.code-card code {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.06em;
}

.code-card .hint {
  color: var(--ink-3);
  font-size: 12px;
  flex-basis: 100%;
  line-height: 1.7;
}

/* ------------------------------------------------------------------ */
/* Transcript                                                          */
/* ------------------------------------------------------------------ */

.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
  max-height: min(58vh, 620px);
  background: var(--bg);
}

.bubble {
  max-width: min(78%, 560px);
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 11px 14px;
  align-self: flex-start;
}

/* The visitor's own side: tinted surface plus an accent rail, never a solid
   brand fill - see the note at the top of this file. */
.bubble.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: var(--accent);
  border-inline-end: var(--rail) solid var(--accent);
}

.bubble.system {
  align-self: center;
  max-width: min(88%, 640px);
  background: var(--paper-2);
  border-style: dashed;
  text-align: center;
}

.bubble-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
}

.bubble.system .bubble-head {
  justify-content: center;
}

.stamp {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.bubble-body {
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-image {
  display: block;
  margin-top: 9px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.bubble-image img {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}

/* ------------------------------------------------------------------ */
/* Composer                                                            */
/* ------------------------------------------------------------------ */

.compose {
  border-top: 1px solid var(--line);
  padding: 14px 20px 18px;
  background: var(--paper);
}

.compose textarea {
  min-height: 62px;
}

.compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.compose-hint {
  color: var(--ink-3);
  font-size: 12px;
}

@media (max-width: 520px) {
  .chat-stream {
    padding: 14px;
  }

  .bubble {
    max-width: 92%;
  }
}
