/* ==========================================================================
   TbChat — the ONE standard platform chat component (v1, Oct 28, 2026).
   Every chat surface on every project loads this file and tb-chat.js.
   Surfaces differ ONLY through the config object (persona, skin tokens,
   feature toggles); the DOM, furniture, and behavior are this file's.
   Skin tokens (set from config.skin, defaults = the dress below):
     --tbc-head-bg, --tbc-head-fg, --tbc-accent, --tbc-accent-fg,
     --tbc-panel-bg, --tbc-bubble-team, --tbc-bubble-you,
     --tbc-bubble-you-fg, --tbc-radius, --tbc-font

   Oct 28, 2026 (Trevor's ruling, ~3:50 PM PT): the Dr. Scott (OCPA)
   demo chat is the visual standard for the primary chat. The default
   dress below is that chat's furniture, measured from the live demo
   file (ocpa-site, coastal theme): the dark green gradient header
   with its circular translucent buttons, the cream panel, white
   rounded bubbles carrying the speaker's face and name inside, teal
   user bubbles, small timestamps, and the composer row (+ button,
   pill input on cream, mic, circular teal send) with the small
   disclaimer line under it. Two exceptions Trevor named the same
   hour: (1) NO thick default scrollbar — the message list and the
   input carry a thin, subtle, themed scrollbar only; (2) the input
   auto-expands as the visitor types (tb-chat.js autogrow, capped
   at 120px, then the input scrolls internally on its thin bar).
   Oct 29, 2026 (Trevor's theme-scope ruling, ~6:07-6:16 PM PT):
   the dress below is SUPERSEDED in two respects. (1) The header
   background is no longer the OCPA coastal gradient: every site's
   chat header is defined by THEME MANAGEMENT for that site (the
   page's --green / --green-dark, resolved personal -> workspace
   -> platform by site.js + site.css), never copied from another
   site's theme. (2) The panel and message-area background is
   WHITE on every chatbot, consistently; team messages read as
   distinct light gray callout boxes (hairline border, tail
   corners) on that white, visitor messages pale teal with the
   matching tail corner. The Dr. Scott demo keeps its own inline
   dress and is untouched by this change.
   Oct 28, 2026, later (Trevor's bubble ruling, 4:21 PM PT): the
   bubbles and the composer are remodeled on the OCPA practice's
   EXISTING live chat window (Emily, powered by DearDoc), which
   Trevor judged much cleaner: team bubbles are flat light gray
   with NO in-bubble furniture (no face, no name, no ASSISTANT
   pill); the speaker's name and a relative time sit in one small
   gray line UNDER the bubble ("Sprout - 38 minutes ago"); visitor
   bubbles are pale teal-gray; and the plus and mic move INSIDE
   the input pill, Muse app style. The header above is unchanged.
   Geometry: desktop = right-docked panel, 392px wide, tall
   (min(780px, viewport - 44px) at >=861px, else min(600px,
   viewport - 44px)); phones = inset panel with margins, never
   wider than the viewport (no horizontal scroll).
   ========================================================================== */

