/* The ABLE ecosystems design language (able-ecosystems/design), for this
   dashboard: coral and ink on warm paper, Inter and Inter Tight, a light and a
   dark theme. No build step.

   tokens/ is copied verbatim from able-ecosystems/resources/css/tokens. Change
   a token there and copy the file across; never edit it here, or the two
   apps drift apart. Components read semantic tokens only (--surface,
   --content, --line, --action...), never hex values, so [data-theme="dark"]
   (theme.js) reskins everything at once. */
@import url("tokens/colors.css");
@import url("tokens/typography.css");
@import url("tokens/spacing.css");

/* The dashboard's older names, which each page's own <style> still reads.
   A bridge, like the gray/indigo one able-ecosystems kept while it moved:
   new rules use the semantic tokens directly. */
:root {
  --bg: var(--surface-subtle);
  --panel: var(--surface);
  --ink: var(--content);
  --dim: var(--content-subtle);
  --accent-ink: var(--accent-content);
  --bad: var(--danger);
  --good: var(--success);
  --warn-bg: var(--warning-soft);
  --warn-line: var(--warning);
  --mono: var(--font-mono);
}

* { box-sizing: border-box; }

html { background: var(--surface-page); color: var(--content); }
body {
  margin: 0;
  background: var(--surface-page);
  color: var(--content);
  font: var(--weight-regular) var(--text-sm)/var(--leading-normal) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--content-brand); text-underline-offset: 3px; }
a:hover { color: var(--content-brand-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--accent-soft-content); }
[hidden] { display: none !important; }

@keyframes able-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important;
                           transition-duration: 1ms !important; }
}

/* ------------------------------------------------------------------ shell */

body.has-shell { padding-left: var(--sidebar-width); }

.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-width);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.app-sidebar .brand {
  height: var(--topbar-height); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-5);
}
.logo {
  display: inline-flex; align-items: baseline; gap: 0.28em; white-space: nowrap;
  font-family: var(--font-display); font-size: 20px; line-height: 1;
  letter-spacing: var(--tracking-tight); text-decoration: none;
}
.logo .mark { font-weight: var(--weight-black); color: var(--accent-mark); }
.logo .word { font-weight: var(--weight-regular); color: var(--content); }

.app-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0 var(--space-3) var(--space-4);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.nav-section { padding-top: var(--space-5); display: grid; gap: 2px; }
.nav-title {
  margin: 0 0 var(--space-1); padding: 0 var(--space-3);
  font-size: 11px; font-weight: var(--weight-semibold); line-height: 16px;
  letter-spacing: var(--tracking-caps-wide); text-transform: uppercase;
  color: var(--content-subtle);
}
.nav-link {
  position: relative; display: flex; align-items: center;
  min-height: 36px; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm); line-height: 20px; font-weight: var(--weight-medium);
  color: var(--content-muted); text-decoration: none;
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.nav-link:hover { background: var(--surface-subtle); color: var(--content); }
.nav-link[aria-current="page"] { background: var(--surface-muted); color: var(--content); font-weight: var(--weight-semibold); }
.nav-link[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 2px; background: var(--accent-mark);
}

.app-foot { flex-shrink: 0; border-top: 1px solid var(--line); padding: var(--space-3); }
.app-foot .nav-title { padding: 0 var(--space-1); margin-bottom: var(--space-2); }
.theme-switch {
  display: flex; gap: 2px; padding: 2px;
  background: var(--surface-muted); border-radius: var(--radius-lg);
}
.theme-switch button {
  flex: 1; min-height: var(--control-sm); padding: 0 var(--space-2);
  background: transparent; color: var(--content-muted); border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-xs); text-transform: none; letter-spacing: 0;
}
.theme-switch button:hover { background: transparent; color: var(--content); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--content); box-shadow: var(--shadow-xs); }

