/* Inbox: customers' messages and the baker's replies (src/features/inbox).
   Both layouts load it in the head (after site.css or admin.css); account.css restyles the
   customer side for its pages, and the admin rules at the end all start with .admin. Only tokens from tokens.css; phone first.
   design/rules.md: no font-size, font-weight, font-family, letter-spacing or text-transform here;
   no pills, dots or left bars; white cards on cream, ink text, one hairline, no tints (the admin
   chat puts her own messages in the one dark ink, like the button). Text sizes and bold come from the markup (.t-small, strong). */

/* ---- Public pages ---- */
.inbox-form { display: grid; gap: var(--mm-space-4); padding: var(--mm-space-5); }
@media (max-width: 479px) { .inbox-form { padding: var(--mm-space-4); } }
.inbox-form textarea { min-height: 9rem; }

/* The honeypot: off screen for people, still in the form for bots. */
.inbox-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* The account's list of conversations */
.inbox-threads { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.inbox-thread-link { display: grid; gap: 4px; padding: var(--mm-space-4) 0; min-height: 56px; color: var(--mm-ink); text-decoration: none; }
.inbox-thread-link__top { display: flex; flex-wrap: wrap; gap: var(--mm-space-2) var(--mm-space-4); align-items: baseline; justify-content: space-between; }
.inbox-thread-link__preview { overflow-wrap: anywhere; }

/* ---- Messages (both sides) ---- */
.msgs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--mm-space-3); }
.msg {
  background: var(--mm-card); border: var(--mm-border); border-radius: var(--mm-radius-md);
  padding: var(--mm-space-3) var(--mm-space-4); display: grid; gap: var(--mm-space-2); min-width: 0;
  margin-right: var(--mm-space-6);
}
.msg--mine { margin-right: 0; margin-left: var(--mm-space-6); }
@media (max-width: 479px) { .msg { margin-right: var(--mm-space-4); } .msg--mine { margin-left: var(--mm-space-4); margin-right: 0; } }
.msg__who { display: flex; flex-wrap: wrap; gap: 4px var(--mm-space-2); align-items: baseline; color: var(--mm-ink-soft); margin: 0; }
.msg__who strong { color: var(--mm-ink); }
/* Line breaks as typed; long words and links wrap instead of widening the page. Links are plain text. */
.msg__body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; line-height: var(--mm-leading-body); }
/* "New": a plain bold word in the who-line (no pill). */
.msg__new { color: var(--mm-ink); }

/* ---- Admin (src/features/inbox/views-admin.tsx). Every rule starts with .admin, so the
   customer pages (which also load this file) never pick them up. Built like the admin Home:
   list rows of one shape (an icon, a name, Small text under it) split by hairlines, white
   panels, Lucide icons in the .icon stroke, the one .btn. ---- */

/* The list: search and topic, the tabs, then the conversations grouped by status. */
.admin .inbox { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mm-space-4); max-width: 48rem; }
.admin .inbox > .notice { margin: 0; }
.admin .inbox-find { display: flex; gap: var(--mm-space-2); align-items: center; }
.admin .inbox-search { position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }
.admin .inbox-search > .icon { position: absolute; left: 14px; width: 20px; height: 20px; color: var(--mm-ink-soft); pointer-events: none; }
/* [type] makes this as specific as base.css's field rule (which pads 14px), so the words start after the icon. */
.admin .inbox-search > input[type="search"] { padding-left: 44px; }
.admin .inbox-topic { flex: 0 1 10.5rem; min-width: 7.5rem; }
.admin .inbox-topic select { text-overflow: ellipsis; }
.admin .inbox .tabs { margin: 0; }
.admin .inbox-none { color: var(--mm-ink-soft); }
.admin .inbox-empty { display: grid; justify-items: center; gap: var(--mm-space-3); padding: var(--mm-space-7) var(--mm-space-4); text-align: center; }

.admin .inbox-group { display: grid; gap: var(--mm-space-2); min-width: 0; }
.admin .inbox-group + .inbox-group { margin-top: var(--mm-space-3); }
.admin .inbox-group__title { margin: 0; }
.admin .inbox-group__count { color: var(--mm-ink-soft); font-variant-numeric: tabular-nums; }

/* One conversation: the topic icon over both lines, the name and the time, the last message
   on one line under them. Unread: the name bold (in the markup), the line and time in ink. */