.tbc-root {
  --tbc-head-bg: linear-gradient(140deg,
    var(--green, var(--mv-accent, #2E7D32)),
    var(--green-dark, #256629));
  --tbc-head-fg: #FFFFFF;
  --tbc-accent: var(--green, var(--mv-accent, #2E7D32));
  /* (v1.10.37) the deep accent DERIVES from the theme accent
     the mount already receives. The old default chain fell
     back to a hard-coded green on every site whose
     skin did not pin a deep shade, so the Read receipt read
     green even on gold and azure sites. A skin may still pin
     its own deep shade (skin accentDeep wins, being inline). */
  --tbc-accent-deep: color-mix(in srgb,
    var(--tbc-accent) 76%, #141414);
  --tbc-accent-fg: #FFFFFF;
  --tbc-panel-bg: #FFFFFF;
  --tbc-body-bg: #FFFFFF;
  /* (Nov 5, 2026, branding inheritance) the soft surface DERIVES
     from the mount accent, never a fixed platform tint: every
     workspace's hover/tray surfaces carry its own brand wash. */
  --tbc-chip: color-mix(in srgb, var(--tbc-accent) 10%, var(--tbc-panel-bg));
  --tbc-bubble-team: #F1F1EF;
  --tbc-bubble-you: color-mix(in srgb, var(--tbc-accent) 16%, #FFFFFF);
  --tbc-bubble-you-fg: #1E2C34;
  --tbc-ink: var(--ink, var(--mv-ink, #2D3748));
  --tbc-ink-soft: var(--muted, var(--mv-muted, #5A6B5E));
  --tbc-line: #E2E6E0;
  --tbc-avatar-brand: var(--green,
    var(--mv-accent, var(--tbc-accent)));
  --tbc-avatar-bg: color-mix(in srgb,
    var(--tbc-avatar-brand) 24%, var(--tbc-panel-bg));
  --tbc-radius: 22px;
  --tbc-bubble-radius: 18px;
  --tbc-font: inherit;
  font-family: var(--tbc-font);
  color: var(--tbc-ink);
}

/* ---------- launcher (the Marina pill) ----------
   Oct 28, 2026, Trevor's ruling: the Dr. Scott demo's closed
   chat presentation is the standard launcher on every site
   "for now" — a white pill anchored lower right: circular
   avatar disc at the left, a two-line text block (persona
   name, then the surface's status line in muted smaller
   text), a small green presence dot at the right edge, a
   soft deep shadow. Persona, label, and status all come
   from the surface's config; the dress and geometry are
   this file's, so every mount inherits them. */
.tbc-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 260;
  display: flex; align-items: center; gap: 11px;
  background: var(--tbc-panel-bg); color: var(--tbc-ink);
  border: 1px solid var(--tbc-line); border-radius: 999px;
  padding: 8px 18px 8px 8px;
  box-shadow: 0 18px 40px rgba(10, 25, 22, .28);
  cursor: pointer; font: inherit; text-align: left;
  transition: transform .2s ease, box-shadow .2s ease;
}
.tbc-launcher:hover { transform: translateY(-3px); box-shadow: 0 24px 48px rgba(10, 25, 22, .32); }
.tbc-launcher:active { transform: translateY(1px); }
.tbc-launcher:focus-visible { outline: 3px solid var(--tbc-accent); outline-offset: 2px; }
.tbc-launcher .tbc-launcher-face {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  flex: 0 0 auto; border: 2px solid var(--tbc-accent); background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.tbc-launcher .tbc-launcher-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tbc-launcher .tbc-launcher-face.tbc-avatar-generic { background: var(--tbc-avatar-bg); }
.tbc-launcher .tbc-launcher-init { font-weight: 700; font-size: 18px; line-height: 1; color: var(--tbc-accent); }
.tbc-launcher .tbc-launcher-txt { text-align: left; line-height: 1.2; }
.tbc-launcher .tbc-launcher-name { font-weight: 600; font-size: .92rem; display: block; color: var(--tbc-ink); }
.tbc-launcher .tbc-launcher-sub { font-size: .74rem; color: var(--tbc-ink-soft); display: block; }
.tbc-launcher .tbc-launcher-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--tbc-accent);
  flex: 0 0 auto; display: none;
}
/* The presence dot rides when the surface claims presence
   (launcher.presence in config, default on: the shipped
   surfaces' status lines are presence claims). An unread
   reply forces the dot with a soft ring, so the unread
   signal the adapters drive (tbc-has-unread) still reads
   at a glance even on a surface that claims no presence. */
.tbc-launcher.tbc-presence .tbc-launcher-dot { display: block; }
.tbc-launcher.tbc-has-unread .tbc-launcher-dot { display: block; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tbc-accent) 25%, transparent); }

/* Companion mode (v1.10.9, Oct 28, 2026): while a mount is
   guiding the visitor through a page or a form, the folded
   chat carries the persona's current guidance in a bubble
   above the pill, Emily dress, tail down at the pill, one
   tap from the full panel. Config-gated (cfg.companion) and
   driven by handle.setCompanion; mounts without the config
   never render it. */
.tbc-companion {
  position: fixed; right: 22px; bottom: 96px; z-index: 260;
  max-width: min(318px, calc(100vw - 44px));
  background: #F2F2F1; color: var(--tbc-ink);
  border-radius: 16px; padding: 12px 15px; cursor: pointer;
  box-shadow: 0 14px 34px rgba(10, 25, 22, .25);
  font: inherit; text-align: left;
}
.tbc-companion[hidden] { display: none; }
.tbc-companion p {
  margin: 0; font-size: .9rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 4;
  -webkit-box-orient: vertical; overflow: hidden;
}
.tbc-companion::after {
  content: ""; position: absolute; right: 38px; bottom: -7px;
  width: 15px; height: 15px; background: #F2F2F1;
  transform: rotate(45deg); border-radius: 0 0 3px 0;
  box-shadow: 4px 4px 8px rgba(10, 25, 22, .08);
}

/* Session state (v1.3, Oct 28, 2026): while a session is in
   progress the presence dot pulsates (a soft breathing ring on
   the mic pulse's rhythm). The badge rides the pill's
   top-right edge, seated on the edge itself so the pill's
   size and layout never move, and it is an unseen counter
   only: it appears solely while reply turns are waiting
   unseen (counted in turns, not bubbles), so when it shows
   it always wears the standout dress, the presence green
   with a ring, the same language as the unread dot above;
   opening the panel hides it entirely. Reduced motion
   stills the dot. */
@keyframes tbc-dotpulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tbc-accent) 45%, transparent); transform: scale(1); }
  50% { box-shadow: 0 0 0 6px transparent; transform: scale(1.15); }
}
.tbc-launcher.tbc-in-session .tbc-launcher-dot { animation: tbc-dotpulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .tbc-launcher.tbc-in-session .tbc-launcher-dot { animation: none; } }
.tbc-launcher .tbc-launcher-badge {
  position: absolute; top: -6px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; box-sizing: border-box;
  background: var(--tbc-accent); color: var(--tbc-accent-fg);
  border: 2px solid #fff;
  font-size: .68rem; font-weight: 700; line-height: 16px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(10, 25, 22, .25);
}
.tbc-launcher .tbc-launcher-badge[hidden] { display: none; }
.tbc-launcher .tbc-launcher-badge.tbc-badge-unseen {
  background: var(--tbc-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tbc-accent) 30%, transparent), 0 4px 10px rgba(10, 25, 22, .25);
}

/* ---------- panel ---------- */
.tbc-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 261;
  width: min(392px, calc(100vw - 28px));
  height: min(600px, calc(100dvh - 44px));
  background: var(--tbc-panel-bg);
  border: 1px solid var(--tbc-line);
  border-radius: var(--tbc-radius);
  box-shadow: 0 30px 70px rgba(10, 25, 22, .35);
  display: flex; flex-direction: column; overflow: hidden;
}
@media (min-width: 861px) {
  .tbc-panel { height: min(780px, calc(100dvh - 44px)); }
}
.tbc-panel[hidden] { display: none; }
.tbc-panel:not([hidden]) { animation: tbc-chat-in .35s cubic-bezier(.22,.8,.28,1); }
@keyframes tbc-chat-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tbc-panel:not([hidden]) { animation: none; } }

/* ---------- header ---------- */
.tbc-head {
  background: var(--tbc-head-bg); color: var(--tbc-head-fg);
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; position: relative; flex: none;
}
.tbc-medallion {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: var(--light-sage, #E8F0E8); display: grid; place-items: center; overflow: hidden;
  border: 2px solid rgba(255,255,255,.65);
}
.tbc-medallion img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tbc-medallion.tbc-avatar-generic { background: var(--tbc-avatar-bg); }
.tbc-medallion .tbc-medinit { font-weight: 800; color: var(--tbc-accent); font-size: 18px; }
.tbc-medallion img[hidden], .tbc-medallion .tbc-medinit[hidden] { display: none; }
.tbc-head-texts { flex: 1; min-width: 0; }
.tbc-head-kicker { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; line-height: 1.25; }
.tbc-head-name {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17.3px; font-weight: 600; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbc-head-status { font-size: 12.5px; opacity: .85; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbc-headbtn {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: rgba(255,255,255,.14); border: none; color: inherit; cursor: pointer;
  display: grid; place-items: center;
  transition: background .18s ease, transform .12s ease;
}
.tbc-headbtn svg { width: 19px; height: 19px; }
.tbc-headbtn:hover { background: rgba(255,255,255,.3); }
.tbc-headbtn:active { background: rgba(255,255,255,.3); transform: scale(.93); }
.tbc-headbtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* header three-dot menu + composer plus menu: ONE shared rule
   set (the standard options container, C-21); the two menus
   differ only in where they anchor, which stays in their own
   one-line rules below and beside the composer */
.tbc-menu, .tbc-plusmenu {
  position: absolute;
  background: var(--tbc-panel-bg); color: var(--tbc-ink); border: 1px solid var(--tbc-line);
  border-radius: 16px; box-shadow: 0 22px 50px rgba(10,25,22,.30);
  padding: 6px; width: min(272px, calc(100vw - 56px));
}
.tbc-menu { top: calc(100% - 6px); right: 14px; z-index: 5; }
.tbc-menu[hidden], .tbc-plusmenu[hidden] { display: none; }
.tbc-menu button, .tbc-plusmenu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  font: inherit; font-size: 14.8px; font-weight: 600; padding: 10px 12px; border-radius: 11px; cursor: pointer;
}
/* the display:block above defeats the hidden attribute's UA
   style; without this guard a hidden item (Admin Features)
   renders for every visitor (PP-25) */
.tbc-menu button[hidden], .tbc-plusmenu button[hidden] { display: none; }
.tbc-menu button:hover, .tbc-plusmenu button:hover { background: var(--tbc-chip); }
.tbc-menu button:active, .tbc-plusmenu button:active { background: var(--tbc-line); }
.tbc-menu button:focus-visible, .tbc-plusmenu button:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: -2px; }
.tbc-menu .tbc-menuhint, .tbc-plusmenu .tbc-menuhint { display: block; font-size: 11.8px; font-weight: 400; color: var(--tbc-ink-soft); margin-top: 2px; line-height: 1.45; }
/* the menus' own close × (v1.7, Trevor's every-box-close rule):
   top-right inside the card, a 36px hit area, closes the menu
   and nothing else; the first row keeps clear of it */
.tbc-menu .tbc-menux, .tbc-plusmenu .tbc-menux {
  position: absolute; top: 4px; right: 4px; width: 36px; height: 36px;
  padding: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 17px; font-weight: 400; line-height: 1;
  text-align: center; color: var(--tbc-ink);
}
.tbc-menu > button:first-of-type, .tbc-plusmenu > button:first-of-type { padding-right: 46px; }

/* ---------- body ---------- */
.tbc-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--tbc-body-bg); }
.tbc-notice {
  flex: none; font-size: 13px; padding: 8px 16px; color: var(--tbc-ink-soft);
  background: #FFF8E6; border-bottom: 1px solid var(--tbc-line);
}
.tbc-notice[hidden] { display: none; }
.tbc-about { flex: none; font-size: 12.5px; color: var(--tbc-ink-soft); padding: 6px 16px 4px; background: var(--tbc-body-bg); }
.tbc-about summary { cursor: pointer; padding: 4px 0 1px; }
.tbc-about p { margin: 1px 0 8px; line-height: 1.45; }
.tbc-about summary:hover { color: var(--tbc-ink); }
.tbc-card { flex: none; margin: 10px 12px 0; background: var(--tbc-panel-bg); border: 1px solid var(--tbc-line); border-radius: 16px; padding: 14px; }
.tbc-card[hidden] { display: none; }
.tbc-card h4 { margin: 0 0 6px; font-size: 15px; }
.tbc-card p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.45; }
.tbc-card .tbc-card-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tbc-card input[type="text"], .tbc-card input[type="email"] {
  flex: 1; min-width: 130px; font: inherit; font-size: 14.5px;
  border: 1.5px solid var(--tbc-line); border-radius: 10px; padding: 9px 11px;
}
.tbc-card input:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: 0; }
.tbc-btn {
  font: inherit; font-size: 14px; font-weight: 600; border-radius: 999px;
  padding: 9px 14px; border: 1.5px solid var(--tbc-accent); cursor: pointer;
  background: var(--tbc-accent); color: var(--tbc-accent-fg);
}
.tbc-btn:hover { background: var(--tbc-accent-deep); border-color: var(--tbc-accent-deep); }
.tbc-btn:active { transform: scale(.97); }
.tbc-btn:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: 2px; }
.tbc-btn.tbc-btn-quiet { background: transparent; color: var(--tbc-accent); }
.tbc-btn.tbc-btn-quiet:hover { background: var(--tbc-accent); color: var(--tbc-accent-fg); }
.tbc-card .tbc-card-err { color: #B3261E; font-size: 13px; margin: 6px 0 0; }

/* ---------- messages ---------- */
.tbc-msgs {
  flex: 1; overflow-y: auto; padding: 18px 16px 8px; min-height: 0; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--tbc-accent) 35%, transparent) transparent;
}
.tbc-msgs::-webkit-scrollbar { width: 6px; }
.tbc-msgs::-webkit-scrollbar-track { background: transparent; }
.tbc-msgs::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--tbc-accent) 28%, transparent); border-radius: 999px; }
.tbc-msgs::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--tbc-accent) 45%, transparent); }
.tbc-group { margin: 0 0 10px; max-width: 86%; position: relative; }
.tbc-group-you { margin-left: auto; }
/* Emily model (Oct 28, 2026): bubbles carry NO furniture - no face,
   no name, no ASSISTANT pill inside. The speaker's name and a
   relative time ride in one small muted line UNDER the team bubble
   (.tbc-meta: "Sprout - 38 minutes ago"); visitor groups carry no
   line at all, exactly like the reference window. */
