/* Finishing layer (2026-10-05 audit). Loaded LAST by partials/head.html, so it
   refines the brand and workspace layers without rewriting them.

   What lives here
     1. Connection status bar      5. Filters that fold away on phones
     2. Sidebar groups + "More"     6. Empty, disabled and notice states
     3. Compact "How this page works"  7. Page-specific finishing (home,
     4. Readable small type (>=12px)      Apollo, assistant, requests, team)

   Client palette tokens only (--z*, --acc*, --good/--warn/--bad), so light and
   dark themes follow automatically. No fixed widths wider than a phone. */

/* ── 1. Connection status bar ─────────────────────────────────────────── */
.cx .ba-demo-bar {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px 16px;
  min-height: 36px; padding: 6px 24px; font-size: .75rem; font-weight: 500; letter-spacing: 0;
  background: rgb(var(--z900)); border-bottom: 1px solid rgb(var(--z800));
}
.cx .ba-demo-bar .ba-desk-mode {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 2px 10px; border-radius: 999px; background: rgb(var(--z800));
  color: rgb(var(--z100)); font-weight: 650;
}
.cx .ba-demo-bar .ba-desk-mode::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--warn)); }
.cx .ba-demo-bar .ba-desk-mode.is-live::before { background: rgb(var(--good)); }
.cx .ba-status-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.cx .ba-demo-bar .ba-status { display: inline-flex; align-items: center; gap: 7px; min-height: 24px; color: rgb(var(--z300)); font-weight: 500; white-space: nowrap; }
.cx .ba-demo-bar a.ba-status { text-decoration: none; }
.cx .ba-demo-bar a.ba-status:hover { color: rgb(var(--z100)); text-decoration: underline; text-underline-offset: 3px; }
.cx .ba-status i { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid rgb(var(--warn)); }
.cx .ba-status.is-on i { background: rgb(var(--good)); border-color: rgb(var(--good)); }
@media (max-width: 760px) {
  /* One scrollable line instead of four wrapped ones above every page. */
  .cx .ba-demo-bar { flex-wrap: nowrap; overflow-x: auto; padding: 6px 16px; scrollbar-width: none; }
  .cx .ba-demo-bar::-webkit-scrollbar { display: none; }
  .cx .ba-status-list { flex-wrap: nowrap; margin-left: 0; }
}

