/* Messages: the contact form, the conversation bubbles (the customer's page
   and the console share them), and the console inbox list. Built on the
   tokens and components in site.css / admin.css; nothing here restyles them.

   A bubble is .mine (right, green: what the viewer wrote) or .theirs (left,
   white); .note is a console-only private note across the full width. */

/* ------------------------------------------------------------ contact form */
.contact-split { align-items: start; }
.contact-card .form { gap: 20px; }
.topic-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* four topics: always two by two */
.topic-choices .choice-body { padding: 12px 14px; align-content: start; }
.ref-input { text-transform: uppercase; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.ref-input::placeholder { text-transform: none; letter-spacing: 0; }
.contact-form .human + .field-error { margin-top: -10px; }

.contact-aside { --stack: 12px; }
.aside-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px 18px 20px; }
.aside-card h2 { margin-bottom: .3em; }
.aside-card p { margin-bottom: .5em; font-size: .95rem; }
.aside-icon { flex-shrink: 0; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--peony-soft); color: var(--peony); }
.aside-icon svg { width: 20px; height: 20px; }
.aside-link { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 600; text-decoration: none; }
.aside-link:hover { text-decoration: underline; }
.aside-link svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------ thank-you */
.ref-pill { display: inline-block; padding: 2px 12px; border-radius: var(--pill); background: var(--surface); border: 1px solid #cfe2d3; color: var(--green-dark); letter-spacing: .02em; }
.next-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.next-steps li { display: flex; gap: 12px; align-items: flex-start; }
.step-icon { flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.step-icon svg { width: 17px; height: 17px; }

/* ------------------------------------------------------------ conversation */
.convo-title { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.5rem); }
.convo { list-style: none; margin-inline: 0; margin-bottom: 0; padding: 0; display: grid; gap: 12px; } /* top margin: the surrounding .stack's */
.convo:first-child { margin-top: 0; }
.bubble {
  position: relative; max-width: min(88%, 620px); padding: 12px 16px 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft);
  justify-self: start; border-bottom-left-radius: 6px; scroll-margin-top: calc(var(--header-h) + 16px);
}
.bubble.mine { justify-self: end; background: var(--green-soft); border-color: #cfe2d3; border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
.bubble.note {
  justify-self: stretch; max-width: none; background: var(--warn-soft); border: 1px dashed #e7cf8f; border-radius: var(--radius); box-shadow: none;
}
.bubble-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 4px; font-size: .82rem; color: var(--muted); }
.bubble-meta strong { color: var(--ink); font-weight: 650; }
.bubble-meta time { font-variant-numeric: tabular-nums; }
.bubble-body { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; }
.bubble-tag { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; font-weight: 600; color: var(--green-dark); }
.bubble-tag svg { width: 14px; height: 14px; }
.bubble-tag.failed { color: var(--danger); }
.bubble.note .bubble-tag { color: var(--warn); }
.bubble-action { margin-top: 10px; }

/* ------------------------------------------------------------ console inbox */
.msg-tabs { margin-bottom: 14px; }
.msg-search { margin-bottom: 18px; flex-wrap: nowrap; }
.msg-search input[type="search"] { flex: 1 1 auto; min-width: 0; }
.msg-search .btn { flex-shrink: 0; }
.msg-list .row-item { align-items: flex-start; gap: 10px; }
.msg-list .row-main { gap: 1px; }
.msg-list .row-title { font-weight: 500; }
.msg-list .row-sub { color: var(--muted); }
.msg-meta { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-you { color: var(--ink); font-weight: 500; }
.unread-dot { flex-shrink: 0; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: transparent; }
.msg-item.unread .unread-dot { background: var(--peony); }
.msg-item.unread .row-title { font-weight: 750; }
.msg-item.unread .row-sub { color: var(--ink); font-weight: 500; }
.msg-item.unread .row-item { background: #fffafc; }
.msg-item.unread a.row-item:hover { background: var(--peony-soft); }
.msg-item.closed .row-title, .msg-item.closed .row-sub { opacity: .75; }
.msg-status-new { background: var(--peony-soft); color: var(--peony-dark); }
.msg-status-open { background: var(--green-soft); color: var(--green-dark); }
.msg-status-closed { background: #eef2ee; color: var(--muted); }

/* ------------------------------------------------------------ console thread */
.msg-head .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.msg-actions { gap: 8px; }
.msg-actions form { display: contents; }
.msg-note > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 28px; }
.msg-note > summary::-webkit-details-marker { display: none; }
.msg-note > summary .panel-title { font-weight: 700; font-size: 1.05rem; }
.msg-note > summary::before { content: "+"; font-weight: 700; color: var(--green); width: 1em; }
.msg-note[open] > summary::before { content: "−"; }
.msg-warn { display: block; margin-top: 4px; font-size: .85rem; font-weight: 500; color: var(--warn); }
.msg-emails { list-style: none; margin: 0; padding: 0; display: grid; }
.msg-emails li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.msg-emails li:first-child { padding-top: 0; }
.msg-emails li:last-child { border-bottom: 0; padding-bottom: 0; }
.msg-emails .small { overflow-wrap: anywhere; }

@media (max-width: 520px) {
  .bubble { max-width: 94%; }
  .msg-actions { width: 100%; }
}