.tbc-row { display: flex; }
.tbc-row-you { justify-content: flex-end; }
.tbc-bubble {
  max-width: 100%; padding: 11px 15px; margin: 0 0 3px;
  border-radius: var(--tbc-bubble-radius); font-size: 13.2px; line-height: 1.5;
  overflow-wrap: anywhere; position: relative;
  animation: tbc-msg-in .3s cubic-bezier(.22,.8,.28,1);
}
@keyframes tbc-msg-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tbc-bubble { animation: none; } }
.tbc-bubble p { margin: 0 0 6px; }
.tbc-bubble p:last-child { margin-bottom: 0; }
.tbc-bubble ul { margin: 2px 0 6px; padding-left: 18px; }
.tbc-group-team .tbc-bubble {
  background: var(--tbc-bubble-team); color: #1E2C34;
  border: 1px solid #E1E1DD; border-bottom-left-radius: 4px;
}
.tbc-group-you .tbc-bubble { background: var(--tbc-bubble-you); color: var(--tbc-bubble-you-fg); border-bottom-right-radius: 4px; }
.tbc-meta { font-size: 11.5px; color: var(--tbc-ink-soft); margin: 3px 2px 0; line-height: 1.25; }
/* the read receipt under the visitor's own newest group
   (v1.6.1): the .tbc-meta dress, right-aligned to the bubble */