/* ── 2. Sidebar ───────────────────────────────────────────────────────── */
.cx-side .cx-nav, .cx-sheet .cx-nav { gap: .875rem; padding-top: .75rem; }
.cx-side .cx-nav a, .cx-sheet .cx-nav a { min-height: 40px; }
/* Group names in sentence case: easier to read than tracked capitals. */
.cx-side .cx-nav-group > p, .cx-sheet .cx-nav-group > p {
  font-size: .75rem; font-weight: 600; letter-spacing: .01em; text-transform: none; color: #a4c1d0;
}
.cx-side .cx-count, .cx-sheet .cx-count { font-size: .75rem; }
.cx-nav-more { border-top: 1px solid rgb(var(--z800)); padding-top: .625rem; }
.cx-nav-more > summary {
  display: flex; align-items: center; gap: .625rem; min-height: 40px; padding: 0 .75rem;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer; list-style: none;
  font-size: .8125rem; font-weight: 600; color: rgb(var(--z300));
}
.cx-nav-more > summary::-webkit-details-marker { display: none; }
.cx-nav-more > summary::after {
  content: ""; margin-left: auto; width: 7px; height: 7px; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s ease;
}
.cx-nav-more[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.cx-nav-more > summary:hover { background: #173d51; color: #fff; }
.cx-nav-more > summary:focus-visible { outline: 3px solid #72e2e6; outline-offset: 2px; }
.cx-nav-more > ul { margin-top: .25rem; }
.cx-sheet .cx-nav-more > summary { min-height: 46px; font-size: 1rem; }

/* ── 3. "How this page works": a slim bar until opened ────────────────── */
.cx .gd { margin: 0; border-radius: 12px; border-color: rgb(var(--z700) / .75); background: rgb(var(--z900) / .7); box-shadow: none; }
.cx .gd:not([open]) { background: rgb(var(--z900) / .55); }
.cx .gd[open] { background: linear-gradient(135deg, rgb(var(--acc-soft) / .06), rgb(var(--z900)) 55%); box-shadow: var(--shadow-card); }
.cx .gd summary { flex-wrap: nowrap; gap: 12px; min-height: 46px; padding: 6px 14px; border-radius: 12px; }
.cx .gd-badge {
  flex: none; padding: 0; border: 0; background: none; text-transform: none; letter-spacing: 0;
  font-size: .8125rem; font-weight: 650; color: rgb(var(--acc-text));
}
.cx .gd-purpose { flex: 1 1 auto; min-width: 0; font-size: .8125rem; font-weight: 450; color: rgb(var(--z300));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx .gd[open] .gd-purpose { white-space: normal; color: rgb(var(--z200)); }
.cx .gd-toggle { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; color: rgb(var(--z400)); }
.cx .gd[open] .gd-toggle { transform: none; }
.cx .gd-toggle svg { transform: rotate(90deg); transition: transform .15s ease; }
.cx .gd[open] .gd-toggle svg { transform: rotate(-90deg); }
.cx .gd .gd-hide, .cx .gd[open] .gd-show { display: none; }
.cx .gd[open] .gd-hide { display: inline; }
.cx .gd summary:hover .gd-toggle { color: rgb(var(--acc-text)); }
.cx .gd-step p { font-size: .8125rem; }
@media (max-width: 639px) {
  .cx .gd summary { padding: 6px 12px; }
  .cx .gd-purpose { display: none; }
  .cx .gd[open] .gd-purpose { display: block; flex-basis: 100%; }
  .cx .gd[open] summary { flex-wrap: wrap; }
}

/* ── 4. Readable small type ───────────────────────────────────────────── */
/* Every label, chip and badge is at least 12px; tracked capitals are eased
   so the short labels still read as words. */
.cx .cx-eyebrow, .cx .ba-kicker, .cx .cx-brief-kicker, .cx .cx-brief-label { font-size: .75rem; letter-spacing: .08em; }
.cx .hcell, .cx th.hcell { font-size: .75rem; letter-spacing: .06em; }
.cx .bdg, .cx .lv-src, .cx .ap-pill, .cx .ap-tabs a, .cx .ap-presets a, .cx .home-status, .cx .home-example { font-size: .75rem; }
.cx .cx-product { font-size: .75rem; }
.cx small { font-size: max(.75rem, 80%); }

/* ── 5. Filters that fold away on phones ──────────────────────────────── */
.cx-filters > summary { display: none; }
.cx-filters-body { display: grid; gap: 1rem; }
@media (max-width: 639px) {
  .cx-filters > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 48px; padding: 0 16px; border: 1px solid rgb(var(--field)); border-radius: 12px;
    background: rgb(var(--z900)); color: rgb(var(--z100)); font-weight: 600; cursor: pointer; list-style: none;
  }
  .cx-filters > summary::-webkit-details-marker { display: none; }
  .cx-filters > summary::after {
    content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform .15s ease;
  }
  .cx-filters[open] > summary { margin-bottom: 12px; }
  .cx-filters[open] > summary::after { transform: rotate(-135deg); }
}

/* ── 6. Shared states ─────────────────────────────────────────────────── */
.cx .cx-btn:disabled, .cx .cx-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.cx .or-empty { display: grid; justify-items: center; gap: 6px; padding: 32px 20px; }
.cx .or-empty .cx-btn { margin-top: 8px; }
.cx .or-empty p { margin: 0; }
.cx .cx-example-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px;
  border: 1px dashed rgb(var(--z600)); color: rgb(var(--z300)); background: rgb(var(--z950));
  font-size: .75rem; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.cx .cx-next-step {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  padding: 14px 18px; border: 1px solid rgb(var(--acc-soft) / .3); border-left: 3px solid rgb(var(--acc));
  border-radius: 12px; background: rgb(var(--acc-soft) / .06); color: rgb(var(--z200)); font-size: .875rem; line-height: 1.6;
}
.cx .cx-next-step p { margin: 0; max-width: 70ch; }
.cx .cx-next-step strong { color: rgb(var(--z100)); }
.cx .in-wait { font-size: .8125rem; line-height: 1.6; color: rgb(var(--z400)); }

/* ── 7a. Home ─────────────────────────────────────────────────────────── */
.cx .home-examples { margin: 8px 0 4px; border: 1px dashed rgb(var(--z700)); border-radius: 12px; }
.cx .home-examples > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 14px;
  cursor: pointer; list-style: none; font-size: .8125rem; font-weight: 600; color: rgb(var(--z300));
}
.cx .home-examples > summary::-webkit-details-marker { display: none; }
.cx .home-examples > summary small { font-weight: 450; color: rgb(var(--z400)); }
.cx .home-examples .home-prospect-list { margin: 0 4px 6px; }
.cx .home-empty.is-compact { padding: 28px 12px 20px; }

/* ── 7b. Apollo: the search comes first, account detail folds away ───── */
.cx .ap-details { padding: 0; }
.cx .ap-details > summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 56px; padding: 14px 20px;
  cursor: pointer; list-style: none; border-radius: var(--radius);
}
.cx .ap-details > summary::-webkit-details-marker { display: none; }
.cx .ap-details > summary strong { font-size: 1rem; color: rgb(var(--z100)); }
.cx .ap-details > summary span { font-size: .8125rem; color: rgb(var(--z400)); }
.cx .ap-details > summary::after {
  content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid rgb(var(--z400)); border-bottom: 2px solid rgb(var(--z400));
  transform: rotate(45deg); transition: transform .15s ease;
}
.cx .ap-details[open] > summary { border-bottom: 1px solid rgb(var(--z800)); border-radius: var(--radius) var(--radius) 0 0; }
.cx .ap-details[open] > summary::after { transform: rotate(-135deg); }
.cx .ap-details-body { display: grid; gap: 16px; padding: 18px 20px 20px; }
.cx .ap-details-body > .ap-card { box-shadow: none; background: rgb(var(--z950) / .6); }
.cx .ap-status { margin: 4px 0 8px; }
.cx .ap-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; position: relative; z-index: 1; }

