/* Enquiry screens (organization businesses): additions to app.css / customer.css, same tokens. */

.alerts:empty { display: none; }
.alerts { display: grid; gap: 0.5rem; }
.alerts:focus-within { scroll-margin-top: 4.5rem; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

.reply__state { display: block; margin-top: 0.25rem; }
.reply__body { display: block; margin-top: 0.4rem; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9rem; overflow: auto; }
.reply__body--open { max-height: none; overflow: visible; }
.reply__body-wrap { display: block; }
.reply__body:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.reply__preview { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0.75rem 0.9rem; background: var(--soft); }
.reply-list .list__item { align-items: flex-start; }

.callout .state__actions { margin-top: 0.4rem; }
.field[hidden] { display: none; }

/* long references, e-mail addresses and urls never push a card wider than the screen */
.page .card, .page .list__main, .page .kv dd { min-width: 0; overflow-wrap: anywhere; }
.page .kv { grid-template-columns: minmax(6rem, 10rem) minmax(0, 1fr); }
.filters .field { min-width: min(100%, 12rem); }
.filters input[type="search"] { min-width: 0; width: 100%; }

.contact-import { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.contact-import input[type="file"] { min-width: 0; width: 100%; }
.contact-import code { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .page .kv { grid-template-columns: minmax(0, 1fr); }
  .page .kv dt { margin-top: 0.4rem; }
  .dialog, .dialog--wide { width: calc(100vw - 1.5rem); max-width: none; }
}

/* ---------- enquiry list on phones: labelled cards and folded filters (max-width 640px, the app's phone breakpoint) ---------- */
.filters__toggle { display: none; }

@media (max-width: 640px) {
  .filters__toggle { display: flex; width: calc(100% - 1.5rem); margin: 0.75rem; justify-content: space-between; white-space: normal; text-align: left; }
  .filters__toggle::after { content: "\25BE"; content: "\25BE" / ""; margin-left: 0.5rem; }
  .filters__toggle[aria-expanded="true"]::after { content: "\25B4"; content: "\25B4" / ""; }
  .filters.filters--collapsed { display: none; }

  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table--cards tbody { padding: 0.5rem 0.75rem; }
  .table--cards tr { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card, #fff); margin: 0.6rem 0; padding: 0.25rem 0.75rem; }
  .table--cards tbody tr:last-child td, .table--cards td { border-bottom: 0; }
  .table--cards td { display: grid; grid-template-columns: minmax(4.75rem, 6rem) minmax(0, 1fr); gap: 0.5rem; padding: 0.4rem 0; min-width: 0; overflow-wrap: anywhere; word-break: break-word; vertical-align: top; }
  .table--cards td::before { content: attr(data-label); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding-top: 0.15rem; }
  .table--cards td:first-child { font-weight: 650; }
  .table--cards td > * { min-width: 0; justify-self: start; max-width: 100%; }
}
/* AI reply drafts (2026-11-24) */
.reply__ai { display: block; margin-top: 0.25rem; }
/* The long AI label wraps inside the card on narrow screens instead of running past its edge. */
.reply__ai .badge { white-space: normal; max-width: 100%; border-radius: 0.75rem; }
.reply__internal { display: block; margin-top: 0.4rem; padding: 0.5rem 0.7rem; }
.reply__provenance { display: block; margin-top: 0.5rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--soft); }
.reply__provenance-title { display: block; font-weight: 600; margin-top: 0.25rem; }
.reply__sources, .reply__unknowns { margin: 0.2rem 0 0.4rem 1.1rem; padding: 0; }
.reply__sources a { overflow-wrap: anywhere; }