.tbc-read { font-size: 11.5px; color: var(--tbc-ink-soft); margin: 3px 2px 0; line-height: 1.25; text-align: right; }
.tbc-read.tbc-read-on { font-weight: 700; color: var(--tbc-accent-deep); }
.tbc-attach-img { max-width: 32%; max-height: 190px; border-radius: 10px; display: block; margin-top: 4px; cursor: zoom-in; }
.tbc-attach-chip {
  display: inline-block; margin-top: 4px; padding: 6px 10px; border-radius: 8px;
  background: var(--tbc-body-bg); color: inherit; font-size: 13px;
}
.tbc-statusline {
  text-align: center; font-size: 12.5px; color: var(--tbc-ink-soft);
  margin: 8px auto; max-width: 88%; line-height: 1.4;
}
.tbc-stepsbtn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--tbc-accent); border: 1.5px solid var(--tbc-accent);
  border-radius: 999px; padding: 5px 12px; margin: 2px 0 0 2px;
}
.tbc-stepsbtn:hover { background: var(--tbc-accent); color: var(--tbc-accent-fg); }
.tbc-stepsbtn:active { transform: scale(.96); }
.tbc-stepsbtn:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: 2px; }

/* a quoted reply's quoted words, riding above the reply's own
   bubbles (v1.1): the quoted author, then the quoted text, muted */
.tbc-quote {
  display: block; max-width: 100%; margin: 0 0 4px; padding: 7px 11px;
  background: var(--tbc-chip); border: none;
  border-left: 3px solid var(--tbc-accent); border-radius: 10px;
  font-size: 13px; line-height: 1.4;
}
.tbc-group-you .tbc-quote { margin-left: auto; }
.tbc-quote-author { display: block; font-weight: 700; font-size: 12px; color: var(--tbc-ink-soft); margin-bottom: 1px; }
.tbc-quote-text { display: block; color: var(--tbc-ink-soft); overflow-wrap: anywhere; }