.icon-button, button.icon-button {
  width: 40px; height: 40px; min-height: 0; padding: 0;
  display: grid; place-items: center;
  background: none; border: 0; color: var(--content-muted); border-radius: var(--radius-md);
}
button.icon-button:hover { background: var(--surface-muted); color: var(--content); }
.icon-button svg { width: 24px; height: 24px; }
button.drawer-close { display: none; margin-right: -8px; }
.drawer-close svg { width: 20px; height: 20px; }
.app-topbar, .app-scrim { display: none; }

@media (max-width: 1023.98px) {
  body.has-shell { padding-left: 0; padding-top: var(--mobilebar-height); }
  .app-topbar {
    display: flex; align-items: center; gap: var(--space-3);
    position: fixed; top: 0; left: 0; right: 0; z-index: 30;
    height: var(--mobilebar-height); padding: 0 var(--space-4);
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .app-topbar .icon-button { margin-left: -8px; }
  .app-sidebar {
    width: min(var(--sidebar-width), 85%);
    transform: translateX(-100%); visibility: hidden;
    transition: transform var(--duration-base) var(--ease-standard), visibility var(--duration-base);
  }
  body.drawer-open .app-sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-xl); }
  body.drawer-open button.drawer-close { display: grid; }
  .app-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim);
               animation: able-fade-in var(--duration-base); }
}

/* ------------------------------------------------------------ page header */

/* The page header band: white, ruled off, its text lined up with <main>. */
header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-6) max(var(--space-8), calc((100% - var(--content-max)) / 2 + var(--space-8)));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: var(--weight-bold);
  font-size: var(--text-2xl); line-height: 30px; letter-spacing: var(--tracking-tight);
  color: var(--content);
}
h1 .dim {
  display: block; margin-top: var(--space-1);
  font-family: var(--font-sans); font-size: var(--text-base); line-height: 24px;
  font-weight: var(--weight-regular); letter-spacing: 0; color: var(--content-muted);
}
.sub { margin: var(--space-2) 0 0; max-width: 80ch; color: var(--content-muted); font-size: var(--text-sm); }
.pad-link { margin-top: var(--space-3); }
.dim { color: var(--content-subtle); font-weight: var(--weight-regular); }
.nowrap { white-space: nowrap; }
.host { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--content-subtle); text-align: right; }

main {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.4fr);
  gap: var(--space-6);
  padding: var(--space-8);
  max-width: var(--content-max);
  margin: 0 auto;
  align-items: start;
}
.wide { grid-column: 1 / -1; }

/* Cards: the platform's bg-surface border-line rounded-lg shadow-card. */
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5) var(--space-6) var(--space-6);
}
h2 {
  margin: 0 0 var(--space-4);
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-family: var(--font-display); font-weight: var(--weight-bold);
  font-size: 17px; line-height: 24px; letter-spacing: var(--tracking-tight);
  color: var(--content);
}
h2 .dim { font-family: var(--font-sans); font-size: 13px; letter-spacing: 0; }
h3 { font-family: var(--font-display); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding: var(--space-4); gap: var(--space-4); }
  header { padding: var(--space-4); flex-direction: column; }
  .host { text-align: left; }
  .panel { padding: var(--space-4); }
}

/* ------------------------------------------------------------------ forms */

form { display: flex; flex-direction: column; gap: var(--space-4); }
label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: var(--weight-semibold); color: var(--content-muted);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
input, select, textarea {
  font: inherit; font-size: var(--text-sm);
  color: var(--content);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
input, select { width: 100%; min-height: var(--control-md); padding: var(--space-2) var(--space-3); }
select { max-width: 100%; }
/* Controls inside a table row are the small size, so a row stays one row. */
td select, td input:not([type="checkbox"]):not([type="radio"]) {
  width: auto; min-height: var(--control-sm); padding: var(--space-1) var(--space-2); font-size: 13px;
}
td button { min-height: var(--control-sm); padding: 0 var(--space-3); }
textarea { padding: var(--space-2) var(--space-3); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; accent-color: var(--action); }
input:focus, select:focus, textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--content);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-subtle); color: var(--content-subtle); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
::placeholder { color: var(--content-subtle); }
small { font-weight: var(--weight-regular); color: var(--content-subtle); font-size: var(--text-xs); }
small.meta:empty { display: none; }
option:disabled { color: var(--content-subtle); }

