/* Site agent piece 5, the home page chat, as rearranged by the tabs round (spec 2026-11-14). One frame inside
   the chooser's centred .tf column (.hc-frame; .hc-card is the cards inside messages, as before): a tab row (hidden until home-chat.js shows it), the chat panel and the
   blocks panel with the chooser's own tiles (tool-first.css styles them). Same-origin only, no @import; the
   shared tokens, like tool-first.css. Reply composer round (spec 2026-11-14): the thread reads like a chat app,
   the visitor's line a small bubble at the end edge, ours plain text on the full width behind the gold mark,
   system lines in the middle; the log scrolls with the page, never inside the card. The dots above the log
   follow the conversation's stage; a returning conversation folds the log behind the card (.hc-resume). The
   composer of an open conversation (.hc-composer) is the one-line pill with the arrow inside, stuck to the
   bottom of the screen while the card is in view; the empty state keeps the landing box and the chips. */
.hc { margin: 0 0 32px; text-align: start; }
.hc-lead { margin: 0 0 12px; color: var(--text-muted); text-align: center; }
.hc-notice { margin: 0 0 12px; }
.hc-frame {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  min-width: 0;
}

/* The tab row sits flush with the card's top edge; the selected tab carries the control colour underneath. */
.hc-tabs {
  display: flex;
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface-page);
  overflow: hidden;
}
.hc-tab {
  flex: 1; padding: var(--space-3) var(--space-2); margin-bottom: -1px;
  font: inherit; font-weight: var(--fw-semibold); color: var(--text-muted);
  background: transparent; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
}
.hc-tab[aria-selected="true"] { color: var(--text-default); border-bottom-color: var(--control); background: var(--surface-raised); }
.hc-tab:focus-visible { outline: 2px solid var(--control); outline-offset: -2px; }
.hc-panel { display: grid; gap: var(--space-3); align-content: start; min-width: 0; }
/* The guard: the display rules above would beat the UA [hidden] rule and show both panels (and the row) at once. */
.hc-tabs[hidden], .hc-panel[hidden] { display: none; }
.hc-panel-title { margin: 0; font-size: 1rem; font-weight: var(--fw-semibold); }
.hc-panel .tf-lead { margin: 0; }
.hc-panel .tf-tiles { margin: 0; }
.hc-blocks-hint, .hc-connect, .hc-direct { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.hc-connect a, .hc-direct a { color: inherit; }

/* The dots: five steps on one line, done in the live hue, the current one ringed in the control colour. */
.hc-dots { list-style: none; margin: 0; padding: var(--space-1) 0; display: flex; align-items: center; }
.hc-step { position: relative; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-subtle); background: var(--surface-raised); }
.hc-step + .hc-step { margin-inline-start: 28px; }
.hc-step + .hc-step::before { content: ''; position: absolute; inset-inline-end: 100%; top: 50%; width: 28px; height: 2px; background: var(--border-subtle); transform: translateY(-50%); }
.hc-step.is-done { background: var(--signal-live); border-color: var(--signal-live); }
.hc-step.is-done + .hc-step::before { background: var(--signal-live); }
.hc-step.is-now { background: var(--control); border-color: var(--control); box-shadow: 0 0 0 4px color-mix(in srgb, var(--control) 22%, transparent); }