/* typing dots: opacity pulse only, no bouncing; reduced motion disables */
.tbc-typing { display: inline-flex; gap: 5px; padding: 13px 16px; }
.tbc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #75808A; opacity: .35; animation: tbc-pulse 1.2s infinite; }
.tbc-typing span:nth-child(2) { animation-delay: .15s; }
.tbc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes tbc-pulse { 0%, 60%, 100% { opacity: .25; } 30% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .tbc-typing span { animation: none; opacity: .6; } }
.tbc-group.tbc-fade { animation: tbc-dissolve .5s ease both; }
.tbc-group.tbc-fade .tbc-bubble { animation: none; }
@keyframes tbc-dissolve { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tbc-group.tbc-fade { animation: none; } }
.tbc-tdots i { font-style: normal; animation: tbc-pulse 1.2s infinite; }
.tbc-tdots i:nth-child(2) { animation-delay: .15s; }
.tbc-tdots i:nth-child(3) { animation-delay: .3s; }
.tbc-foot { flex: 0 0 auto; text-align: center; font-size: 11px; color: #8A938E; padding: 2px 12px 8px; }
.tbc-foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.tbc-foot a:hover { color: var(--tbc-accent-deep); }
.tbc-foot a:focus-visible { outline: 2px solid var(--tbc-accent-deep); outline-offset: 2px; }

/* ---------- chips ---------- */
.tbc-chips { flex: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 6px 16px 4px; }
.tbc-chips[hidden] { display: none; }
.tbc-chip {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  /* (Nov 5, 2026, contrast intelligence) chips read in the DEEP
     derivation of the brand accent — a light accent (a brand
     yellow) stays the palette's, the chip text/outline take the
     contrast-checked deep shade of the same family. */
  color: var(--tbc-accent-deep); background: var(--tbc-body-bg); border: 1.5px solid var(--tbc-accent-deep);
  border-radius: 999px; padding: 6px 12px; line-height: 1.25;
  transition: background .18s ease, color .18s ease, transform .12s ease;
}
.tbc-chip:hover { background: var(--tbc-accent-deep); color: var(--tbc-accent-fg); }
.tbc-chip:active { transform: scale(.96); }
.tbc-chip:focus-visible { outline: 2px solid var(--tbc-accent-deep); outline-offset: 2px; }

/* ---------- composer ---------- */
.tbc-composer { flex: none; position: relative; background: var(--tbc-panel-bg); border-top: 1px solid var(--tbc-line); padding: 12px 14px 10px; }
.tbc-quotechip { font-size: 12.5px; background: var(--tbc-chip); border-left: 3px solid var(--tbc-accent); border-radius: 10px; padding: 8px 11px; margin-bottom: 8px; }
.tbc-quotechip[hidden] { display: none; }
.tbc-quotechip-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--tbc-ink-soft); }
.tbc-quotechip-x { background: none; border: none; font-size: 16px; cursor: pointer; color: inherit; padding: 0 2px; }
.tbc-quotechip-x:hover { color: var(--tbc-ink); }
.tbc-quotechip-text { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbc-tray { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tbc-tray[hidden] { display: none; }
.tbc-traychip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: var(--tbc-chip); border: 1px solid var(--tbc-line); border-radius: 999px; padding: 4px 6px 4px 10px; }
.tbc-traychip button { background: none; border: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 2px; color: var(--tbc-ink-soft); }
.tbc-traychip button:hover { color: #B3261E; }
.tbc-composer-row { display: flex; align-items: flex-end; gap: 7px; position: relative; }
/* the plus button's option list (the agreed standard list, from the
   master composer every chat shares: Attach a photo or file with
   its hint, and the Sound toggle — restored Oct 28, 2026 under the
   OCPA dress; the plus never goes straight to the file picker and
   is never inert). Its dress is the shared menu rule set above;
   only the anchor is its own. */
.tbc-plusmenu { left: 0; bottom: calc(100% + 6px); z-index: 6; }
.tbc-iconbtn {
  width: 42px; height: 42px; border-radius: 50%; flex: none; cursor: pointer;
  display: grid; place-items: center; background: none; border: none; color: var(--tbc-accent);
  transition: background .18s ease, transform .12s ease;
}
.tbc-iconbtn svg { width: 21px; height: 21px; }
.tbc-iconbtn:hover { background: var(--tbc-chip); }
.tbc-iconbtn:active { transform: scale(.93); }
.tbc-iconbtn:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: 2px; }
.tbc-iconbtn[disabled] { opacity: .4; cursor: default; }
.tbc-iconbtn.tbc-recording { background: #FDECEA; color: #B3261E; animation: tbc-micpulse 1.6s ease-in-out infinite; }
/* mic mode (Oct 28, 2026, Trevor's mic batch): while dictation is
   live the mic button stays red and PULSATES (a breathing red ring).
   Voice mode final shape (v1.10.3): the dictated text lands in
   the input where the visitor watches it arrive, and for the
   whole of the mode the composer carries .tbc-voicemode and the
   input shows the locked cursor, because the field is read-only
   until the mode ends. v1.10.8: the pill's recording tint is
   gone; the mode's visible life is the transparent bars overlay
   over the text, with its countdown (see .tbc-waveover below). */
@keyframes tbc-micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(179, 38, 30, .45); transform: scale(1); }
  50% { box-shadow: 0 0 0 9px rgba(179, 38, 30, 0); transform: scale(1.07); }
}
@media (prefers-reduced-motion: reduce) { .tbc-iconbtn.tbc-recording { animation: none; } }
/* voice wave overlay (v1.10.8): no tint on the pill any more.
   While the mode is live a transparent row of small bars rides
   over the dictated text inside the field (drawn on the canvas
   from the voice's real frequencies, or from recognition
   activity where the browser holds no stream), with a quiet
   countdown at the field's left edge running down the
   workspace's dictation cap; under 0:15 it turns the platform
   burgundy. The overlay never takes pointer events, and the
   text stays readable through it. */