/* ---------------------------------------------------------------- buttons */

/* Primary: ink, uppercase, tracked, semibold -- the platform's button voice.
   Coral (accent) is kept for the one call to action a screen may have. */
button {
  font: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-md); padding: 0 var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius-lg);
  background: var(--action); color: var(--action-content);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 16px;
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
  white-space: nowrap; cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
button:hover { background: var(--action-hover); }
button:disabled, button:disabled:hover { opacity: 0.4; cursor: not-allowed; background: var(--action); }

/* Secondary: outlined. ghost is the small one at the end of a card title. */
button.quiet, button.ghost, button.secondary {
  background: var(--surface); color: var(--content); border-color: var(--line-strong);
}
button.quiet:hover, button.ghost:hover, button.secondary:hover { background: var(--surface-subtle); border-color: var(--content-muted); }
button.quiet:disabled, button.ghost:disabled { background: var(--surface); }
button.ghost { min-height: var(--control-sm); padding: 0 var(--space-3); margin-left: auto; }
button.small { min-height: var(--control-sm); padding: 0 var(--space-3); }
button.danger, button.quiet.danger { color: var(--danger); }
button.danger:not(.quiet) { background: var(--danger); color: var(--surface); }
button.danger:not(.quiet):hover { background: var(--danger-hover); }
button.accent { background: var(--accent); color: var(--accent-content); }
button.accent:hover { background: var(--accent-hover); }
button.link, button.link:hover {
  min-height: 0; padding: 0; border: 0; background: none;
  color: var(--content-brand); font-size: 13px; font-weight: var(--weight-semibold);
  text-transform: none; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px;
}
button.link:hover { color: var(--content-brand-hover); }
button.link.danger-link, button.link.danger-link:hover { color: var(--danger); }

/* Buttons that are really rows, cards or tabs keep their own voice. */
button.tab, button.chat-row, button.clip {
  text-transform: none; letter-spacing: 0; font-size: var(--text-sm); font-weight: var(--weight-medium);
  line-height: 20px; min-height: 0; justify-content: flex-start; white-space: normal;
}

/* Tabs: WAI-ARIA tabs in the platform's underline style. */
.tabs {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; column-gap: var(--space-6);
  border-bottom: 1px solid var(--line);
}
button.tab, button.tab:hover {
  margin-bottom: -1px; padding: var(--space-3) 2px;
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--content-muted);
}
button.tab:hover { color: var(--content); }
button.tab[aria-selected="true"] { color: var(--content); font-weight: var(--weight-semibold); border-bottom-color: var(--accent-mark); }
.tab .count, .tab .dot {
  margin-left: 6px; padding: 0 6px; border-radius: var(--radius-full);
  background: var(--surface-muted); color: var(--content-muted);
  font-size: 11px; font-weight: var(--weight-semibold); line-height: 18px; font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] .count, .tab[aria-selected="true"] .dot { background: var(--accent-soft); color: var(--accent-soft-content); }
.tab .count:empty, .tab .dot:empty { display: none; }

/* --------------------------------------------------------------- feedback */

.error { color: var(--danger); font-size: 13px; margin: 0; }
.warn {
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  background: var(--warning-soft); color: var(--content);
  border: 1px solid transparent; border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.empty { color: var(--content-subtle); font-size: var(--text-sm); margin: 0; }

/* Status badges: small caps on a soft tint, the colour backed by the word. */
.pill, .tag {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; white-space: nowrap;
  padding: 2px 6px; border-radius: var(--radius-sm);
  font-size: 10px; line-height: 14px; font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
  background: var(--surface-muted); color: var(--content-muted);
}
.tag { margin-left: 6px; background: var(--warning-soft); color: var(--warning); }
/* under way */
.pill.in_progress, .pill.ringing, .pill.active, .pill.replied, .pill.calling, .pill.sending,
.pill.retrying, .pill.stage-onboarding { background: var(--info-soft); color: var(--info); }
/* done */
.pill.completed, .pill.stage-onboarded, .pill.pay-paid { background: var(--success-soft); color: var(--success); }
/* failed */
.pill.failed { background: var(--danger-soft); color: var(--danger); }
/* ended short of an answer, or waiting on a person */
.pill.declined, .pill.stopped, .pill.opted_out, .pill.no_reply, .pill.incomplete, .pill.missed,
.pill.no_answer, .pill.no_answer_twice, .pill.no_consent, .pill.not_ready,
.pill.stage-declined, .pill.stage-no_consent, .pill.status-opted_out, .pill.pay-owed {
  background: var(--warning-soft); color: var(--warning);
}

.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3);
         margin: 0 0 var(--space-4); font-size: 13px; }