/* The returning card: where things stand, then the log folded behind a native details (no script needed). */
.hc-resume { display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px dashed var(--border-subtle); border-radius: var(--radius-md); }
.hc-resume-since { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.hc-resume-state { margin: 0; font-weight: var(--fw-semibold); }
.hc-resume-now { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.hc-fold > summary { cursor: pointer; font-weight: var(--fw-semibold); color: var(--control); }
.hc-fold[open] > summary .hc-fold-closed, .hc-fold:not([open]) > summary .hc-fold-open { display: none; }
.hc-fold > .hc-log { margin-block-start: var(--space-2); }
.hc-fold-all-item { list-style: none; }
.hc-fold-all > summary { cursor: pointer; font-size: 0.85rem; color: var(--text-muted); }
.hc-log-older { margin-block-start: var(--space-2); }

.hc-log { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.hc-msg { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
.hc-msg-visitor {
  justify-self: end; max-width: 80%; padding: var(--space-2) var(--space-3);
  background: var(--surface-page); border-radius: var(--radius-lg); border-end-start-radius: var(--radius-sm);
}
/* Our line: the mark in a narrow first column, everything else (the body, the cards) in the second. */
.hc-msg-agent { border: 0; padding: 0; display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: var(--space-2); align-items: start; }
.hc-msg-agent > :not(.hc-mark) { grid-column: 2; }
.hc-mark { grid-column: 1; color: var(--brand-star); line-height: inherit; text-align: center; }
.hc-msg-agent > .hc-card { margin-block-start: 0; }
.hc-msg-system { justify-self: center; padding: var(--space-2) var(--space-3); border: 1px dashed var(--color-border); border-radius: var(--radius-md); color: var(--text-muted); font-size: 0.9rem; }
.hc-body { white-space: pre-line; margin: 0; }
.hc-card { margin: var(--space-2) 0 0; }
.hc-card-signup, .hc-card-upload { padding: var(--space-3); border: 2px dashed var(--color-border); border-radius: var(--radius-md); }
.hc-card-upload[data-hc-upload] { display: grid; gap: var(--space-2); justify-items: start; }
.hc-card-upload input[type="file"] { max-width: 100%; }
.hc-upload-nojs, .hc-upload-status { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.hc-upload-status:empty { display: none; }
.hc-card-label { margin: 0; font-weight: var(--fw-semibold); }
.hc-working, .hc-cap { margin: 0; color: var(--text-muted); }
.hc-card-go { margin: var(--space-2) 0 0; }
.hc-on-its-way { margin: 0; font-weight: var(--fw-semibold); }

.hc-form { display: grid; gap: var(--space-2); margin: 0; }
.hc-site-label { font-size: 0.9rem; color: var(--text-muted); }
.hc-form select { justify-self: start; max-width: 100%; }
.hc-form textarea { width: 100%; max-width: none; min-height: 6rem; font: inherit; resize: vertical; }
.hc-form textarea:disabled { opacity: 0.6; }
.hc-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.hc-chip {
  background: transparent; color: var(--text-default); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3);
  font: inherit; font-size: 0.9rem; cursor: pointer;
}
.hc-chip:hover, .hc-chip:focus-visible { border-color: var(--control); }
.hc-chip:focus-visible { outline: 2px solid var(--control); outline-offset: 2px; }
.hc-status { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.hc-status:empty { display: none; }
.hc-actions { margin: 0; display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.hc-end { margin: 0; }

/* The reply composer: sticky on the card's surface, the pill holds the one-line box and the round arrow. */
.hc-composer { position: sticky; bottom: env(safe-area-inset-bottom, 0px); z-index: 1; background: var(--surface-raised); padding-block: var(--space-2); display: grid; gap: var(--space-1); }
/* 23px is half the one-line height: one line is a pill, a grown box a rounded rectangle (999px made an ellipse that cut the text). */
.hc-pill { display: flex; align-items: flex-end; gap: var(--space-2); padding: var(--space-1); padding-inline-start: var(--space-3); border: 1px solid var(--border-subtle); border-radius: 23px; background: var(--surface-page); }
.hc-pill:focus-within { border-color: var(--control); }
.hc-pill:has(textarea:focus-visible) { outline: 2px solid var(--control); outline-offset: 2px; }
/* 18em = 12 lines at 1.5; field-sizing lets the box grow on its own where the browser knows it (the script sets the height elsewhere). */
.hc-form.is-reply textarea { min-height: 0; max-height: 18em; resize: none; border: 0; background: transparent; outline: none; box-shadow: none; padding: var(--space-1) 0; line-height: 1.5; field-sizing: content; }
.hc-composer .hc-working { font-size: 0.9rem; padding-inline: var(--space-3); }
.hc-send { flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--control); color: var(--color-white); display: grid; place-items: center; cursor: pointer; }
.hc-send:disabled { opacity: 0.5; cursor: default; }
.hc-send:focus-visible { outline: 2px solid var(--text-default); outline-offset: 2px; }
.hc-pill:has(textarea:placeholder-shown) .hc-send { opacity: 0.55; }
.hc-under { display: flex; align-items: center; gap: var(--space-2); padding-inline: var(--space-3); font-size: 0.85rem; color: var(--text-muted); }
.hc-under > * + *::before { content: '·' / ''; margin-inline-end: var(--space-2); }
.hc-under a, .hc-link { color: inherit; }
.hc-link { font: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

@media (max-width: 640px) {
  .hc-frame { padding: var(--space-3); }
  .hc-tabs { margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) 0; }
  .hc-msg-visitor { max-width: 90%; }
}