.admin .inbox-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "icon name time" "icon line line";
  align-items: center; column-gap: var(--mm-space-3); row-gap: 2px;
  min-height: 64px; padding: var(--mm-space-3) var(--mm-space-4); color: var(--mm-ink); text-decoration: none;
}
.admin .inbox-row:has(.inbox-row__status) { grid-template-areas: "icon name time" "icon line status"; }
.admin .inbox-row > .icon { grid-area: icon; color: var(--mm-ink-soft); }
.admin .inbox-row__name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin .inbox-row__time { grid-area: time; justify-self: end; color: var(--mm-ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin .inbox-row__preview { grid-area: line; min-width: 0; color: var(--mm-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin .inbox-row__status { grid-area: status; justify-self: end; color: var(--mm-ink-soft); white-space: nowrap; }
.admin .inbox-row--unread .inbox-row__preview, .admin .inbox-row--unread .inbox-row__time { color: var(--mm-ink); }
.admin .inbox-row:hover { color: var(--mm-ink); }
.admin .inbox-row:hover .inbox-row__name { text-decoration: underline; text-underline-offset: 3px; }

/* ---- One conversation ---- */
.admin .inbox-thread { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mm-space-5); }
.admin .inbox-thread > .notice { margin: 0; }
/* The header actions: Close (or Reopen) and Mark as unread, an icon and the words. */
.admin .inbox-actions { display: flex; flex-wrap: wrap; gap: 0 var(--mm-space-5); }
.admin .inbox-action { gap: var(--mm-space-2); text-decoration: none; }
.admin .inbox-action:hover { text-decoration: underline; }
.admin .inbox-action .icon { width: 20px; height: 20px; }
/* What it is about, under the title. */
.admin .inbox-about { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--mm-space-4); color: var(--mm-ink-soft); margin-top: calc(-1 * var(--mm-space-4)); }
.admin .inbox-about__topic { display: inline-flex; align-items: center; gap: var(--mm-space-2); min-height: 32px; }
.admin .inbox-about .icon { width: 18px; height: 18px; }
.admin .inbox-about a { display: inline-flex; align-items: center; min-height: 44px; }
.admin .inbox-conversation { gap: var(--mm-space-5); }
.admin .inbox-aside { gap: var(--mm-space-4); }

/* The chat: theirs on the left in a white panel, hers on the right in ink, the time under
   each, a line of Small text for each day and for where the new ones start. */
.admin .chat { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mm-space-3); }
.admin .chat__day, .admin .chat__new { justify-self: center; color: var(--mm-ink-soft); padding-top: var(--mm-space-2); }
.admin .chat__day:first-child { padding-top: 0; }
.admin .chat__new { color: var(--mm-ink); }
.admin .chat__msg { display: grid; justify-items: start; gap: 2px; justify-self: start; max-width: min(85%, 34rem); min-width: 0; }
.admin .chat__msg--mine { justify-self: end; justify-items: end; }
.admin .chat__bubble {
  padding: 10px 14px; background: var(--mm-card); border: var(--mm-rule);
  border-radius: var(--mm-radius-section) var(--mm-radius-section) var(--mm-radius-section) 2px;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
}
.admin .chat__msg--mine .chat__bubble {
  background: var(--mm-ink); border-color: var(--mm-ink); color: var(--mm-cream);
  border-radius: var(--mm-radius-section) var(--mm-radius-section) 2px var(--mm-radius-section);
}
.admin .chat__time { color: var(--mm-ink-soft); padding: 0 2px; font-variant-numeric: tabular-nums; }

/* The reply box: quick replies above it, then Send and Send and close, the one button twice. */
.admin .inbox-reply { gap: var(--mm-space-3); scroll-margin-top: 72px; }
.admin .inbox-reply__form { display: grid; gap: var(--mm-space-3); }
.admin .inbox-reply__actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--mm-space-3); }
@media (min-width: 640px) { .admin .inbox-reply__actions { display: flex; flex-wrap: wrap; } }
.admin .inbox-reply__actions .btn { padding: 0 var(--mm-space-4); }
.admin .inbox-reply__actions .btn .icon { width: 20px; height: 20px; }
.admin .inbox-quick { border-bottom: var(--mm-rule); margin: calc(-1 * var(--mm-space-2)) 0 0; }
.admin .inbox-quick__toggle {
  display: flex; align-items: center; gap: var(--mm-space-2); min-height: 44px; list-style: none; cursor: pointer;
  color: var(--mm-terracotta); -webkit-tap-highlight-color: transparent;
}
.admin .inbox-quick__toggle::-webkit-details-marker { display: none; }
.admin .inbox-quick__toggle:hover span { text-decoration: underline; text-underline-offset: 3px; }
.admin .inbox-quick__toggle .icon { width: 20px; height: 20px; }
.admin .inbox-quick[open] > .inbox-quick__toggle { color: var(--mm-ink); }
.admin .inbox-quick__list { list-style: none; margin: 0; padding: 0; border-top: var(--mm-rule); }
.admin .inbox-quick__list > li + li { border-top: var(--mm-rule); }
.admin .inbox-quick__item { display: grid; gap: 2px; min-height: 56px; padding: var(--mm-space-2) 0; align-content: center; color: var(--mm-ink); text-decoration: none; }
.admin .inbox-quick__item:hover .inbox-quick__label { text-decoration: underline; text-underline-offset: 3px; }
.admin .inbox-quick__body { color: var(--mm-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin .inbox-quick__edit { display: inline-flex; align-items: center; min-height: 44px; }

/* Who wrote: rows of one shape, an icon and the words, hairlines between. */
.admin .inbox-facts, .admin .inbox-orders, .admin .inbox-note-list { list-style: none; margin: 0; padding: 0; }
.admin .inbox-facts { border-top: var(--mm-rule); }
.admin .inbox-facts > li, .admin .inbox-orders > li { border-bottom: var(--mm-rule); }
.admin .inbox-fact { display: flex; align-items: center; gap: var(--mm-space-3); min-height: 48px; padding: var(--mm-space-2) 0; color: var(--mm-ink); text-decoration: none; }
.admin .inbox-fact > .icon:first-child { color: var(--mm-ink-soft); }
.admin .inbox-fact__text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.admin a.inbox-fact:hover .inbox-fact__text { text-decoration: underline; text-underline-offset: 3px; }
.admin .inbox-order { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--mm-space-3); min-height: 56px; padding: var(--mm-space-2) 0; align-content: center; color: var(--mm-ink); text-decoration: none; }
.admin .inbox-order:hover .inbox-order__name { text-decoration: underline; text-underline-offset: 3px; }
.admin .inbox-order__name { min-width: 0; overflow-wrap: anywhere; }
.admin .inbox-order__amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin .inbox-order__meta { grid-column: 1 / -1; color: var(--mm-ink-soft); }

/* Private notes: the words, the time under them, hairlines between. */
.admin .inbox-note-list > li { display: grid; gap: 2px; padding: var(--mm-space-2) 0; border-bottom: var(--mm-rule); }
.admin .inbox-note-list > li:first-child { padding-top: 0; }
.admin .inbox-note-list time { color: var(--mm-ink-soft); }
.admin .inbox-note__body { white-space: pre-wrap; overflow-wrap: anywhere; }
.admin .inbox-note-form { display: grid; gap: var(--mm-space-1); justify-items: start; }
.admin .inbox-note-form > .field { width: 100%; }

/* ---- Quick replies (Settings): a settings list. Each row opens to its form. ---- */
.admin .inbox-settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mm-space-4); max-width: 40rem; }
.admin .inbox-settings > .notice, .admin .inbox-settings > .error-summary { margin: 0; }
.admin .inbox-qr__row {
  display: flex; align-items: center; gap: var(--mm-space-3); min-height: 64px; padding: var(--mm-space-3) var(--mm-space-4);
  list-style: none; cursor: pointer; color: var(--mm-ink); -webkit-tap-highlight-color: transparent;
}
.admin .inbox-qr__row::-webkit-details-marker { display: none; }
.admin .inbox-qr__row > .icon:first-child { color: var(--mm-ink-soft); }
.admin .inbox-qr__row:hover .inbox-qr__label { text-decoration: underline; text-underline-offset: 3px; }
.admin .inbox-qr__text { flex: 1 1 auto; display: grid; gap: 2px; min-width: 0; }
.admin .inbox-qr__label { overflow-wrap: anywhere; }
.admin .inbox-qr__body { color: var(--mm-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin .inbox-qr__row .icon--end { margin-left: 0; transition: transform var(--mm-duration) var(--mm-ease); }
.admin .inbox-qr[open] > .inbox-qr__row .icon--end { transform: rotate(90deg); }
.admin .inbox-qr__full { cursor: default; color: var(--mm-ink-soft); }
.admin .inbox-qr__panel { display: grid; gap: var(--mm-space-3); justify-items: start; padding: 0 var(--mm-space-4) var(--mm-space-4); }
.admin .inbox-qr__form { display: grid; gap: var(--mm-space-4); width: 100%; }
.admin .inbox-qr__actions { margin: 0; }