/* ── 7c. Assistant: older turns fold, the two voices look different ───── */
.cx .as-history { margin-bottom: 12px; border: 1px solid rgb(var(--z700)); border-radius: 12px; background: rgb(var(--z950) / .6); }
.cx .as-history > summary {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 14px;
  cursor: pointer; list-style: none; font-size: .8125rem; font-weight: 600; color: rgb(var(--acc-text));
}
.cx .as-history > summary::-webkit-details-marker { display: none; }
.cx .as-history[open] > summary { border-bottom: 1px solid rgb(var(--z800)); }
.cx .as-history > ol { padding: 12px; }
.cx .ba-chat-bubble { border-radius: 14px; padding: 12px 14px; }
.cx .as-turn-client .ba-chat-bubble { border-bottom-right-radius: 4px; }
.cx .as-turn-assistant .ba-chat-bubble { border-bottom-left-radius: 4px; background: rgb(var(--z950)) !important; border: 1px solid rgb(var(--z700)); color: rgb(var(--z100)) !important; }
.cx .as-composer { position: sticky; bottom: 0; z-index: 5; margin: 16px -20px -16px; padding: 12px 20px 16px;
  background: rgb(var(--z900) / .96); border-top: 1px solid rgb(var(--z800)); border-radius: 0 0 var(--radius) var(--radius); }
.cx .as-composer input { flex: 1 1 14rem; min-width: 0; }
@media (max-width: 639px) { .cx .as-composer { margin: 16px -16px -16px; padding: 12px 16px 14px; } }

/* ── 7d. Forms written before the revamp (Research requests) ─────────── */
.cx .cx-field-label { font-size: .8125rem; font-weight: 600; color: rgb(var(--z300)); text-transform: none; letter-spacing: 0; }
.cx .cx-field-help { font-size: .75rem; color: rgb(var(--z400)); }

/* ── 7e. Team ─────────────────────────────────────────────────────────── */
.cx .or-kpi b span { font-size: 1rem; font-weight: 500; color: rgb(var(--z400)); }
.cx .or-person-main b a { color: inherit; }
.cx .or-person-main .or-how { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .cx-nav-more > summary::after, .cx .gd-toggle svg, .cx-filters > summary::after, .cx .ap-details > summary::after { transition: none; }
}
@media print { .ba-demo-bar, .cx .gd { display: none; } }

/* ── 7f. Integrations ─────────────────────────────────────────────────── */
.cx .in-card .in-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
.cx .in-card .in-actions .cx-btn { margin-top: 0; }
.cx .in-card > .in-wait:last-child, .cx .in-card > .cx-btn + .in-wait { margin-top: auto; }
/* The composer's send button: filled like a primary, but not counted as the
   section's one primary decision (approvals inside the conversation are). */
.cx .as-ask { background: rgb(var(--acc)); color: rgb(var(--acc-fg)); border-color: transparent; }
.cx .as-ask:hover { background: rgb(var(--acc-hover)); }

/* ── 7g. Leads ────────────────────────────────────────────────────────── */
.cx .lead-company .cx-example-tag { margin-top: 6px; }
.cx .ba-market-filters { margin: 0; }

/* Fine print folded under a page lede: the full disclosure, one click away. */
.cx .cx-fineprint { margin-top: .75rem; max-width: 70ch; font-size: .8125rem; color: rgb(var(--z400)); position: relative; z-index: 1; }
.cx .cx-fineprint > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; list-style: none; font-weight: 600; color: rgb(var(--acc-text)); }
.cx .cx-fineprint > summary::-webkit-details-marker { display: none; }
.cx .cx-fineprint > summary::before { content: "+"; font-size: 1rem; line-height: 1; }
.cx .cx-fineprint[open] > summary::before { content: "−"; }
.cx .cx-fineprint > p { margin: 0 0 .25rem; line-height: 1.7; }

/* Apollo results: one filled button per page (Search and score). The per-row
   decision reads as the positive choice without twenty-five filled blocks. */
.cx .ap-yes { color: rgb(var(--acc-text)); border-color: rgb(var(--acc-text) / .5); }
.cx .ap-yes:hover { background: rgb(var(--acc)); border-color: rgb(var(--acc)); color: rgb(var(--acc-fg)); }