.tbc-waveover {
  position: absolute; z-index: 3; display: flex; align-items: center;
  gap: 7px; padding: 0 2px; pointer-events: none;
}
.tbc-waveover[hidden] { display: none; }
.tbc-wavetime {
  flex: none; font-size: 11.5px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--tbc-ink-soft);
  background: rgba(127, 140, 135, .16); border-radius: 999px;
  padding: 3px 6px;
}
.tbc-wavetime.tbc-warn { color: #800020; }
.tbc-wavecv { flex: 1; min-width: 0; height: 100%; display: block; }
.tbc-composer.tbc-voicemode .tbc-input { cursor: not-allowed; color: transparent; caret-color: transparent; }
/* dictation: no placeholder behind the bars, ever
   (Trevor, Oct 29, 2026; the JS also clears the
   attribute, this covers every mount and race) */
.tbc-composer.tbc-voicemode .tbc-input::placeholder { color: transparent; opacity: 0; }
/* dictation balloon (v1.10.16; dress corrected v1.10.22): while
   mic mode is live the live transcript fills a callout above
   the composer instead of sitting in the field under the bars.
   The balloon is one of the thread's own messages: the team
   bubble's solid ground, border and radius, its tail pointing
   down at the mic inside the pill. Words still being heard
   ride in a lighter interim span and turn solid as they are
   confirmed. The balloon grows to about four lines, then
   scrolls inside itself with the scrollbar never rendered:
   no scroll box, ever. On every stop the text settles into
   the field and the balloon dissolves; reduced motion gets
   no animation, it simply appears and disappears. */
.tbc-balloon {
  /* floats above the composer (Trevor, Oct 29, 2026: in-flow was
     not the settled picture; the callout overlays the foot of the
     message area, tail down at the mic) */
  position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px);
  z-index: 8; margin: 0; padding: 11px 15px;
  border: 1px solid #E1E1DD; border-radius: var(--tbc-bubble-radius);
  background: var(--tbc-bubble-team);
  box-shadow: 0 14px 34px rgba(10, 25, 22, .24);
  color: #1E2C34; font-size: 15px; line-height: 1.5;
  min-height: 22px; max-height: 96px; overflow-y: auto;
  overflow-wrap: anywhere; scrollbar-width: none;
  animation: tbc-balloon-in .18s ease-out;
}
.tbc-balloon::-webkit-scrollbar { display: none; }
.tbc-balloon[hidden] { display: none; }
.tbc-balloon::after {
  content: ""; position: absolute; right: 64px; bottom: -6px;
  width: 11px; height: 11px; transform: rotate(45deg);
  background: var(--tbc-bubble-team);
  border-right: 1px solid #E1E1DD;
  border-bottom: 1px solid #E1E1DD;
}
.tbc-balloon-interim { opacity: .48; }
@keyframes tbc-balloon-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .tbc-balloon { animation: none; } }
/* the input pill (Oct 28, 2026, composer remodel): the plus and the
   mic live INSIDE the pill, Muse app style - plus at the left,
   mic at the right, the textarea bare between them. The pill
   carries the border, the ground, and the focus ring the input
   itself used to carry; the in-pill buttons shrink to 34px and
   stay bottom-anchored as the textarea auto-expands; the mic's
   recording pulse is untouched. */
.tbc-inputpill {
  flex: 1; min-width: 0; display: flex; align-items: flex-end;
  position: relative;
  border: 1.5px solid color-mix(in srgb, var(--tbc-accent) 55%, var(--tbc-line)); border-radius: 24px;
  background: var(--tbc-body-bg);
}
.tbc-inputpill:focus-within { border-color: var(--tbc-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tbc-accent) 25%, transparent); }
.tbc-inputpill:has(.tbc-input[disabled]) { background: var(--tbc-chip); }
.tbc-inputpill .tbc-iconbtn { width: 34px; height: 34px; margin-bottom: 6px; }
.tbc-inputpill .tbc-iconbtn:first-child { margin-left: 5px; }
.tbc-inputpill .tbc-iconbtn:last-child { margin-right: 5px; }
.tbc-inputpill .tbc-iconbtn svg { width: 20px; height: 20px; }
.tbc-input {
  flex: 1; font: inherit; font-size: 16px; line-height: 1.4; resize: none;
  border: none; border-radius: 0; padding: 11px 8px;
  max-height: 80dvh; min-height: 46px; min-width: 0; overflow-y: auto;
  background: transparent; color: var(--tbc-ink);
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--tbc-accent) 35%, transparent) transparent;
}
.tbc-input::-webkit-scrollbar { width: 4px; }
.tbc-input::-webkit-scrollbar-track { background: transparent; }
.tbc-input::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--tbc-accent) 28%, transparent); border-radius: 999px; }
.tbc-input:focus { outline: none; }
/* (v1.10.33) PIN step: the component displays X characters
   only (the real PIN never reaches the field's value as
   readable text); the wide tracking makes the mask read
   as a mask at a glance, in every browser. */