.facts dt { color: var(--content-subtle); }
.facts dd { margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); }

/* ----------------------------------------------------------------- tables */

/* The platform's data table: a caps head on surface-subtle, hairline rows. */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th, th { background: var(--surface-subtle); }
th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: 11px; font-weight: var(--weight-semibold); line-height: 16px;
  text-transform: uppercase; letter-spacing: var(--tracking-caps-wide);
  color: var(--content-subtle);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; line-height: 20px; }
tbody tr:hover td { background: var(--surface-subtle); }
tr:last-child td { border-bottom: 0; }
.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td, .money { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: var(--text-xs); }
.heard { max-width: 22ch; overflow-wrap: anywhere; }
.miss { color: var(--danger); }
.ok { color: var(--success); }
.results tbody tr.head { cursor: pointer; }
.twist { width: 1.5rem; color: var(--content-subtle); font-family: var(--font-mono); }
.detail td, .results tbody tr.detail:hover td { background: var(--surface-subtle); }
.detail audio { height: 28px; vertical-align: middle; }
.detail .actions { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-3); }

/* ------------------------------------------------------------- transcript */

.transcript { margin-top: var(--space-3); max-width: 70ch; }
.utterance {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: var(--space-2);
  padding: var(--space-2) 0; border-top: 1px solid var(--line);
}
.utterance .who { font-size: 11px; font-weight: var(--weight-semibold); text-transform: uppercase;
                  letter-spacing: var(--tracking-caps); }
.utterance.agent .who { color: var(--content-brand); }
.utterance.farmer .who { color: var(--content-subtle); }
.utterance .who .dim { display: block; font-weight: var(--weight-regular); text-transform: none;
                       letter-spacing: 0; font-size: 11px; }
.utterance .tw { font-size: var(--text-sm); }
.utterance .en { font-size: 13px; color: var(--content-muted); margin-top: 2px; }
.utterance audio { height: 26px; margin-top: var(--space-1); }

details > summary { cursor: pointer; color: var(--content-brand); font-weight: var(--weight-semibold); }
pre, code, kbd { font-family: var(--font-mono); }
audio { color-scheme: light dark; }

/* ------------------------------------------------------------ console pages */

/* Sidebar counts: e.g. the engagements that need attention. */
.nav-link .nav-label { flex: 1; min-width: 0; }
.nav-badge {
  padding: 0 7px; border-radius: var(--radius-full);
  background: var(--accent-soft); color: var(--accent-soft-content);
  font-size: 11px; font-weight: var(--weight-semibold); line-height: 18px; font-variant-numeric: tabular-nums;
}
.nav-who { margin: 0 var(--space-1) var(--space-2); font-size: var(--text-xs); color: var(--content-subtle); overflow-wrap: anywhere; }
.nav-account { display: flex; gap: var(--space-4); align-items: baseline; margin: 0 var(--space-1) var(--space-4); }
.nav-account a, .nav-account button.link { font-size: 13px; font-weight: var(--weight-semibold); }
.nav-account a[aria-current="page"] { color: var(--content); text-decoration: none; }

/* While a testing switch is on. */
.test-banner {
  padding: var(--space-2) max(var(--space-8), calc((100% - var(--content-max)) / 2 + var(--space-8)));
  background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: var(--weight-semibold);
}
@media (max-width: 900px) { .test-banner { padding: var(--space-2) var(--space-4); } }