.tbc-input.tbc-pin-mask { letter-spacing: 3px; font-weight: 600; }
.tbc-send {
  width: 46px; height: 46px; border-radius: 50%; flex: none; cursor: pointer;
  font-size: .98rem;
  display: grid; place-items: center; border: none;
  background: var(--tbc-accent-deep); color: var(--tbc-accent-fg);
  transition: background .2s ease, transform .15s ease;
}
.tbc-send svg { width: 20px; height: 20px; }
.tbc-send:hover { background: color-mix(in srgb, var(--tbc-accent-deep) 82%, #000000); transform: translateY(-1px); }
.tbc-send:active { transform: scale(.94); }
.tbc-send:focus-visible { outline: 2px solid var(--tbc-accent-deep); outline-offset: 2px; }
.tbc-send[disabled] { opacity: .4; cursor: default; }
.tbc-smallprint { font-size: 11px; color: var(--tbc-ink-soft); text-align: center; margin: 8px 4px 0; line-height: 1.35; }
.tbc-endedbar { flex: none; padding: 12px 14px; font-size: 14px; text-align: center; background: var(--tbc-panel-bg); border-top: 1px solid var(--tbc-line); }
.tbc-endedbar[hidden] { display: none; }
.tbc-endedbar button { background: none; border: none; color: var(--tbc-accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.tbc-endedbar button:hover { text-decoration: underline; }

/* admin recognition posture (config.admin): the panel reads as the
   admin line; geometry and furniture do not change */
.tbc-root.tbc-admin-on .tbc-head { box-shadow: inset 0 -3px 0 rgba(255,255,255,.55); }

@media (max-width: 560px) {
  .tbc-panel { right: 12px; left: 12px; bottom: 12px; width: auto; height: min(640px, calc(100dvh - 84px)); }
  .tbc-launcher { right: 12px; bottom: 12px; padding: 8px; }
  .tbc-launcher .tbc-launcher-txt { display: none; }
}

/* ---------- v1.4 extensions (Oct 28, 2026) ----------
   New rules only; nothing above this block changed. The
   multi-action row, contact link row, settled line, and
   in-body link dress serve the multi-action card and link
   rendering extensions; the mode banner and mode bar render
   only for a host that opts into modes, so no shipped
   surface ever sees them. Buttons reuse .tbc-stepsbtn, so
   hover, pressed, and focus-visible states come with it. */
.tbc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0 2px; }
.tbc-actions .tbc-actionbtn { margin: 0; }
a.tbc-linkbtn { text-decoration: none; display: inline-block; }
.tbc-action-primary { background: var(--tbc-accent); color: var(--tbc-accent-fg); }
.tbc-action-primary:hover { background: var(--tbc-accent-deep); color: var(--tbc-accent-fg); }
.tbc-stepsbtn[disabled] { opacity: .45; cursor: default; }
.tbc-stepsbtn[disabled]:hover { background: #fff; color: var(--tbc-accent); }
.tbc-action-primary[disabled]:hover { background: var(--tbc-accent); color: var(--tbc-accent-fg); }
.tbc-actions-done { font-size: 12.5px; font-weight: 600; color: var(--tbc-ink-soft); margin: 4px 0 0 2px; }
.tbc-bubble a.tbc-inline-link { color: var(--tbc-accent); text-decoration: underline; }
.tbc-bubble a.tbc-inline-link:hover { color: var(--tbc-accent-deep); }
.tbc-bubble a.tbc-inline-link:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: 1px; }
.tbc-modebanner {
  flex: none; font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  padding: 7px 16px; color: var(--tbc-accent-deep);
  background: var(--tbc-chip); border-bottom: 1px solid var(--tbc-line);
}
.tbc-modebanner[hidden] { display: none; }
.tbc-modebar {
  display: flex; gap: 6px; margin-bottom: 10px;
  background: var(--tbc-body-bg); border: 1.5px solid var(--tbc-line);
  border-radius: 999px; padding: 4px;
}
.tbc-modebar[hidden] { display: none; }
.tbc-modebtn {
  flex: 1; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--tbc-ink-soft); border: none;
  border-radius: 999px; padding: 7px 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .18s ease, color .18s ease, transform .12s ease;
}
.tbc-modebtn:hover { background: var(--tbc-chip); color: var(--tbc-ink); }
.tbc-modebtn:active { transform: scale(.97); }
.tbc-modebtn:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: 1px; }
.tbc-modebtn.tbc-modebtn-on { background: var(--tbc-accent); color: var(--tbc-accent-fg); }
.tbc-modebtn.tbc-modebtn-on:hover { background: var(--tbc-accent-deep); color: var(--tbc-accent-fg); }
.tbc-modeflag { width: 7px; height: 7px; border-radius: 50%; background: var(--tbc-accent); flex: none; }
.tbc-modeflag[hidden] { display: none; }

/* Chat navigation (v1.9): the highlight pulse a destination
   wears for a moment after the chat brings a visitor to it.
   Host-agnostic on purpose: any element on the page may be a
   destination, so the rule lives here, skin-neutral. */
.tbc-nav-pulse{animation:tbcNavPulse 1.9s ease-out 1}
@keyframes tbcNavPulse{0%{box-shadow:inset 0 0 0 3px transparent}16%{box-shadow:inset 0 0 0 3px color-mix(in srgb, var(--tbc-accent) 50%, transparent)}100%{box-shadow:inset 0 0 0 3px transparent}}
@media (prefers-reduced-motion: reduce){.tbc-nav-pulse{animation:none}}

/* ---------- admin presence pill + expiry warning (Oct 28, 2026) ----------
   While admin mode holds, the page itself carries the sign-in:
   a burgundy pill, fixed bottom-left (the launcher owns
   bottom-right), gently pulsating, naming the scope and the
   live duration in admin mode. In the idle warning window the
   pill's time flips to the remaining countdown and the pulse
   quickens; the same countdown shows in the panel's warning
   bar. At expiry both disappear with admin mode. */
.tbc-adminpill {
  position: fixed; left: 22px; bottom: 22px; z-index: 260;
  display: flex; align-items: stretch; overflow: hidden;
  background: #800020; color: #fff;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  font: inherit; font-size: .85rem; font-weight: 600; line-height: 1.2;
  box-shadow: 0 14px 34px rgba(128, 0, 32, .35);
  animation: tbc-adminpulse 1.6s ease-in-out infinite;
}
.tbc-adminpill[hidden] { display: none; }
.tbc-adminpill-warn { animation-duration: .85s; }
.tbc-adminpill-main {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; min-width: 0;
  background: none; border: 0; color: inherit; font: inherit;
  padding: 9px 10px 9px 12px; cursor: pointer; text-align: left;
}
.tbc-adminpill-main:hover { filter: brightness(1.15); }
.tbc-adminpill-main:active { transform: scale(.97); }
.tbc-adminpill-end {
  display: flex; align-items: center; justify-content: center;
  flex: none; min-width: 52px; min-height: 36px;
  background: rgba(0, 0, 0, .22); border: 0;
  border-left: 1px solid rgba(255, 255, 255, .35);
  color: #fff; font: inherit; font-weight: 700;
  padding: 0 13px; cursor: pointer;
}
.tbc-adminpill-end:hover { background: rgba(0, 0, 0, .38); }
.tbc-adminpill-end:active { transform: scale(.96); }
.tbc-adminpill-main:focus-visible,
.tbc-adminpill-end:focus-visible {
  outline: 2px solid #fff; outline-offset: -2px;
}
.tbc-adminpill-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; flex: none;
}
.tbc-adminpill-time {
  font-variant-numeric: tabular-nums; opacity: .92;
}
@keyframes tbc-adminpulse {
  0% { box-shadow: 0 14px 34px rgba(128, 0, 32, .35), 0 0 0 0 rgba(128, 0, 32, .45); }
  70% { box-shadow: 0 14px 34px rgba(128, 0, 32, .35), 0 0 0 9px rgba(128, 0, 32, 0); }
  100% { box-shadow: 0 14px 34px rgba(128, 0, 32, .35), 0 0 0 0 rgba(128, 0, 32, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .tbc-adminpill { animation: none; }
}
@media (max-width: 560px) {
  .tbc-adminpill { left: 12px; bottom: 12px; }
}
/* Admin end-session confirmation (Oct 28, 2026): a small
   house card anchored above the pill, a centered sheet on
   narrow screens. Ending admin mode is never one tap:
   the popup confirms first, and Cancel or an outside tap
   dismisses it with nothing changed. */
.tbc-adminendpop {
  position: fixed; left: 22px; bottom: 78px; z-index: 280;
  width: min(324px, calc(100vw - 24px));
  background: var(--tbc-panel-bg); color: var(--tbc-ink);
  border: 1px solid var(--tbc-line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(10, 25, 22, .30);
  padding: 16px 16px 14px; font: inherit;
}
.tbc-adminendpop[hidden] { display: none; }
.tbc-adminendpop-title {
  margin: 0 0 6px; font-size: 1rem; font-weight: 700;
}
.tbc-adminendpop-body {
  margin: 0; font-size: .88rem; line-height: 1.45; opacity: .85;
}
.tbc-adminendpop-row {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 14px;
}
.tbc-adminendpop-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 999px; padding: 9px 16px; min-height: 40px;
}
.tbc-adminendpop-cancel {
  background: none; border: 1px solid var(--tbc-line);
  color: inherit;
}
.tbc-adminendpop-cancel:hover { background: rgba(10, 25, 22, .06); }
.tbc-adminendpop-confirm {
  background: #800020; border: 1px solid #800020;
  color: #fff; font-weight: 700;
}
.tbc-adminendpop-confirm:hover { filter: brightness(1.15); }
.tbc-adminendpop-btn:focus-visible {
  outline: 2px solid #800020; outline-offset: 2px;
}
@media (max-width: 560px) {
  .tbc-adminendpop {
    left: 50%; transform: translateX(-50%); bottom: 78px;
  }
}
.tbc-adminwarn {
  background: #800020; color: #fff;
  font-size: .85rem; font-weight: 600; text-align: center;
  padding: 10px 14px;
}
.tbc-adminwarn[hidden] { display: none; }