.pill.pending { background: var(--surface-muted); color: var(--content-muted); }
.pill.pay-approved { background: var(--info-soft); color: var(--info); }
.pill.pay-cancelled { background: var(--surface-muted); color: var(--content-subtle); }
.pill.status-paused { background: var(--warning-soft); color: var(--warning); }
.pill.expected { background: var(--surface-muted); color: var(--content-subtle); }
.result { font-size: 13px; margin: 0; color: var(--content-muted); }
.result.ok { color: var(--success); }

/* A page of one column of cards (main.stack) and a page with a sidebar. */
main.stack { grid-template-columns: minmax(0, 1fr); }
main.with-side { grid-template-columns: 300px minmax(0, 1fr); }
main.with-side > aside.side { display: grid; gap: var(--space-4); align-content: start; position: sticky; top: var(--space-4); }
@media (max-width: 1024px) { main.with-side { grid-template-columns: minmax(0, 1fr); } main.with-side > aside.side { position: static; } }

/* A row of filter controls. */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: 0 0 var(--space-4); }
.toolbar > label { flex-direction: row; align-items: center; gap: var(--space-2); }
.toolbar select, .toolbar input { width: auto; }
.toolbar input[type="search"] { min-width: min(20rem, 100%); }
.toolbar .end { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
button.chip, button.chip:hover {
  min-height: var(--control-sm); padding: 0 var(--space-3); border-radius: var(--radius-full);
  background: var(--surface); color: var(--content-muted); border: 1px solid var(--line-strong);
  text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: var(--weight-medium);
}
button.chip:hover { background: var(--surface-subtle); color: var(--content); }
button.chip[aria-pressed="true"] { background: var(--action); color: var(--action-content); border-color: var(--action); }
.chip .n { margin-left: 6px; opacity: 0.75; font-variant-numeric: tabular-nums; }

/* Stat tiles, as able-mars' farmer sidebar. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--space-3); }
.tile { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); background: var(--surface); }
.tile .k { font-size: 11px; font-weight: var(--weight-semibold); text-transform: uppercase;
           letter-spacing: var(--tracking-caps-wide); color: var(--content-subtle); }
.tile .v { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-bold);
           letter-spacing: var(--tracking-tight); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .v.neg, .neg { color: var(--danger); }
.tile .v.pos { color: var(--success); }
.tile small { display: block; margin-top: 2px; }

/* Description lists (details cards). */
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: 0; font-size: 13px; }
dl.details dt { color: var(--content-subtle); }
dl.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* relative: a .sr-only label inside must not escape and widen the page */
.table-scroll { overflow-x: auto; position: relative; }
table.clickable tbody tr { cursor: pointer; }
tr.group-head td { background: var(--surface-subtle); font-weight: var(--weight-semibold); }
tr.muted td { color: var(--content-subtle); }
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.inline-form label { flex: 1 1 10rem; }
.card-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin: 0 0 var(--space-3); }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .end { margin-left: auto; display: flex; gap: var(--space-2); flex-wrap: wrap; }
.subtle-box { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); background: var(--surface-subtle); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
textarea { width: 100%; min-height: 6rem; resize: vertical; }

/* The conversation view, for chats and calls. */
.thread { display: flex; flex-direction: column; gap: 0.55rem; }
.bubble { max-width: min(34rem, 85%); padding: 0.55rem 0.75rem; border-radius: 10px;
          border: 1px solid var(--line); font-size: 0.9rem; display: grid; gap: 0.3rem; }
.bubble.in { align-self: flex-start; background: var(--surface-subtle); }
.bubble.out { align-self: flex-end; background: var(--surface); border-color: var(--accent-mark); }
.bubble .meta { font-size: 0.7rem; color: var(--content-subtle); display: flex; gap: 0.5rem; flex-wrap: wrap; }
.bubble .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .body.tw { font-style: italic; }
.bubble audio { height: 30px; max-width: 100%; }
.bubble img { max-width: 240px; max-height: 240px; border-radius: 6px; }
.bubble .err { color: var(--danger); font-size: 0.75rem; }
