/* --- Tailwind Responsive Breakpoints --- */

/* --- Colors --- */

/*
  Tailwind Default Colors (https://tailwindcss.com/docs/colors):

  Neutral Colors:
  neutral-50:  #fafafa
  neutral-100: #f5f5f5
  neutral-200: #e5e5e5
  neutral-300: #d4d4d4
  neutral-400: #a3a3a3
  neutral-500: #737373
  neutral-600: #525252
  neutral-700: #404040
  neutral-800: #262626
  neutral-950: #0a0a0a

  Orange Colors:
  orange-50:   #fff7ed
  orange-100:  #ffedd5
  orange-200:  #fed7aa
  orange-300:  #fdba74
  orange-400:  #fb923c
  orange-500:  #f97316
  orange-600:  #ea580c
  orange-650:  #d64d0c (ours — 600/700 midpoint; the app's darken-on-hover shade)
  orange-700:  #c2410c
  orange-800:  #9a3412
  orange-900:  #7c2d12
  orange-950:  #431407

  Bone Colors (ours — warm neutral pinned to the orange-500 hue, ~40% of the
  saturation of the previous yellow-leaning scale; lightness steps unchanged):
  bone-50:   #FCFBFA
  bone-100:  #F8F6F5
  bone-200:  #F4F1F0
  bone-300:  #EFECEA
  bone-400:  #EBE7E5
  bone-500:  #CAC4C1
  bone-600:  #A8A09D
  bone-700:  #877F7B
  bone-800:  #665F5B
  bone-900:  #46413E
  bone-950:  #2B2725
*/

:root {
  /* Neutral */
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-950: #0a0a0a;

  /* Orange */
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  /* Semantic accents tuned to the warm bone+orange world (2026-08-19):
     amber = at-work/waiting (analogous to orange); green = done — warmed
     toward the palette, midway between Tailwind emerald (cool) and olive. */
  --amber-500: #f59e0b;
  --green-600: #2f9160;
  /* Halfway between Tailwind's 600 and 700 — 700 reads brown/dirty as a hover
     on 600, this keeps the hue clean while still darkening. White text: 4.3:1. */
  --orange-650: #d64d0c;
  --orange-700: #c2410c;

  /* Bone */
  --bone-50: #fcfbfa;
  --bone-75: #faf9f8; /* midpoint of bone-50 and bone-100 */
  --bone-100: #f8f6f5;
  --bone-150: #f6f4f3; /* midpoint of bone-100 and bone-200 */
  --bone-200: #f4f1f0;
  --bone-300: #efecea;
  --bone-400: #ebe7e5;
  --bone-500: #cac4c1;
  --bone-600: #a8a09d;
  --bone-700: #877f7b;
  --bone-800: #665f5b;
  --bone-900: #46413e;
  --bone-950: #2b2725;

}

/* @import "forms"; */

/* --- Checkbox and radio (atoms, TA-859) ---
   The artifact's recipe on the native input, so every check_box and
   radio_button in the app picks it up with no wrapper markup: a 16px box on
   the raised surface with the hover line, filling with primary when checked.
   The check and the radio dot are drawn in the primary's text colour, so both
   invert on ink. In a layer so .hidden, .sr-only and other utilities on a
   visually hidden input still win. */
@layer components {
  input[type="checkbox"],
  input[type="radio"] {
    appearance: none;
    display: inline-grid;
    place-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
    background-color: var(--surface);
    border: 1px solid var(--hairline-hover);
    border-radius: var(--radius-sm);
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
  }

  input[type="checkbox"]::before,
  input[type="radio"]::before {
    content: "";
    width: 10px;
    height: 10px;
    background-color: var(--primary-fg);
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.3s ease;
  }

  input[type="checkbox"]::before {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  input[type="checkbox"]:indeterminate::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
  }

  /* A radio reads as a ring, not a filled box: the chosen one keeps its
     surface, thickens its line to 2px in primary and sets an 8px dot inside,
     leaving a ring of surface between dot and line. */
  input[type="radio"]::before {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    transform: scale(0.5);
  }

  /* Hover only the empty box, so it never paints over a checked one. */
  input[type="checkbox"]:not(:checked, :indeterminate):hover,
  input[type="radio"]:not(:checked):hover,
  .check-label:hover input[type="checkbox"]:not(:checked, :indeterminate),
  .check-label:hover input[type="radio"]:not(:checked) {
    background-color: var(--surface-hover);
    border-color: var(--hairline-active);
  }

  input[type="checkbox"]:checked,
  input[type="checkbox"]:indeterminate {
    background-color: var(--primary);
    border-color: var(--primary);
  }

  input[type="radio"]:checked {
    border-width: 2px;
    border-color: var(--primary);
  }

  input[type="checkbox"]:checked::before,
  input[type="checkbox"]:indeterminate::before,
  input[type="radio"]:checked::before {
    opacity: 1;
    transform: scale(1);
  }

  input[type="checkbox"]:focus-visible,
  input[type="radio"]:focus-visible {
    box-shadow: 0 0 0 3px var(--focus-ring);
  }

  input[type="checkbox"]:disabled,
  input[type="radio"]:disabled {
    opacity: 0.45;
    cursor: default;
  }
}

/* Radios are true circles so they read differently from the checkbox. Unlayered
   because corners.css squircles every element unlayered, which would otherwise
   turn the 16px circle back into a rounded square. */
input[type="radio"],
input[type="radio"]::before {
  border-radius: 50%;
  corner-shape: round;
}

/* The label beside a checkbox, radio or toggle: 13px ink at 400, 8px from the
   control. Unlayered so it beats the global form label rule. */
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.check-label:has(input:disabled) {
  color: var(--ink-faint);
  cursor: default;
}

/* --- Checkbox button and radio button (atoms, TA-859) ---
   A checkbox or radio inside a label dressed as the secondary button, for a
   short set of answers (screener questions, reward amounts, filters). The
   control is always visible, so the button never changes width when picked.
   Selected is moss by default: the success tint, line and text, with the
   control filled in the success colour.
     -ink    selected fills with primary (ink, inverts on ink ground) and the
             control turns to its inverse
     -plain  no visible control, just the label; the input is still there for
             keyboard and forms
     -sm     the 28px size
   The selected colours are variables, so a tone is one block of values. */
.checkbox-button,
.radio-button {
  --choice-on-fill: var(--success-tint);
  --choice-on-line: var(--success-line);
  --choice-on-text: var(--success-text);
  --choice-on-hover-fill: var(--success-tint);
  --choice-on-hover-line: var(--success);
  --choice-on-hover-text: var(--success-strong);
  --choice-control: var(--success);
  --choice-mark: var(--primary-fg);

  /* Positioned so the -plain variant's hidden input stays inside the button.
     Without it the input sits at the top of the page, and the browser scrolls
     there to focus it on every click. */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  margin: 0;
  padding: 0 16px 0 12px;
  font-size: 13px;
  line-height: 16px;
  font-weight: 400;
  color: var(--ink-muted);
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2xl);
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

/* -danger: a choice that counts against (a screener answer that screens
   people out): brick when on. */
.checkbox-button-danger {
  --choice-on-fill: var(--danger-tint);
  --choice-on-line: var(--danger-line);
  --choice-on-text: var(--danger-text);
  --choice-on-hover-fill: var(--danger-tint);
  --choice-on-hover-line: var(--danger);
  --choice-on-hover-text: var(--danger-strong);
  --choice-control: var(--danger);
  --choice-mark: var(--primary-fg);
}

.checkbox-button-ink,
.radio-button-ink {
  --choice-on-fill: var(--primary);
  --choice-on-line: var(--primary-line);
  --choice-on-text: var(--primary-fg);
  --choice-on-hover-fill: var(--primary-hover);
  --choice-on-hover-line: var(--primary-hover-line);
  --choice-on-hover-text: var(--primary-fg);
  --choice-control: var(--primary-fg);
  --choice-mark: var(--primary);
}

.checkbox-button:hover,
.radio-button:hover {
  color: var(--ink);
  background-color: var(--surface-hover);
  border-color: var(--hairline-hover);
}

.checkbox-button:hover input:not(:checked),
.radio-button:hover input:not(:checked) {
  background-color: var(--surface-hover);
  border-color: var(--hairline-active);
}

.checkbox-button:has(input:checked),
.radio-button:has(input:checked) {
  color: var(--choice-on-text);
  background-color: var(--choice-on-fill);
  border-color: var(--choice-on-line);
}

.checkbox-button:has(input:checked):hover,
.radio-button:has(input:checked):hover {
  color: var(--choice-on-hover-text);
  background-color: var(--choice-on-hover-fill);
  border-color: var(--choice-on-hover-line);
}

.checkbox-button input:checked {
  background-color: var(--choice-control);
  border-color: var(--choice-control);
}

/* The radio's ring and dot take the tone; the gap between them is the
   button's own fill. */
.radio-button input:checked {
  background-color: transparent;
  border-color: var(--choice-control);
}

.radio-button input:checked::before {
  background-color: var(--choice-control);
}

.checkbox-button input:checked::before {
  background-color: var(--choice-mark);
}

/* The whole button carries the focus ring, not the control. */
.checkbox-button input:focus-visible,
.radio-button input:focus-visible {
  box-shadow: none;
}

.checkbox-button:has(input:focus-visible),
.radio-button:has(input:focus-visible) {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.checkbox-button:has(input:disabled),
.radio-button:has(input:disabled) {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* The button's fade covers the control; don't fade it twice. */
.checkbox-button input:disabled,
.radio-button input:disabled {
  opacity: 1;
}

.checkbox-button-plain,
.radio-button-plain {
  padding: 0 16px;
}

.checkbox-button-plain input,
.radio-button-plain input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.checkbox-button-sm,
.radio-button-sm {
  gap: 8px;
  height: 28px;
  padding: 0 12px 0 8px;
  font-size: 11px;
  border-radius: var(--radius-lg);
}

.checkbox-button-sm.checkbox-button-plain,
.radio-button-sm.radio-button-plain {
  padding: 0 12px;
}

/* -lg: the 44px size that sits in the thread's answer slot beside .btn-lg
   (TA-1121); replaces the legacy .screener-pill. */
.checkbox-button-lg,
.radio-button-lg {
  height: 44px;
  padding: 0 20px 0 16px;
  font-size: 15px;
}

.checkbox-button-lg.checkbox-button-plain,
.radio-button-lg.radio-button-plain {
  padding: 0 20px;
}

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  /* font-family: "DM Sans", sans-serif; */
  /* font-family: "Satoshi", sans-serif; */
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: 13px;
  font-style: normal;
  line-height: 1.5;
  /* letter-spacing: -0.015em; */
  /* Body copy is secondary by default; headings, emphasis, labels, inputs and
     components set ink where they need it. */
  color: var(--ink-muted);
  background-color: var(--bone-100);
}

/* --- Page width system ---
   One width ladder, shared by every page-level wrapper, so an index page and a
   show page put their content at the same width. `--content-max-width` is the
   single knob (stepped up at the lg/2xl breakpoints below, and consumed again by
   the chat-canvas pin near the bottom of this file); the wrappers only read it.

   .content-container       — the row/section wrapper, used on every page
   .page-details-container  — show-page body wrapper (wraps .content-container rows)
   .content-width-container — page chrome above the body (back bars, tab subnavs)

   They MUST resolve to the same width. Show pages nest .content-container inside
   .page-details-container, and a nested wrapper reads 100% of its parent — so any
   cap that differs between them silently narrows the page it wraps, which is
   exactly how show pages drifted 180px narrower than index pages at 2xl. */
:root {
  --content-max-width: none;
}

.content-container,
.page-details-container,
.content-width-container {
  /* Explicit width, not auto: the content card is a flex column (pinned
     pagination), and a flex item with auto cross-axis margins does NOT
     stretch — the auto margins absorb the free space and the wrapper
     shrinks to fit-content. width: 100% restores block behaviour: fill,
     cap at max-width, centre via the auto margins. */
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* --- Typography --- */

/* Mobile-first: phones get a smaller title; md restores the full size */
h1 {
  font-size: 26px;
  font-weight: 500;
  line-height: 32px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* Heading ramp, mobile-first: base = phone size, the md block upgrades each
   step. Mobile runs 26/20/18/16/14 over 13px body text; h5's 14px is the
   floor (weight 500 and the -0.03em tracking carry the distinction there) — nothing below it gets a
   sized heading rule, so h6 is deliberately unstyled. */
h2 {
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

h3 {
  font-size: 18px;
  font-weight: 500;
  line-height: 26px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

h4 {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

h5 {
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* Emphasis changes weight only, never colour: bold text inside a muted
   paragraph stays muted. Views never reach for font-semibold to get it. */
strong,
b {
  font-weight: 600;
}

/* Table headers take the heading weight and ink. */
th {
  font-weight: 500;
  color: var(--ink);
}

/* Caps label: 9px uppercase at 1.4px tracking, weight 400, ink at 64%. One
   declaration for every place the app sets small uppercase text, so changing
   it here changes it everywhere. Views use .caps-label (the breadcrumb
   included); the other selectors are components that carry the same style
   with their own layout and colour.
   Tags use the same caps at 500. */
.caps-label,
.sidenav-section-header,
.card-eyebrow,
.stat-label,
ul.breadcrumb {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

/* The label's colour and layout sit in the components layer, so a utility on
   the element (text-ink-faint, hidden, md:table-cell) still wins; the type
   above does not. */
@layer components {
  .caps-label {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 16px;
    color: var(--ink-muted);
  }
}

.text-xxs {
  font-size: 9px;
}

.agent-text {
  font-size: 20px; /* Mobile first: text-xl */
  font-weight: 400; /* The design system's body weight (TA-1121; was 450) */
  line-height: 1.5; /* Adjust as needed, e.g., 28px for text-xl */
  /* The headings' tracking, at every size, so the line never reads loose. */
  letter-spacing: -0.03em;
  text-align: center;

  margin-right: auto; /* Centering block with max-width */
  margin-left: auto; /* Centering block with max-width */
  color: var(--ink);
}

.notice {
  position: absolute;
  bottom: -60px;
  background-color: var(--neutral-800);
  color: #ffffff;
  border-radius: var(--radius-2xl);
  padding: 10px 16px 10px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  z-index: 1050;
  margin-left: auto;
  margin-right: auto;
  left: 0;
  right: 0;
  width: fit-content;
  transition: bottom 0.3s cubic-bezier(0.68, -0.55, 0.45, 1.3);
}

.notice-show {
  bottom: 28px;
}

.notice-close-icon {
  cursor: pointer;
}

/* --- Toast Notification System --- */

#toast-container {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  z-index: 1060;
  pointer-events: none;
}

.toast {
  background-color: var(--neutral-800);
  color: #ffffff;
  border-radius: var(--radius-2xl);
  padding: 10px 16px 10px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  width: fit-content;
  max-width: 90vw;
  pointer-events: auto;
  transform: translateY(80px);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.68, -0.55, 0.45, 1.3),
    opacity 0.3s cubic-bezier(0.68, -0.55, 0.45, 1.3);
}

.toast-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-dismissing {
  transform: translateY(80px);
  opacity: 0;
  transition:
    transform 0.2s ease-in,
    opacity 0.2s ease-in;
}

.toast-close-icon {
  cursor: pointer;
  flex-shrink: 0;
}

/* --- Button (atom, TA-859) ---
   The artifact's recipe: one control height per size (28 / 36 / 44), a 1px
   line on every variant, weight 400, and colour from the semantic tokens so
   each variant follows its ground. Primary is ink (it inverts on ink);
   secondary is the raised surface; tertiary is the sunk surface. Orange is
   not a button colour — it is the brand accent in small doses. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-2xl);
  font-size: 13px;
  line-height: 16px;
  font-weight: 400;
  text-align: center;
  align-self: center;
  justify-self: center;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.btn:focus-visible,
.btn-sm:focus-visible,
.btn-lg:focus-visible,
.btn-sm-icon:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Every size and the small icon button share one disabled state. */
.btn:disabled,
.btn[aria-disabled="true"],
.btn-sm:disabled,
.btn-sm[aria-disabled="true"],
.btn-lg:disabled,
.btn-lg[aria-disabled="true"],
.btn-sm-icon:disabled,
.btn-sm-icon[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* Loading: aria-busy="true" on the button, nothing else. The label, icon and
   hotkey go invisible but keep their space, so the button holds its width, and
   a spinner is drawn over the middle in the variant's text colour. */
.btn[aria-busy="true"],
.btn-sm[aria-busy="true"],
.btn-lg[aria-busy="true"],
.btn-sm-icon[aria-busy="true"] {
  position: relative;
  /* Turbo disables the submitter while it is busy; keep full strength. */
  opacity: 1;
  -webkit-text-fill-color: transparent;
  cursor: progress;
  pointer-events: none;
}

.btn[aria-busy="true"] > *,
.btn-sm[aria-busy="true"] > *,
.btn-lg[aria-busy="true"] > *,
.btn-sm-icon[aria-busy="true"] > * {
  visibility: hidden;
}

.btn[aria-busy="true"]::after,
.btn-sm[aria-busy="true"]::after,
.btn-lg[aria-busy="true"]::after,
.btn-sm-icon[aria-busy="true"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  corner-shape: round;
  box-sizing: border-box;
  animation: btn-spin 0.8s linear infinite;
}

.btn-sm[aria-busy="true"]::after,
.btn-sm-icon[aria-busy="true"]::after {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
}

.btn-lg[aria-busy="true"]::after {
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"]::after,
  .btn-sm[aria-busy="true"]::after,
  .btn-lg[aria-busy="true"]::after,
  .btn-sm-icon[aria-busy="true"]::after {
    animation-duration: 2.4s;
  }
}

/* --- Button Icon --- */

/* One icon size for every button (14px). Loads after Tailwind, so this beats
   the size-3/size-4 classes still scattered through views. */
.btn svg,
.btn-sm svg,
.btn-lg svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.btn.has-icon-left {
  padding-left: 12px;
}

.btn.has-icon-right {
  padding-right: 12px;
}

/* The same tightening on the small and large sizes (TA-1121). */
.btn-sm.has-icon-left {
  padding-left: 8px;
}

.btn-sm.has-icon-right {
  padding-right: 8px;
}

.btn-lg.has-icon-left {
  padding-left: 16px;
}

.btn-lg.has-icon-right {
  padding-right: 16px;
}


/* Icon-only buttons are square at the control height. */
.btn.just-icon-btn,
.btn.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
}

/* Icon and label from 768px up, icon only below: a square at the size's
   height on phones. The label goes in a <span> so it can be hidden. */
.btn.just-icon-on-mobile,
.btn-sm.just-icon-on-mobile,
.btn-lg.just-icon-on-mobile {
  padding: 0;
  gap: 0;
  flex-shrink: 0;
}

.btn.just-icon-on-mobile {
  width: 36px;
}

.btn-sm.just-icon-on-mobile {
  width: 28px;
}

.btn-lg.just-icon-on-mobile {
  width: 44px;
}

.btn.just-icon-on-mobile span,
.btn-sm.just-icon-on-mobile span,
.btn-lg.just-icon-on-mobile span {
  display: none;
}

.btn.just-icon-on-desktop svg {
  display: none;
}

/* Large icon-only button, 44px square with the large size's 16px icon. */
.btn-lg.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
}

/* Small icon-only button, 28px square — used without .btn beside list rows. */
.btn-sm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.btn-sm-icon svg {
  width: 12px;
  height: 12px;
}

/* --- Button Hotkey --- */

/* Hotkey affordances are keyboard-only, so mobile gets NONE of them: kbd
   badges stay hidden below md, where the md block flips them on. The 18px
   badge takes the button's own text colour at 64% and a 24% line, so it
   follows every variant and ground without a colour of its own. */

.btn kbd,
.btn-sm kbd,
.btn-lg kbd {
  display: none;
  align-items: center;
  justify-content: center;
  height: 18px;
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
  border-radius: var(--radius-sm);
  font-size: 9px;
  line-height: 18px;
  font-weight: 400;
  color: color-mix(in srgb, currentColor 64%, transparent);
}

/* Small buttons take a 16px badge, so it clears the 28px height evenly. */
.btn-sm kbd {
  height: 16px;
  min-width: 16px;
  line-height: 16px;
}

/* Hidden below md like every other kbd (the md block flips it on). */
kbd.tertiary {
  display: none;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 20px;
  padding: 0 4px;
  border: 1px solid var(--hairline-hover);
  border-radius: var(--radius-md);
  font-size: 9px;
  color: var(--ink-faint);
}

/* Size ladder: sm 28px / default 36px / lg 44px. Horizontal padding scales
   with height: 12 / 16 / 20. */
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  font-size: 11px;
  line-height: 16px;
  font-weight: 400;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.btn-sm svg {
  width: 12px;
  height: 12px;
}

.btn-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-2xl);
  font-size: 15px;
  line-height: 16px;
  font-weight: 400;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.btn-lg svg {
  width: 16px;
  height: 16px;
}

.gsi-material-button-icon {
  height: 20px;
  margin-right: 2px;
  min-width: 20px;
  width: 20px;
}

/* --- Button variants --- */
.btn-primary {
  color: var(--primary-fg);
  background-color: var(--primary);
  border-color: var(--primary-line);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover-line);
}

.btn-primary:active {
  background-color: var(--primary-active);
  border-color: var(--primary-active-line);
}

.btn-on-brand-fx {
  color: #fff;
  background-color: rgb(255 255 255 / 0.1);
}

.btn-on-brand-fx:hover,
.btn-on-brand-fx:active {
  color: #fff;
  background-color: rgb(255 255 255 / 0.2);
}

.btn-on-brand-fx:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .btn-on-brand-fx { transition: none; }
}

.btn-secondary {
  color: var(--ink-muted);
  background-color: var(--surface);
  border-color: var(--hairline);
}

.btn-secondary:hover {
  color: var(--ink);
  background-color: var(--surface-hover);
  border-color: var(--hairline-hover);
}

.btn-secondary:active {
  color: var(--ink);
  background-color: var(--sunk);
  border-color: var(--hairline-active);
}

.btn-tertiary {
  color: var(--ink-muted);
  background-color: var(--sunk);
  border-color: var(--hairline);
}

.btn-tertiary:hover {
  color: var(--ink);
  background-color: var(--hover);
  border-color: var(--hairline-hover);
}

.btn-tertiary:active {
  color: var(--ink);
  background-color: var(--surface);
  border-color: var(--hairline-active);
}

/* Ghost: text or icon only at rest; the button shape appears on hover. For
   close, clear and row actions that should not add weight to a screen. */
.btn-ghost {
  color: var(--ink-muted);
  background-color: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--ink);
  background-color: var(--hover);
  border-color: var(--hairline-hover);
}

.btn-ghost:active {
  color: var(--ink);
  background-color: var(--surface);
  border-color: var(--hairline-active);
}

/* Screener pill-style answer buttons */
.screener-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-2xl);
  font-size: 14px;
  font-weight: 450;
  line-height: 20px;
  transition: all 0.2s ease;
  user-select: none;
  color: var(--ink-muted);
}

.pill-text {
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
}

.screener-pill:hover {
  scale: 1.02;
}

.screener-pill.selected {
  background-color: #dcfce7; /* green-100 */
  color: #166534; /* green-800 */
}

/* Quiet destructive action: an ordinary tertiary button at rest that shows
   its danger only on hover. */
.btn-tertiary.btn-danger-hover:hover,
.btn-sm.btn-tertiary.btn-danger-hover:hover {
  color: var(--danger-text);
  background-color: var(--danger-tint);
  border-color: var(--danger-line);
}

/* Destructive primary: the danger icon step as a fill, text step on hover. */
.btn-danger-primary {
  color: var(--color-white);
  background-color: var(--danger);
  border-color: var(--danger);
}

.btn-danger-primary:hover,
.btn-danger-primary:active {
  background-color: var(--danger-text);
  border-color: var(--danger-text);
}

.btn-danger-secondary {
  color: var(--danger-text);
  background-color: var(--danger-tint);
  border-color: var(--danger-line);
}

.btn-danger-secondary:hover,
.btn-danger-secondary:active {
  color: var(--danger-strong);
  border-color: var(--danger-text);
}

/* Success and warning pairs, on the same recipe as the danger pair. Rare by
   design: a green or amber button only where the action itself carries that
   status — the action on a success or warning banner. */
.btn-success-primary {
  color: var(--color-white);
  background-color: var(--success);
  border-color: var(--success);
}

.btn-success-primary:hover,
.btn-success-primary:active {
  background-color: var(--success-text);
  border-color: var(--success-text);
}

.btn-success-secondary {
  color: var(--success-text);
  background-color: var(--success-tint);
  border-color: var(--success-line);
}

.btn-success-secondary:hover,
.btn-success-secondary:active {
  color: var(--success-strong);
  border-color: var(--success-text);
}

.btn-warning-primary {
  color: var(--color-white);
  background-color: var(--warning);
  border-color: var(--warning);
}

.btn-warning-primary:hover,
.btn-warning-primary:active {
  background-color: var(--warning-text);
  border-color: var(--warning-text);
}

.btn-warning-secondary {
  color: var(--warning-text);
  background-color: var(--warning-tint);
  border-color: var(--warning-line);
}

.btn-warning-secondary:hover,
.btn-warning-secondary:active {
  color: var(--warning-strong);
  border-color: var(--warning-text);
}

/* Ghost in a status tone: the action on a banner. The tone's text at rest
   with no fill, so a notice stays light; on hover it becomes that tone's
   primary button, so the action is unmistakable once pointed at. .btn-ghost
   stays the neutral one. */
.btn-success-ghost,
.btn-warning-ghost,
.btn-danger-ghost {
  background-color: transparent;
  border-color: transparent;
}

.btn-success-ghost { color: var(--success-text); }
.btn-warning-ghost { color: var(--warning-text); }
.btn-danger-ghost { color: var(--danger-text); }

.btn-success-ghost:hover,
.btn-warning-ghost:hover,
.btn-danger-ghost:hover {
  color: var(--color-white);
}

.btn-success-ghost:hover { background-color: var(--success); border-color: var(--success); }
.btn-warning-ghost:hover { background-color: var(--warning); border-color: var(--warning); }
.btn-danger-ghost:hover { background-color: var(--danger); border-color: var(--danger); }

.btn-success-ghost:active { color: var(--color-white); background-color: var(--success-text); border-color: var(--success-text); }
.btn-warning-ghost:active { color: var(--color-white); background-color: var(--warning-text); border-color: var(--warning-text); }
.btn-danger-ghost:active { color: var(--color-white); background-color: var(--danger-text); border-color: var(--danger-text); }

/* Ensure buttons with the .hidden class are actually hidden */
.btn.hidden {
  display: none;
}

/* Start of Selection */
.sidenav-item {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  width: 100%;
  transition: all 0.3s ease;
  margin-bottom: 2px;
  transition: all 0.3s ease;
}

.sidenav-item:hover {
  background-color: var(--bone-50);
  color: var(--orange-600);
}

.sidenav-item.active {
  background-color: #ffffff;
  color: var(--orange-600);
}

/* A bookmark's name is a study's, so unlike the other rows it can run long. */
.sidenav-bookmark .sidenav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidenav-bookmark svg {
  flex-shrink: 0;
}

/* View all is a quiet text link, not a nav row: no fill or orange on hover.
   It lines up with the row names (12px row padding + 14px icon + 8px gap) and
   keeps 16px clear of the links below it. */
.sidenav-bookmarks-view-all {
  padding: 4px 0 16px 34px;
  font-size: 12px;
  line-height: 1.4;
}

/* An archived record stays listed, quieter. */
.sidenav-bookmark--archived:not(:hover) {
  color: var(--ink-muted);
}

/* End of Selection */

/* --- Sidebar notices (TA-1924) --- */

/* The front card in full and, while others wait, a neutral strip peeking out
   below it. The card overlaps the strip by 20px at rest so no gap shows while it
   lifts or the next card grows out of it. */
.sidebar-notices-host:focus {
  outline: none;
}

.sidebar-notices {
  position: relative;
  isolation: isolate;
  margin: 0 8px 16px;
}

.sidebar-notices[data-stacked="true"] {
  padding-bottom: 8px;
}

.sidebar-notices__peek {
  position: absolute;
  inset: auto 12px 0;
  height: 28px;
  border-radius: var(--radius-xl);
  background: #cac4c1;
  z-index: -1;
  pointer-events: none;
}

.sidebar-notice {
  --image-opacity: 0.9;
  position: relative;
  display: flex;
  isolation: isolate;
  border-radius: var(--radius-xl);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
}

.sidebar-notice[hidden] {
  display: none;
}

.sidebar-notice:focus-within {
  --image-opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .sidebar-notice:hover {
    --image-opacity: 1;
  }
}

.sidebar-notice:has(.sidebar-notice__link:focus-visible) {
  outline: 2px solid #713a1b;
  outline-offset: 2px;
}

/* The pricing switch's portrait under a black wash that keeps the text at 4.5:1
   or better and lets 24% show at the right edge. Running low is a touch lighter
   than out of credits. */
.sidebar-notice__art {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
  background: #302124;
  pointer-events: none;
}

.sidebar-notice__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  opacity: var(--image-opacity);
  transition: opacity 400ms ease;
}

.sidebar-notice__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(0 0 0 / 0.74), rgb(0 0 0 / 0.68) 56%, rgb(0 0 0 / 0.42) 81%, rgb(0 0 0 / 0.24));
}

.sidebar-notice[data-tone="out"] .sidebar-notice__art::after {
  background: linear-gradient(110deg, rgb(0 0 0 / 0.62), rgb(0 0 0 / 0.67) 56%, rgb(0 0 0 / 0.4) 81%, rgb(0 0 0 / 0.24));
}

.sidebar-notice__link {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  padding: 14px;
  border-radius: inherit;
  color: inherit;
  text-decoration: none;
}

.sidebar-notice[data-tone="out"] .sidebar-notice__link {
  min-height: 198px;
}

.sidebar-notice__link:focus-visible {
  outline: none;
}

.sidebar-notice h2 {
  margin: 0;
  color: inherit;
  font: inherit;
  font-weight: 500;
  letter-spacing: -0.03em;
  text-wrap: pretty;
}

.sidebar-notice:has(.sidebar-notice__dismiss) h2 {
  padding-right: 24px;
}

.sidebar-notice__copy {
  max-width: 85%;
  margin: 4px 0 0;
  color: rgb(255 255 255 / 0.84);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sidebar-notice__link .btn-on-brand-fx {
  margin-top: 16px;
}

.sidebar-notice:is(:hover, :focus-within) .btn-on-brand-fx {
  background-color: rgb(255 255 255 / 0.2);
}

/* A 44px target with a 14px glyph set 15px from the top and right edges. */
.sidebar-notice__dismiss {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-notice__dismiss svg {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 14px;
  height: 14px;
  opacity: 0.5;
  transition: opacity 150ms ease;
}

.sidebar-notice__dismiss:hover svg,
.sidebar-notice__dismiss:focus-visible svg {
  opacity: 1;
}

.sidebar-notice__dismiss:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

/* Covers a card that is growing out of the strip, so it reads as the strip
   becoming the card. */
.sidebar-notice__cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: #cac4c1;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-notice__art img,
  .sidebar-notice__dismiss svg {
    transition: none;
  }
}

/* --- Subnav Header --- */

.subnav-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
}

.subnav-left {
  display: flex;
  flex: 0;
  align-items: center;
  justify-content: flex-start;
}

.subnav-middle {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}

.subnav-right {
  display: flex;
  flex: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Logo --- */

/* The logo as SHOWN. Same 112px square and 16px radius as the upload square
   (.dropzone-square), so the account page and its edit form present the same
   object at the same size. */
.logo-display {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: var(--radius-2xl);
  object-fit: cover;
  /* Plenty of logos are artwork on a white field, which would otherwise
     dissolve into the page. Same hairline the client directory rows use. */
  border: 1px solid var(--bone-300);
}

/* The initial fallback is already a dark block with its own hard edge, so the
   hairline would read as a seam rather than a boundary. */
.logo-display--initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--neutral-800);
  border-color: transparent;
  color: #ffffff;
  font-size: 36px;
  font-weight: 600;
}

/* --- Logo upload --- */

/* --- Content Header --- */

/* Mobile-first: tighter header stacking on phones; md restores 32px */
.content-header {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: flex-start;
}

.header-right {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.header-right .btn {
  align-self: auto;
}

/* Mobile: no breadcrumb. It was briefly reduced to a single back-one-level
   link, which is the documented pattern for a site whose only way up is the
   trail — not ours. Every page that needs one already carries shared/_back_button
   or a subnav hub link, both of them real 36px controls, and the page title
   says where you are; a third route up, set in the smallest type on the page,
   only competed with them. The trail returns at 768px. */
ul.breadcrumb {
  display: none;
}

/* Deliberate outlier from the app-wide 1.8 icon stroke: beside the 9px
   uppercase metadata labels (show-page stat strips), 1.8 reads too heavy —
   these go hairline. CSS stroke-width outranks the SVG attribute, so the
   markup can keep its standard 1.8 and stays consistent to copy-paste. */
.caps-label svg {
  stroke-width: 1.2;
}

.content-header-item a {
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.3s ease;
}

.content-header-item a:hover {
  color: var(--ink);
  transition: all 0.3s ease;
}

.header-tags {
  display: flex;
  gap: 4px;
  margin-top: -8px;
  margin-bottom: 24px;
}

/* --- Tag (atom, TA-859) ---
   24px tall, 9px uppercase at 1.4px tracking, 500, and a 1px line on every
   variant. .tag-sm (20px, 8px) is the one smaller size, for dense lists such
   as the tags under a project name; TA-1286 dropped the old 18px/7px one. Dark is the inverse surface, so it flips to white on ink
   with ink text; light is the raised surface; white (outline) is the sunk
   surface. Tones below override fill, line and text. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--inverse);
  border-radius: var(--radius-lg);
  background-color: var(--inverse);
  color: var(--inverse-fg);
  font-size: 9px;
  line-height: 12px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: all 0.3s ease;
}

/* Size modifier: add to .tag with any surface or tone. */
.tag-sm {
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-md);
  font-size: 8px;
}

.tag-light {
  background-color: var(--surface);
  border-color: var(--hairline);
  color: var(--ink-muted);
}

.tag-white {
  background-color: var(--sunk);
  border-color: var(--hairline);
  color: var(--ink-muted);
}

/* An exact identifier as its owner writes it (a Stripe field or event name,
   Integrations TA-1340): lower case kept, so no caps transform or tracking,
   and one step larger so lower case stays legible at tag height. */
.tag-literal {
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

/* Tooltip (TA-1644): a short description above a trigger, opened by
   tooltip_controller.js on hover, keyboard focus or tap. */
.tooltip {
  position: relative;
}

.tooltip-bubble {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: max-content;
  max-width: 16rem;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  background: var(--color-ink-900);
  color: var(--color-bone-50);
  font-size: 12px;
  line-height: 16px;
}

.tooltip-bubble[hidden] {
  display: none;
}

.tooltip-bubble-end {
  left: auto;
  right: 0;
}

/* Tag tones (TA-859). A tone sets the fill, line and text of the tag. Status tones read the status roles in tokens.css;
   neutral is the light tag recipe; brand is ink on the sunk surface with an
   orange-500 dot, the one place a tag carries the brand colour. */
/* A complete study's dot (studies/_state_dot): the status icon step of the
   green its Complete tag is drawn from. */
.state-dot-complete {
  color: var(--success);
}

.tag-success,
.tag-warning,
.tag-danger,
.tag-neutral,
.tag-brand {
  border-color: var(--tag-line);
  background-color: var(--tag-fill);
  color: var(--tag-text);
}

.tag-success {
  --tag-fill: var(--success-tint);
  --tag-line: var(--success-line);
  --tag-text: var(--success-text);
}

.tag-warning {
  --tag-fill: var(--warning-tint);
  --tag-line: var(--warning-line);
  --tag-text: var(--warning-text);
}

.tag-danger {
  --tag-fill: var(--danger-tint);
  --tag-line: var(--danger-line);
  --tag-text: var(--danger-text);
}

.tag-neutral {
  --tag-fill: var(--surface);
  --tag-line: var(--hairline);
  --tag-text: var(--ink-muted);
}

.tag-brand {
  --tag-fill: var(--sunk);
  --tag-line: var(--hairline);
  --tag-text: var(--ink-muted);
}

.tag-brand::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  corner-shape: round;
  background-color: var(--color-orange-500);
}

/* Aliases for tone names views already use but no stylesheet ever defined, so
   they rendered as the plain dark tag. Removed once the status sweep renames
   their call sites. */
.tag-green {
  --tag-fill: var(--success-tint);
  --tag-line: var(--success-line);
  --tag-text: var(--success-text);
}
.tag-yellow {
  --tag-fill: var(--warning-tint);
  --tag-line: var(--warning-line);
  --tag-text: var(--warning-text);
}
.tag-orange {
  --tag-fill: var(--sunk);
  --tag-line: var(--hairline);
  --tag-text: var(--ink-muted);
}
.tag-grey,
.tag-gray,
.tag-blue {
  --tag-fill: var(--surface);
  --tag-line: var(--hairline);
  --tag-text: var(--ink-muted);
}

.tag-green,
.tag-yellow,
.tag-orange,
.tag-grey,
.tag-gray,
.tag-blue {
  border-color: var(--tag-line);
  background-color: var(--tag-fill);
  color: var(--tag-text);
}

.client-status-banner {
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-2xl);
  padding: 10px 20px;
  text-align: center;
  line-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Main Content --- */

.list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* Mobile-first: rows run edge to edge; md restores the horizontal inset */
  padding: 12px 0;
  margin-bottom: -1px;
  width: 100%;
  color: var(--ink);
  transition: all 0.3s ease;
  border-top: 1px solid var(--bone-200);
  border-bottom: 1px solid var(--bone-200);
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}

.list-item:hover {
  background-color: var(--bone-75);
  color: var(--ink);
  border: 1px solid var(--bone-75);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

/* Row tiles (notification icons, avatar tiles) darken with the row so they
   don't blend into the bone-75 hover background. The transition lives here so
   every tile eases identically, matching .list-item's own hover timing. */
.list-item-tile {
  transition: background-color 0.3s ease;
}

.list-item:hover .list-item-tile {
  background-color: var(--bone-200);
}

/* Air between a cell's primary line and its secondary line. */
.list-item .body-sm {
  margin-top: 4px;
}

/* Unread marker: 8px orange dot on the tile's top-right corner. The 2px ring
   matches the surface behind it — white at rest, bone-75 on row hover — so
   the dot reads as punched out of the corner (box-sizing is border-box, so
   the 12px box nets an 8px orange core). */
.unread-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 9999px;
  corner-shape: round;
  background-color: var(--orange-600);
  border: 2px solid #ffffff;
  transition: border-color 0.3s ease;
}

.list-item:hover .unread-dot {
  border-color: var(--bone-75);
}

.list-item:has(+ .list-item:hover) {
  border-bottom-color: transparent;
}

.list-item:hover + .list-item {
  border-top-color: transparent;
}

/* TA-502 — client directory rows.

   The row IS the .list-item (it used to be a div wrapping a link, because the
   Switch button was a form). That means .list-item's own `flex-direction:
   column; align-items: flex-start` now governs the column layout and has to be
   turned back into a row here — Tailwind's `flex-row`/`items-center` cannot do
   it, because Tailwind v4 emits utilities inside `@layer utilities` and any
   layered rule loses to an unlayered one like .list-item, whatever the source
   order. Same reason the 12px inset lives here rather than as `px-3`.

   The inset matches .list-item's 12px vertical padding, so the logo sits the
   same distance from the left edge as from the top and bottom. */
.client-list .list-item {
  flex-direction: row;
  align-items: center;
  padding-left: 12px;
  padding-right: 12px;
}

/* Body text: .body is the 13px base (what body already sets, for resetting
   inside a component), .body-sm the 11px step for secondary lines — list
   sublines, cell secondary lines, quiet metadata. Size is unlayered so a
   text-* size class cannot fight it; colour defaults to ink at 64% in the
   components layer, so text-ink on the element makes it full strength. */
.body,
.body-sm {
  line-height: 1.5;
}

.body {
  font-size: 13px;
}

.body-sm {
  font-size: 11px;
}

/* Larger reading sizes for screens where the copy is the content (TA-1114:
   the brief chat sets every turn in .body-xl). Body weight and colour, a
   touch of tracking; one step smaller on phones, like the headings. */
.body-lg,
.body-xl {
  font-weight: 400;
  letter-spacing: -0.01em;
}

.body-lg {
  font-size: 15px;
  line-height: 22px;
}

.body-xl {
  font-size: 18px;
  line-height: 26px;
}

@media (min-width: 768px) {
  .body-lg {
    font-size: 16px;
    line-height: 24px;
  }

  .body-xl {
    font-size: 20px;
    line-height: 28px;
  }
}

@layer components {
  .body,
  .body-sm,
  .body-lg,
  .body-xl {
    color: var(--ink-muted);
  }
}

/* Pages and side panels keep five text sizes (TA-1286), so a lead paragraph
   there reads at body size. The brief chat's .body-xl sits outside both. */
:is(.content-card--summon, .chat-sidebar-content) .body-lg {
  font-size: 13px;
  line-height: 1.5;
}

/* The layout's main content surface: the white card that sits on the bone
   canvas between the side nav and the chat panel. A named surface, so the
   layout carries no colour utility. */
.content-card {
  background-color: var(--canvas);
}

/* ============================================================================
   Components (TA-859 foundations sweep)

   Colour lives here, not in the markup. Every value reads a semantic variable
   from tokens.css, so each component follows the ground it sits on
   (.on-white, .on-bone-100, .on-bone-300, .on-ink). Recipes are the Bone
   Palette artifact's. Unlayered like the rest of this file: they outrank
   Tailwind utilities, so do not add a colour, padding or weight utility to
   the element — pick the variant.
   ========================================================================= */

/* --- Card ---
   tone: raised fill, no line — content that is part of the page.
   line: sunk fill with the hairline — the default on a same-tone parent.
   status: the tint and line of a named state — needs a real justification
   before it is used (see /preview/components/cards).
   dashed: the "add another" placeholder.
   ink: the one thing on a page that outranks the rest.
   Add card-clickable for a card that opens something, card-selectable for a
   card that is chosen (.is-selected holds the chosen state). */
.card {
  display: block;
  border-radius: var(--radius-xl);
  padding: 16px;
  background-color: var(--sunk);
  border: 1px solid transparent;
  color: var(--ink);
  transition: all 0.3s ease;
}

.card-tone {
  background-color: var(--surface);
}

.card-line {
  background-color: var(--sunk);
  border-color: var(--hairline);
}

.card-status-success,
.card-status-warning,
.card-status-danger {
  background-color: var(--card-tint);
  border-color: var(--card-line);
}

.card-status-success {
  --card-tint: var(--success-tint);
  --card-line: var(--success-line);
  --card-strong: var(--success-strong);
  --card-icon: var(--success);
}
.card-status-warning {
  --card-tint: var(--warning-tint);
  --card-line: var(--warning-line);
  --card-strong: var(--warning-strong);
  --card-icon: var(--warning);
}
.card-status-danger {
  --card-tint: var(--danger-tint);
  --card-line: var(--danger-line);
  --card-strong: var(--danger-strong);
  --card-icon: var(--danger);
}

.card-status-success .card-title,
.card-status-warning .card-title,
.card-status-danger .card-title {
  color: var(--card-strong);
}

.card-status-success .card-icon,
.card-status-warning .card-icon,
.card-status-danger .card-icon {
  color: var(--card-icon);
}

.card-dashed {
  background-color: transparent;
  border: 1px dashed var(--hairline-hover);
  color: var(--ink-muted);
}

.card-ink {
  background-color: var(--inverse);
  border-color: var(--inverse);
  color: var(--inverse-fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.card-ink .card-title {
  color: var(--inverse-fg);
}

.card-ink .card-body,
.card-ink .card-eyebrow {
  color: var(--inverse-fg-muted);
}

.card-title {
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
}

.card-body {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.card-eyebrow {
  line-height: 16px;
  color: var(--ink-faint);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-1px);
}

.card-tone.card-clickable {
  border-color: var(--hairline);
}

.card-tone.card-clickable:hover {
  background-color: var(--surface-hover);
  border-color: var(--hairline-hover);
}

/* No raise shadow: the darker line is the interaction cue on every card. */
.card-line.card-clickable:hover {
  border-color: var(--hairline-hover);
}

.card-ink.card-clickable:hover {
  background-color: var(--inverse-hover);
  border-color: var(--inverse-hover);
}

.card-dashed.card-clickable:hover {
  border-color: var(--hairline-active);
  background-color: var(--hover);
  color: var(--ink);
}

.card-selectable {
  position: relative;
  cursor: pointer;
  border-color: var(--hairline);
}

.card-selectable:hover,
.card-selectable.is-selected,
.card-selectable:has(input:checked) {
  border-color: var(--hairline-hover);
  background-color: var(--hover);
}

.card-clickable:focus-visible,
.card-selectable:focus-visible,
.card-selectable:has(input:focus-visible) {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* --- Divider ---
   The one horizontal rule: 1px of the hairline token between two groups that
   would otherwise read as one. Works on <hr> or a <div>. .menu-divider and
   .message-content hr draw the same line with their own spacing. */
/* No margin here: spacing comes from the parent's gap or a my-* utility. */
.divider {
  display: block;
  height: 1px;
  border: none;
  background-color: var(--hairline);
}

/* The vertical twin, for items on one line. Stretches to the row's height. */
.divider-vertical {
  display: inline-block;
  align-self: stretch;
  width: 1px;
  min-height: 1em;
  background-color: var(--hairline);
}

/* --- Banner ---
   A full-width message: icon, title, body, and actions on the right so the
   banner stays one block tall. neutral is the information default: ink on
   the raised surface, because information is not a status. success, warning
   and danger take the status roles. No orange: a banner is never a promo.

   One next step makes the whole banner the link (.banner-clickable on an
   <a>), or a single action: a ghost button in the banner's own tone
   (btn-success-ghost, btn-warning-ghost, btn-danger-ghost, or btn-ghost on
   neutral), which fills with the tone on hover. 8px above and below; the left
   stays 12px so the icon lines up with the content around it, and the right
   drops to 4px beside an action because the button carries its own padding. */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-xl);
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 20px;
  background-color: var(--banner-fill, var(--surface-hover));
  border-color: var(--banner-line, transparent);
  color: var(--banner-text, var(--ink));
  transition: all 0.3s ease;
}

.banner:has(.banner-actions) {
  padding-right: 4px;
}

.banner-neutral {
  --banner-fill: var(--surface);
}

/* A banner that is itself the action (TA-1297's read-only notice). */
.banner-link {
  cursor: pointer;
}

.banner-link:hover {
  --banner-fill: var(--surface-hover);
}

.banner-success {
  --banner-fill: var(--success-tint);
  --banner-line: var(--success-line);
  --banner-text: var(--success-text);
  --banner-strong: var(--success-strong);
  --banner-icon: var(--success);
}
.banner-warning {
  --banner-fill: var(--warning-tint);
  --banner-line: var(--warning-line);
  --banner-text: var(--warning-text);
  --banner-strong: var(--warning-strong);
  --banner-icon: var(--warning);
}
.banner-danger {
  --banner-fill: var(--danger-tint);
  --banner-line: var(--danger-line);
  --banner-text: var(--danger-text);
  --banner-strong: var(--danger-strong);
  --banner-icon: var(--danger);
}

/* A 14px icon in a box one text line tall, so it sits on the title's line
   however many lines the body runs to. */
.banner-icon {
  width: 14px;
  height: 20px;
  flex: none;
  color: var(--banner-icon, var(--ink-muted));
}

.banner-content {
  flex: 1;
  min-width: 0;
}

.banner-title {
  font-weight: 400;
  color: var(--banner-strong, var(--ink));
}

.banner-body {
  color: var(--banner-text, var(--ink-muted));
}

.banner-neutral .banner-body {
  color: var(--ink-muted);
}

/* Right of the content, top-aligned. The -4px centres a 28px btn-sm on the
   title's 20px line. */
.banner-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin-top: -4px;
  margin-bottom: -4px;
  margin-left: auto;
}

/* On phones the actions drop below the text, lined up with it, so the text
   column isn't squeezed to a few words a line at 390px (TA-1286). */
@media (max-width: 639px) {
  .banner {
    flex-wrap: wrap;
  }

  .banner-actions {
    flex-basis: 100%;
    margin: 0 0 0 22px;
  }

  /* 22px is the icon and its gap; with no icon the action lines up with the text. */
  .banner:not(:has(.banner-icon)) .banner-actions {
    margin-left: 0;
  }
}

/* The pricing switch (shared/_price_switch, TA-1856): a banner on the visual
   language background with a two-sided control at its right. The track is a
   default button's size and corner (36px, 2xl) drawn as an outline in the
   note's colour;
   the selected side sits 5px inside it (1px line + 4px gap), so its corner is
   the track's minus that, snapped down the ladder (2xl -> lg). */
.price-switch {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  border-radius: var(--radius-xl);
  background-color: var(--inverse);
  color: var(--inverse-fg);
  cursor: pointer;
  user-select: none;
}

/* The image and the letter field stack in one grid cell behind the content,
   whatever position the engine gives its own elements. */
.price-switch-media {
  position: absolute;
  inset: 0;
  display: grid;
}

.price-switch-media > * {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.price-switch-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0 8px 16px;
  font-size: 13px;
}

.price-switch-title {
  font-weight: 500;
  letter-spacing: -0.03em;
}

.price-switch-note {
  font-size: 12px;
  color: var(--inverse-fg-muted);
}

/* Each line stays one line beside the control, so the banner keeps its height
   on every desktop width (Adam, 30 Nov); the copy is written to fit, and a
   narrow column clips it rather than growing. */
@media (min-width: 640px) {
  .price-switch-copy {
    min-width: 0;
  }

  .price-switch-title,
  .price-switch-note {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

.price-switch-track {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  height: 36px;
  margin-right: 10px;
  padding: 4px;
  border: 1px solid var(--inverse-fg-muted);
  border-radius: var(--radius-2xl);
  font-size: 13px;
  line-height: 16px;
}

.price-switch-side {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 12px;
  border-radius: var(--radius-lg);
  color: var(--inverse-fg);
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}

.price-switch:not(:has(input:checked)) [data-side="off"],
.price-switch:has(input:checked) [data-side="on"] {
  background-color: var(--inverse-fg);
  color: var(--ink);
}

.price-switch:has(input:focus-visible) .price-switch-track {
  outline: 2px solid var(--inverse-fg);
  outline-offset: 2px;
}

/* On phones the control drops under the text and splits the width evenly. */
@media (max-width: 639px) {
  .price-switch {
    flex-direction: column;
    gap: 0;
  }

  .price-switch-copy {
    padding: 12px 16px;
  }

  .price-switch-track {
    align-self: stretch;
    margin: 0 10px 10px;
  }

  .price-switch-side {
    flex: 1;
  }
}

/* ============================================
   Billing pages (TA-1916): the credits card, payment method and billing
   history rows. shared/billing/_credits, _payment_method, _billing_history.
   ============================================ */

/* One card, three columns: credit balance, used this month, and the plan or
   auto-renewing pack card on the visual language ground. Each column stacks
   the same way so the buttons line up along the bottom. */
.billing-credits {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 8px;
}

.billing-col {
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.billing-col + .billing-col {
  border-top: 1px solid var(--hairline);
}

@media (min-width: 768px) {
  .billing-credits {
    grid-template-columns: 1fr 1fr 1.15fr;
  }

  .billing-col + .billing-col {
    border-top: 0;
    border-left: 1px solid var(--hairline);
  }
}

.billing-label {
  color: var(--ink-faint);
  margin-bottom: 12px;
}

.billing-figure {
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.billing-figure-name {
  font-weight: 500;
}

.billing-offer-title {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.billing-unit {
  color: var(--ink-muted);
}

.billing-rows {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.billing-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 16px;
}

.billing-row svg {
  flex: none;
}

.billing-row-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--hairline-active);
  text-underline-offset: 3px;
  cursor: pointer;
}

.billing-row-link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.billing-actions {
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  gap: 8px;
}

@media (min-width: 768px) {
  .billing-actions {
    padding-top: 44px;
  }
}

/* The price switch's artwork behind the plan or pack card. */
.billing-feature {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  padding: 16px;
  border-radius: var(--radius-2xl);
}

.billing-feature .billing-label {
  color: var(--ink-muted);
}

.billing-feature-media {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: grid;
}

.billing-feature-media > * {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.billing-feature-media img {
  object-fit: cover;
}

/* Payment method and billing history rows: a 32px tile, then one line of
   columns. On a phone the second line (date, expiry) moves under the first. */
.billing-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 1fr 1fr 1fr minmax(88px, max-content);
  column-gap: 12px;
  align-items: center;
}

.list .list-item.billing-grid {
  display: grid;
}

.billing-head {
  padding: 0 16px 10px;
}

.billing-first {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.billing-two {
  min-width: 0;
}

.billing-end {
  display: flex;
  justify-content: flex-end;
  white-space: nowrap;
}

.billing-amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
  justify-self: end;
}

.billing-inline {
  display: none;
}

.billing-brand {
  width: 18px;
  height: auto;
  display: block;
  border-radius: var(--radius-xs);
  corner-shape: round;
}

@media (max-width: 767px) {
  .billing-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 2px;
  }

  .billing-first {
    grid-row: span 2;
  }

  .billing-two {
    display: flex;
    flex-direction: column;
  }

  .billing-desktop,
  .billing-head {
    display: none;
  }

  .billing-inline {
    display: block;
    font-size: 11px;
    color: var(--ink-muted);
  }

  .billing-amount,
  .billing-end {
    grid-column: 2;
  }
}

/* The whole banner is the link. At rest it carries a line (the neutral one
   gains the hairline); hover steps the fill and the line toward the tone, so
   the interaction reads before the copy. */
.banner-clickable {
  cursor: pointer;
  text-decoration: none;
  border-color: var(--banner-line, var(--hairline));
}

.banner-clickable:hover {
  background-color: color-mix(in srgb, var(--banner-fill, var(--surface-hover)), var(--banner-icon, var(--ink)) 8%);
  border-color: color-mix(in srgb, var(--banner-line, var(--hairline-hover)), var(--banner-icon, var(--ink)) 40%);
}

.banner-clickable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.empty-state-with-image {
  max-width: 600px;
  margin-inline: auto;
}

/* Centred by the page, then lifted a little from 768px so it sits just above
   the middle: up to 32px on a tall window and none below about 900px, where
   the centred block has no room above it to give. Every block is as tall as
   the longest one (title, three lines of body, buttons), so the image's top
   stays put when moving between pages whose copy is shorter. */
@media (min-width: 768px) {
  .empty-state-with-image {
    min-height: 576px;
    margin-top: clamp(-32px, calc(450px - 50dvh), 0px);
  }
}

.empty-state-image {
  position: relative;
  isolation: isolate;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius-3xl);
  /* Shown until the treated image draws, and for good without WebGL2. */
  background-color: var(--inverse);
}

.empty-state-image > cx-fx {
  position: absolute;
  inset: 0;
}

/* The website's frosted product-card frame (.frosted-card on
   customerinterviews_ai_website): a 4px frosted surround with a light 1px
   edge, painted outside the card's contour so the card keeps its own. */
.empty-state-frame {
  --frost-gap: 4px;
  position: absolute;
  /* The same gap above the card as beside it: 8% of the width, which is
     12% of the 3:2 image's height. */
  top: 12%;
  right: 8%;
  bottom: 0;
  left: 8%;
  z-index: 1;
  /* Hidden until the empty-state-feed controller plays it in, so Turbo's
     cached preview of the page shows nothing to replay. */
  opacity: 0;
}

/* On load the card fades in and rises into place while its content arrives. */
.empty-state-frame.is-rising {
  animation: empty-state-rise 1.2s cubic-bezier(0.22, 0.8, 0.24, 1) both;
}

.empty-state-frame.is-settled {
  opacity: 1;
}

@keyframes empty-state-rise {
  from {
    opacity: 0;
    transform: translateY(160px);
  }

  40% {
    opacity: 1;
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* The frosted edge's blur redraws a frame behind a moving card, so it fades
   in once the card has landed. */
.empty-state-frame.is-rising::before {
  animation: empty-state-edge 0.5s ease 1s both;
}

@keyframes empty-state-edge {
  from {
    opacity: 0;
  }
}

.empty-state-frame::before {
  content: "";
  position: absolute;
  inset: calc(-1 * (var(--frost-gap) + 1px));
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: var(--radius-frost) var(--radius-frost) 0 0;
  background: rgb(255 255 255 / 0.24);
  box-shadow: 0 4px 16px -2px rgb(41 37 35 / 0.18), 0 16px 32px -8px rgb(41 37 35 / 0.08);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.empty-state-frame > .empty-state-screen {
  inset: 0;
}

.empty-state-screen {
  position: absolute;
  top: 24%;
  right: 8%;
  bottom: 0;
  left: 8%;
  z-index: 1;
  overflow: hidden;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background-color: var(--color-bone-100);
  box-shadow: 0 1px 3px rgb(41 37 35 / 0.08);
}

/* The website's recipe for product UI on a treated image: a hairline and a
   faint inner shadow over the screen's edge, so its white keeps its shape
   against the white page instead of merging into it. */
.empty-state-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px var(--hairline),
    inset 0 0 24px color-mix(in srgb, var(--ink) 6%, transparent);
}

.empty-state-stage {
  display: block;
  width: 1280px;
  height: 800px;
  border: 0;
  transform: scale(var(--demo-scale, 0.5));
  transform-origin: top left;
  pointer-events: none;
}

.empty-state {
  position: relative;
  isolation: isolate;
  width: 100%;
}

/* The miniature inside .empty-state-screen: the page's own markup and classes
   with sample content, laid out at the ui-demo controller's desktop width and
   scaled as one picture, so it reads as a screenshot of the real page. Rows
   and cards arrive one by one, the way results land in the app. */
.empty-state-mock {
  width: 900px;
  padding: 32px 40px;
  background-color: var(--canvas);
  color: var(--ink);
  transform: scale(var(--demo-scale, 0.5));
  transform-origin: top left;
}

/* The miniature is the desktop page at any viewport, so the list rows keep
   their md layout on a phone too. */
.empty-state-mock .list-item {
  flex-direction: row;
  align-items: center;
  padding: 16px;
}

/* The older sketch (demo_style "simple"), kept for pages still being
   designed: a title and plain rows, drawn larger. */
.empty-state-mock--simple {
  width: 560px;
  padding: 28px;
  font-size: 14px;
}

.empty-state-mock-title {
  margin-bottom: 20px;
  font-size: var(--text-2xl);
  line-height: var(--text-2xl--line-height);
  font-weight: 500;
}

.empty-state-mock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--bone-200);
}

.empty-state-mock-row {
  animation: first-run-row 0.6s ease both;
}

.empty-state-mock-item.is-arriving {
  animation: first-run-row 0.7s ease both;
}

/* Sample content waiting its turn (empty-state-feed controller): a stack row
   takes no space until it arrives, a grid card holds its place unseen. */
.empty-state-mock-item.is-pending {
  display: none;
}

.empty-state-mock-item {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.empty-state-mock-item.is-waiting {
  opacity: 0;
  transform: translateY(8px);
}

.empty-state-mock-row:nth-child(2) { animation-delay: 0.3s; }
.empty-state-mock-row:nth-child(3) { animation-delay: 0.6s; }
.empty-state-mock-row:nth-child(4) { animation-delay: 0.9s; }
.empty-state-mock-row:nth-child(5) { animation-delay: 1.2s; }
.empty-state-mock-row:nth-child(n + 6) { animation-delay: 1.5s; }

@media (prefers-reduced-motion: reduce) {
  .empty-state-frame,
  .empty-state-frame::before,
  .empty-state-mock-item,
  .empty-state-mock-row {
    animation: none;
    transition: none;
  }
}

.empty-state-image {
  margin-bottom: 24px;
}

.empty-state-screen:has(.empty-state-mock) {
  background-color: var(--canvas);
}

/* Inside the miniature's frame (body.ui-demo): rows arrive one by one, the
   way results land in the app. */
.ui-demo .list-item {
  animation: first-run-row 0.6s ease both;
}
.ui-demo .list-item:nth-child(2) { animation-delay: 0.5s; }
.ui-demo .list-item:nth-child(3) { animation-delay: 1s; }
.ui-demo .list-item:nth-child(4) { animation-delay: 1.5s; }

@keyframes first-run-row {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-demo .list-item {
    animation: none;
  }
}

/* --- Meta row ---
   "Pain point · High · 75% confidence". The separator is drawn here, as the
   breadcrumb does, so markup never types a middle dot. */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.meta-row-item + .meta-row-item::before {
  content: "·";
  margin: 0 4px;
  color: var(--ink-faint);
}

.tile-sm,
.tile-md,
.tile-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background-color: var(--tile-fill, var(--surface));
  color: var(--tile-icon, var(--ink-muted));
}

.tile-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-lg);
}
.tile-md {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xl);
}
.tile-lg {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
}

.tile-ink {
  --tile-fill: var(--inverse);
  --tile-icon: var(--inverse-fg);
}

/* Avatar: a tile holding a person — the photo fills it, or the first initial
   sits in ink-muted when there is none. An inset hairline keeps a pale photo's
   edge on a pale ground. */
.tile-avatar {
  position: relative;
  overflow: hidden;
  font-weight: 500;
  line-height: 1;
  user-select: none;
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.tile-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A logo tile (Integrations, TA-1340): the image fills the tile and covers
   the avatar's inset hairline, so the line is drawn over the image instead
   and a white logo still reads as a tile on a white ground. White behind the
   image, so a transparent logo isn't tinted by the raised fill. */
.tile-logo {
  --tile-fill: #fff;
}

.tile-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--hairline-hover);
  pointer-events: none;
}

/* A bare mark rather than an app icon (the MCP guide, CUS-97): the vendor's
   file is only the mark, so it sits inside the tile with clear space round it
   instead of filling it. */
.tile-logo-mark img {
  inset: 22%;
  width: 56%;
  height: 56%;
  object-fit: contain;
}

.tile-sm.tile-avatar {
  font-size: 11px;
}

.tile-md.tile-avatar {
  font-size: 13px;
}

.tile-lg.tile-avatar {
  font-size: 16px;
}

/* --- Text link ---
   Primary is ink with a faint underline that goes solid on hover; secondary
   is muted and deepens to ink. */
/* --- Text link (atom) ---
   The artifact's recipe. Primary is ink with a faint underline; hover deepens
   the text one step (the primary button's darkest line: ink-900 on light
   grounds, white on ink) and the underline goes solid. Secondary is ink at 64%
   and goes to full ink. The same classes on a <button> make a text button. */
.text-link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--hairline-active);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.text-link:hover {
  color: var(--primary-hover-line);
  text-decoration-color: currentColor;
}

.text-link:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.text-link-secondary {
  color: var(--ink-muted);
  text-decoration-color: var(--hairline-hover);
}

.text-link-secondary:hover {
  color: var(--ink);
}

button.text-link {
  padding: 0;
  font: inherit;
  background: none;
  border: 0;
}

/* --- Tone ---
   Status colour on a single line of text or an SVG drawn in currentColor
   (the sentiment gauge, a prototype check result). */
.tone-success {
  color: var(--success-text);
}
.tone-warning {
  color: var(--warning-text);
}
.tone-danger {
  color: var(--danger-text);
}
.tone-muted {
  color: var(--ink-muted);
}

/* --- Dropdown menu (molecule) ---
   The artifact's menu: the menu surface, a hairline, the raise shadow and 4px
   of padding, so a 32px item's 8px corner nests inside the 12px menu corner.
   Position it with utilities (absolute, right-0, top-full, mt-1, z-*). */
.menu {
  min-width: 240px;
  padding: 4px;
  background-color: var(--menu);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  box-shadow: var(--elevation-raise);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  color: var(--ink-muted);
  background: none;
  border: 0;
  border-radius: var(--radius-lg);
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.menu-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-faint);
}

.menu-item kbd {
  margin-left: auto;
}

/* .is-active is the arrow-key equivalent of hover. */
.menu-item:hover,
.menu-item:focus-visible,
.menu-item.is-active {
  color: var(--ink);
  background-color: var(--surface-hover);
}

.menu-item-danger,
.menu-item-danger svg {
  color: var(--danger-text);
}

.menu-item-danger:hover,
.menu-item-danger:focus-visible,
.menu-item-danger.is-active {
  color: var(--danger-strong);
  background-color: var(--danger-tint);
}

.menu-item:disabled,
.menu-item[aria-disabled="true"] {
  color: var(--ink-disabled);
  background: none;
  cursor: not-allowed;
}

.menu-label {
  padding: 8px 12px 4px;
}

/* .divider inset to the menu's item padding. */
.menu-divider {
  height: 1px;
  margin: 4px 8px;
  background-color: var(--hairline);
}

/* button_to wraps each item in a form; let it fill the menu width. */
.menu form {
  display: block;
  width: 100%;
}

/* --- Meter ---
   Progress and level bars: the track and fill tokens, and the two speaker
   states for the voice call. */
.meter {
  height: 4px;
  border-radius: 999px;
  corner-shape: round;
  background-color: var(--track);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background-color: var(--fill);
  transition: width 0.3s ease;
}

.meter-bar {
  background-color: var(--hairline-active);
}

.meter-bar.is-speaking-user {
  background-color: var(--ink);
}

.meter-bar.is-speaking-assistant {
  background-color: var(--color-orange-500);
}

/* --- Runtime states ---
   The classes Stimulus controllers toggle, so a controller swaps a state name
   rather than a colour. */
/* --- Segmented control (atom) ---
   The app's tabs: a 36px track on the raised surface with a 1px line, 4px
   inset, and 28px items. The chosen tab (aria-current="page" on a link,
   aria-pressed on a button, or .is-active) takes the current surface and the
   line. Every value is a semantic token, so it follows the ground. Used for
   page tabs (Plan / Recruit / Conduct / Analyse), in-page panels and the
   call/chat mode switcher — this is the app's only tab UI. */
.tabs {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 4px;
  gap: 4px;
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 28px;
  padding: 4px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background-color: transparent;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.tab:hover {
  background-color: var(--hover);
  color: var(--ink);
}

.tab.is-active,
.tab[aria-pressed="true"],
.tab[aria-selected="true"],
.tab[aria-current="page"] {
  background-color: var(--current);
  color: var(--color-orange-500);
  box-shadow: none;
}

.tab:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Mobile form: three or more tabs are a button and a menu on a phone, the bar
   from 768px up. Two tabs stay a bar at every width — two short labels fit.
   Both forms come from one list (shared/_tabs), so they cannot drift. */
.tabs-group {
  position: relative;
}

.tabs-collapses {
  display: none;
}

.tabs-menu .menu-item[aria-current="page"],
.tabs-menu .menu-item[aria-pressed="true"] {
  color: var(--color-orange-500);
  background-color: var(--surface);
}

@media (min-width: 768px) {
  .tabs-collapses {
    display: inline-flex;
  }

  .tabs-menu {
    display: none;
  }
}

/* --- Underline tabs (TA-1440, shared/_underline_tabs) ---
   Plain text tabs (links, or buttons that switch a panel in place) in a row
   above a .divider line, with no space above them. Unselected tabs are
   ink-muted and move to ink on hover; the current tab is ink with a 2px ink
   line lying on the divider. The list overlaps that divider by 1px so the line
   covers it, and scrolls sideways on a phone rather than wrapping.
   .underline-tabs-sm is the smaller row for inside a card. The line morphs
   between tabs through a view transition (Turbo visits) and the
   underline-tabs controller (clicks); both stand still under
   prefers-reduced-motion. */
.underline-tabs-list {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  margin-bottom: -1px;
  overflow-x: auto;
  scrollbar-width: none;
}

.underline-tabs-list::-webkit-scrollbar {
  display: none;
}

.underline-tab {
  position: relative;
  display: block;
  padding: 0 0 12px;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
  white-space: nowrap;
  outline: none;
  cursor: pointer;
  transition: color 200ms ease;
}

.underline-tab:hover,
.underline-tab[aria-current="page"],
.underline-tab[aria-pressed="true"] {
  color: var(--ink);
}

.underline-tabs-sm .underline-tabs-list {
  gap: 16px;
}

.underline-tabs-sm .underline-tab {
  padding-bottom: 8px;
  font-size: 12px;
  line-height: 16px;
}

.underline-tab:focus-visible {
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.underline-tab-line {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background-color: var(--ink);
  transform-origin: left center;
  view-transition-class: underline-tab-line;
}

::view-transition-group(*.underline-tab-line) {
  animation-duration: 200ms;
  animation-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  .underline-tab {
    transition: none;
  }

  ::view-transition-group(*.underline-tab-line) {
    animation: none;
  }
}


.screener-pill.is-selected {
  background-color: var(--current);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hairline-active);
}

.choice-button.is-selected {
  border-color: var(--hairline-active);
  background-color: var(--hover);
  color: var(--ink);
}

.is-highlighted {
  border-radius: 0;
  box-shadow: inset 2px 0 0 var(--ink);
  transition: box-shadow 0.3s ease;
}

.key-value-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.key-value-content span {
  color: var(--ink-muted);
  font-size: 12px;
  display: block;
  padding-bottom: 4px;
}

/* --- Input (atom, TA-859) ---
   The artifact's recipe: 36px on the raised surface with a hairline, the line
   darkens on hover, and focus lifts the field to the ground's top surface with
   an ink/55 line and a soft 3px ring. Every value comes from tokens.css, so a
   field follows its ground. .input-lg is the 44px size that sits beside
   .btn-lg (sign-in and sign-up). */

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
  outline: none;
  transition: all 0.3s ease;
  appearance: none;
}

/* Height comes from rows, not a minimum: this stylesheet is unlayered, so a
   min-height here would beat the one-row chat composers' own min-h. */
textarea {
  height: auto;
  padding: 8px 12px;
}

/* The browser's clear button on a search field is a blue cross in Safari and
   Chrome. Redraw it as the 1.8-stroke X the ghost close buttons use, masked
   so it takes ink-muted and follows the ground. */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  cursor: pointer;
  background-color: var(--ink-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 18 18 6M6 6l12 12'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 18 18 6M6 6l12 12'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}

input[type="search"]::-webkit-search-cancel-button:hover {
  background-color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
  border-color: var(--hairline-hover);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  background-color: var(--field-focus);
  border-color: var(--field-focus-line);
  box-shadow: 0 0 0 3px var(--field-focus-ring);
}

/* Copy block (shared/_copy_block, CUS-97): a value to paste elsewhere, drawn
   as a read-only input. The input's fill, hairline, radius and padding, mono
   text, and the copy icon inside on the right (top right for a multi-line
   block). The whole block is the button; .is-copied swaps the icon for a
   tick. */
.copy-block {
  position: relative;
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 7px 40px 7px 12px;
  font-size: 12px;
  line-height: 20px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.copy-block:hover {
  border-color: var(--hairline-hover);
}

.copy-block:focus-visible {
  outline: none;
  border-color: var(--field-focus-line);
  box-shadow: 0 0 0 3px var(--field-focus-ring);
}

/* fit: true. As wide as the value plus the icon's room, capped at the
   container so a long value still wraps on a phone. */
.copy-block-fit {
  width: fit-content;
  max-width: 100%;
}

.copy-block-value {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
}

.copy-block-multiline .copy-block-value {
  overflow-x: auto;
  white-space: pre;
}

.copy-block-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  display: flex;
  color: var(--ink-muted);
  transform: translateY(-50%);
}

.copy-block-multiline .copy-block-icon {
  top: 10px;
  transform: none;
}

.copy-block:hover .copy-block-icon {
  color: var(--ink);
}

.copy-block-icon svg {
  width: 16px;
  height: 16px;
}

.copy-block-done,
.copy-block.is-copied .copy-block-copy {
  display: none;
}

.copy-block.is-copied .copy-block-done {
  display: block;
}

/* A field in error is all shades of red, like .banner-danger: the tint as the
   fill, the line as the border, the strong step for the text. Mark the field
   aria-invalid="true" (screen readers announce it too) or .is-invalid, the
   name the onboarding forms and the phone input already use; Rails' default
   .field_with_errors wrapper gets the same look. Hover and focus step the
   border to the danger colour and focus keeps the fill, so the error stays
   visible while it is fixed. .is-valid is the same recipe in green (rare). */
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"],
input.is-invalid,
textarea.is-invalid,
select.is-invalid,
.field_with_errors input,
.field_with_errors textarea,
.field_with_errors select {
  color: var(--danger-strong);
  background-color: var(--danger-tint);
  border-color: var(--danger-line);
}

input[aria-invalid="true"]::placeholder,
textarea[aria-invalid="true"]::placeholder,
input.is-invalid::placeholder,
textarea.is-invalid::placeholder {
  color: var(--danger-text);
  opacity: 0.6;
}

input[aria-invalid="true"]:hover,
textarea[aria-invalid="true"]:hover,
select[aria-invalid="true"]:hover,
input.is-invalid:hover,
textarea.is-invalid:hover,
select.is-invalid:hover,
.field_with_errors input:hover,
.field_with_errors textarea:hover,
.field_with_errors select:hover,
input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus,
input.is-invalid:focus,
textarea.is-invalid:focus,
select.is-invalid:focus,
.field_with_errors input:focus,
.field_with_errors textarea:focus,
.field_with_errors select:focus {
  background-color: var(--danger-tint);
  border-color: var(--danger);
}

input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus,
input.is-invalid:focus,
textarea.is-invalid:focus,
select.is-invalid:focus,
.field_with_errors input:focus,
.field_with_errors textarea:focus,
.field_with_errors select:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent);
}

input.is-valid,
textarea.is-valid,
select.is-valid {
  color: var(--success-strong);
  background-color: var(--success-tint);
  border-color: var(--success-line);
}

input.is-valid:hover,
textarea.is-valid:hover,
select.is-valid:hover,
input.is-valid:focus,
textarea.is-valid:focus,
select.is-valid:focus {
  background-color: var(--success-tint);
  border-color: var(--success);
}

input.is-valid:focus,
textarea.is-valid:focus,
select.is-valid:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 15%, transparent);
}

/* Chevron drawn in ink at 64%; the ink ground swaps it for white. */
select {
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23292523' stroke-opacity='.64' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}

.on-ink select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='.64' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
}

/* Disabled: the field keeps its surface and line, and its value drops to
   ink-disabled so it reads as locked rather than as a placeholder. Safari
   paints disabled text with its own colour and opacity, hence the fill colour
   and opacity reset. Buttons are not fields: a submit input keeps the button
   disabled state above (TA-1156), or its label vanished into the dark fill. */
input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"]):disabled,
textarea:disabled,
select:disabled {
  color: var(--ink-disabled);
  -webkit-text-fill-color: var(--ink-disabled);
  opacity: 1;
  cursor: not-allowed;
}

input:disabled::placeholder,
textarea:disabled::placeholder {
  color: var(--ink-disabled);
  -webkit-text-fill-color: var(--ink-disabled);
}

/* The label of a disabled field drops to ink-faint, matching a disabled
   checkbox or toggle label. Covers a label directly before the field and a
   label inside a .form-field that holds one. A disabled submit button is
   not a field: a consent tick's label sits right before the Connect button
   the tick gates, and must not fade while it waits to be ticked. */
label:has(+ input:not([type="submit"], [type="button"]):disabled, + select:disabled, + textarea:disabled),
.form-field:has(input:not([type="checkbox"], [type="radio"]):disabled, select:disabled, textarea:disabled) > label {
  color: var(--ink-faint);
}

/* Large: the .btn-lg height and 15px text, one corner step up per the corners
   rule. Below 16px, iOS Safari zooms the page when the field takes focus. */
input.input-lg,
select.input-lg,
textarea.input-lg {
  height: 44px;
  padding: 0 16px;
  font-size: 15px;
  line-height: 24px;
  border-radius: var(--radius-xl);
}

textarea.input-lg {
  height: auto;
  padding: 12px 16px;
}

select.input-lg {
  padding-right: 44px;
  background-position: right 16px center;
  background-size: 16px 16px;
}

/* A field is as wide as the text it holds, not as wide as the page: past about
   60 characters the eye loses the line, and a full-width box makes a short
   answer look like a long one. 480px is the cap everywhere; the surfaces that
   genuinely need the room — search bars and the chat composers — opt out. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
select,
.form-field textarea,
.money-field {
  max-width: 480px;
}

input[type="search"],
input.search-input,
.chat-input-area textarea,
.form-field textarea.w-full {
  max-width: none;
}

/* --- Chat composer ---
   Every chat input: a one-row textarea that grows with its content, with the
   28px send button inside its top-right corner. Enter sends, Shift+Enter
   breaks the line (message-form, interview-chat and brief-interview-chat
   controllers). Partial: shared/_chat_composer; the participant interview
   draws the same markup without a form builder. */
.chat-composer {
  position: relative;
}

.chat-composer textarea {
  field-sizing: content;
  width: 100%;
  max-width: none;
  min-height: 48px;
  max-height: 400px;
  padding: 13px 48px 13px 16px;
  border-radius: var(--radius-2xl);
  resize: none;
}

.chat-composer-send {
  position: absolute;
  top: 10px;
  right: 10px;
}

.form-field {
  margin-bottom: 24px;
}

/* --- Tag field (draft, TA-859) ---
   The chips sit above; below them either a ghost "Add tag" button or, once
   that is clicked, an ordinary text input with the menu recipe under it: focus
   lists every tag already used, typing filters, Enter adds what you typed and
   a row adds that tag. The input clears and keeps focus, so several tags go on
   in a row. Not wired up yet — the list, filtering and adding come from a
   controller and a tenant-scoped suggestions endpoint. */
.tag-field {
  position: relative;
  width: 100%;
}

.tag-field-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

/* The open field: the input with a close button beside it. */
.tag-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-field-row[hidden] {
  display: none;
}

/* Holds the input and its menu, so the menu is exactly as wide as the input. */
.tag-field-control {
  position: relative;
  flex: 1;
  max-width: 480px;
}

/* Show and edit are two states, not one: at rest the tags are just tags, and
   the cross takes no room and no clicks. Editing (.is-editing, set while the
   field is open) widens the crosses into place and the chips grow around them.
   The negative margin cancels the chip's own gap while they are collapsed. */
.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0;
  margin-right: -4px;
  overflow: hidden;
  color: inherit;
  background: none;
  border: 0;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition:
    width 0.3s ease,
    margin 0.3s ease,
    opacity 0.3s ease;
}

.is-editing .tag-remove {
  width: 10px;
  margin-right: -2px;
  opacity: 0.64;
  pointer-events: auto;
}

.tag-remove svg {
  width: 10px;
  height: 10px;
  flex: none;
}

.is-editing .tag-remove:hover,
.is-editing .tag-remove:focus-visible {
  opacity: 1;
}

/* The trigger: a caps label beside the chips, not a button shape — adding a
   tag is a quiet action next to the tags it belongs to. Put .caps-label on it
   too, so it follows the one label rule. */
/* button.text-link (font: inherit) outranks a bare class, hence the element in
   the selector: the trigger reads as a label beside the tags, so it keeps
   their size rather than the 13px body size. */
button.tag-add {
  padding: 0 8px;
  margin-left: 4px;
  font-size: 9px;
  line-height: 16px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  background: none;
  border: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* While editing, the trigger is gone whatever the server re-renders — the
   chips come back fresh after every add or remove. */
.is-editing .tag-add {
  display: none;
}

.tag-add:hover,
.tag-add:focus-visible {
  color: var(--ink);
}

.tag-add:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* The list reads as the tags it offers: same 9px uppercase with 1.4px tracking
   as .tag, whatever case the name is stored in. */
.tag-field-menu .menu-item {
  font-size: 9px;
  line-height: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

/* The suggestions, on the menu recipe, pinned under the input. */
.tag-field-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  min-width: 0;
  max-height: 240px;
  overflow-y: auto;
}

.tag-field-menu[hidden] {
  display: none;
}

/* The row that creates what you typed; it sits last, after a divider. */
.menu-item-add strong {
  font-weight: 400;
  color: var(--ink);
}

.tag-field-empty {
  padding: 8px 12px;
  font-size: 11px;
  line-height: 16px;
  color: var(--ink-faint);
}

/* --- Dropzone (draft, TA-859) ---
   The file upload, in the secondary button's colours with a dashed line:
   raised surface, hairline, muted text, all a step stronger on hover and while
   a file is dragged over it. Four sizes:
     .dropzone-icon    36px square, icon only (a row action)
     .dropzone-sm      full width, one line: icon and label
     .dropzone         full width, stacked: icon, title and hint
     .dropzone-square  112px square, for a logo or photo
   Markup is a <label> wrapping a visually hidden <input type="file">, so a
   click opens the picker with no JS; drag and drop and the chosen-file state
   come from a controller when this is wired up. */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 120px;
  margin: 0;
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
  background-color: var(--surface);
  border: 1px dashed var(--hairline-hover);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.3s ease;
}

.dropzone input[type="file"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.dropzone:hover,
.dropzone.is-dragover {
  color: var(--ink);
  background-color: var(--surface-hover);
  border-color: var(--hairline-active);
}

.dropzone:has(input:focus-visible) {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.dropzone:has(input:disabled) {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.dropzone svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.dropzone-title {
  font-size: 13px;
  line-height: 20px;
  color: var(--ink);
}

.dropzone-hint {
  font-size: 11px;
  line-height: 16px;
  color: var(--ink-faint);
}

/* A row of file-kind icons above the title, for a zone that takes several. */
.dropzone-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-faint);
}

/* One line: icon then label. */
.dropzone-sm {
  flex-direction: row;
  gap: 8px;
  padding: 0 16px;
  min-height: 0;
  height: 36px;
  border-radius: var(--radius-lg);
}

.dropzone-sm svg {
  width: 14px;
  height: 14px;
}

/* Icon only, square at the control height. */
.dropzone-icon {
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: var(--radius-lg);
}

.dropzone-icon svg {
  width: 14px;
  height: 14px;
}

/* The logo or photo square: the picked image fills it. */
.dropzone-square {
  width: 112px;
  height: 112px;
  min-height: 0;
  padding: 8px;
  overflow: hidden;
  border-radius: var(--radius-2xl);
}

.dropzone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

/* The picture sits over the upload prompt, so hovering (or focusing) the
   square fades it out and shows what a click will do: replace it. */
.dropzone-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.dropzone-square:hover .dropzone-image,
.dropzone-square:has(input:focus-visible) .dropzone-image {
  opacity: 0;
}

/* Chosen but not yet saved: the file sits under the zone with its size and a
   remove button, so the form still says what will be uploaded. While it is
   uploading the size is replaced by the percentage. */
.dropzone-file {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 12px;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}

.dropzone-file svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-faint);
}

.dropzone-file .dropzone-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-file .dropzone-file-size {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* --- Money field (draft, TA-859) ---
   The currency sign sits inside the field, so the amount lines up with every
   other input. No spinner: the arrows differ per browser and are too small to
   aim at. */
.money-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.money-field .money-symbol {
  position: absolute;
  left: 12px;
  color: var(--ink-muted);
  pointer-events: none;
}

.money-field input {
  padding-left: 28px;
  font-variant-numeric: tabular-nums;
}

.money-field input::-webkit-outer-spin-button,
.money-field input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.money-field input[type="number"] {
  appearance: textfield;
}

.money-field .input-lg {
  padding-left: 36px;
}

.money-field:has(.input-lg) .money-symbol {
  left: 16px;
}

/* --- Date picker (molecule on the input atom, TA-859) ---
   The artifact's picker: the input recipe with a 28px calendar button inside
   the right edge, and a panel that floats below on the menu recipe. Three
   kinds, set by date_picker_controller: date, datetime (adds a time column,
   past days closed with min) and range (two months, presets, Cancel/Apply).
   The text stays typeable; the placeholder shows the format. */
.date-picker {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.date-picker input[type="text"] {
  padding-right: 40px;
}

.date-picker-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.date-picker-toggle svg {
  width: 14px;
  height: 14px;
}

.date-picker-toggle:hover,
.date-picker-toggle:focus-visible {
  color: var(--ink);
  background-color: var(--hover);
  border-color: var(--hairline-hover);
}

.date-picker-toggle:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* While open, the field takes the focus treatment so the panel reads as its. */
.date-picker.is-open input[type="text"] {
  background-color: var(--field-focus);
  border-color: var(--field-focus-line);
  box-shadow: 0 0 0 3px var(--field-focus-ring);
}

.date-picker.is-open .date-picker-toggle {
  color: var(--ink);
  background-color: var(--surface-hover);
  border-color: var(--hairline-hover);
}

.date-picker-panel {
  position: absolute;
  top: 44px;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 12px;
  background-color: var(--menu);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  box-shadow: var(--elevation-raise);
}

.date-picker-panel[hidden] {
  display: none;
}

/* Near the right edge of the page, right-align the panel to the field. */
.date-picker-end .date-picker-panel {
  left: auto;
  right: 0;
}

.date-picker-body {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.date-picker-month {
  display: flex;
  flex-direction: column;
}

.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 28px;
  margin-bottom: 8px;
}

.date-picker-title {
  padding: 0 4px;
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
}

.date-picker-nav {
  display: flex;
  gap: 4px;
}

.date-picker-nav button,
.date-picker-day,
.date-picker-time,
.date-picker-preset {
  font: inherit;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.date-picker-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--ink-muted);
  border-radius: var(--radius-md);
}

.date-picker-nav svg {
  width: 14px;
  height: 14px;
}

.date-picker-nav button:hover {
  color: var(--ink);
  background-color: var(--hover);
  border-color: var(--hairline-hover);
}

.date-picker-nav button:disabled {
  color: var(--ink-disabled);
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 32px);
}

.date-picker-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  color: var(--ink-faint);
}

/* A day cell: the ::before paints the range band edge to edge, the span is
   the 32px chip on top of it. */
.date-picker-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.date-picker-day::before {
  content: "";
  position: absolute;
  inset: 0;
}

.date-picker-day span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px transparent;
  transition: all 0.3s ease;
}

.date-picker-day:hover span {
  background-color: var(--hover);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.date-picker-day:focus-visible span {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.date-picker-day.is-today span {
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--hairline-active);
}

.date-picker-day.is-outside,
.date-picker-day.is-closed {
  pointer-events: none;
  cursor: default;
}

.date-picker-day.is-outside span,
.date-picker-day.is-closed span {
  color: var(--ink-disabled);
}

.date-picker-day.is-closed span {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.date-picker-day.is-in-range::before {
  background-color: var(--surface);
}

.date-picker-day.is-range-start::before {
  left: 50%;
}

.date-picker-day.is-range-end::before {
  right: 50%;
}

.date-picker-day.is-selected span,
.date-picker-day.is-selected:hover span {
  color: var(--primary-fg);
  background-color: var(--primary);
  box-shadow: none;
}

.date-picker-times {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 96px;
  max-height: 248px;
  padding-left: 12px;
  overflow-y: auto;
  border-left: 1px solid var(--hairline);
}

.date-picker-time,
.date-picker-preset {
  flex: none;
  height: 28px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 20px;
  text-align: left;
  color: var(--ink-muted);
  border-radius: var(--radius-md);
  font-variant-numeric: tabular-nums;
}

.date-picker-time:hover,
.date-picker-preset:hover {
  color: var(--ink);
  background-color: var(--hover);
  border-color: var(--hairline);
}

.date-picker-time[aria-selected="true"] {
  color: var(--primary-fg);
  background-color: var(--primary);
  border-color: var(--primary);
}

.date-picker-presets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 132px;
  padding-right: 12px;
  border-right: 1px solid var(--hairline);
}

.date-picker-preset[aria-pressed="true"] {
  color: var(--ink);
  background-color: var(--surface);
  border-color: var(--hairline);
}

.date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.date-picker-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Icon field: the 14px icon sits 12px in, text starts after it. */
input.search-input {
  padding-left: 36px;
}

/* Search input container. Width comes from the page's own wrapper — the old
   collapse-to-200px + expand-on-focus behaviour (and its per-page opt-outs)
   is gone: search inputs are always their full slot width. */
.search-input-container {
  position: relative;
  width: 100%;
}

/* Mobile search overlay morph (class added by mobile_search_controller):
   the field starts as a 36px square exactly where the search button sat —
   the button appears to BECOME the input — then grows rightward. The X
   follows once the field lands; closing reverses the order (X first, then
   the field shrinks back into a square). */
@media (max-width: 767.98px) {
  .mobile-search-overlay .search-input-container {
    width: 36px;
    overflow: hidden;
    /* close: field shrinks after the X has gone */
    transition: width 0.2s cubic-bezier(0.4, 0, 1, 1) 0.05s;
  }

  .mobile-search-overlay .mobile-icon-btn {
    opacity: 0;
    transform: scale(0.8);
    /* close: X leaves first, no delay */
    transition:
      opacity 0.12s ease-in,
      transform 0.12s ease-in;
  }

  .mobile-search-overlay--open .search-input-container {
    width: 100%;
    /* open: field grows first */
    transition: width 0.24s cubic-bezier(0, 0, 0.2, 1);
  }

  .mobile-search-overlay--open .mobile-icon-btn {
    opacity: 1;
    transform: scale(1);
    /* open: X arrives once the field has landed */
    transition:
      opacity 0.15s ease-out 0.18s,
      transform 0.15s ease-out 0.18s;
  }

  @media (prefers-reduced-motion: reduce) {
    .mobile-search-overlay .search-input-container,
    .mobile-search-overlay .mobile-icon-btn {
      transition: none;
    }
  }
}

/* Phone input styling - intl-tel-input integration */
.phone-input-container {
  position: relative;
}

.phone-input-container .iti {
  width: 100%;
}

.phone-input-container .iti__input {
  padding-left: 52px !important;
  padding-right: 88px !important;
}

/* Country dropdown styling */
.phone-input-container .iti__country-list {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  box-shadow: var(--elevation-raise);
}

.phone-input-container .iti__selected-country {
  padding: 0 8px;
}

/* Error state styling */
.phone-input-container .iti__input.border-red-300 {
  border-color: #fca5a5 !important;
}

.phone-input-container .iti__input.border-green-300 {
  border-color: #86efac !important;
}

/* The names phone_input_controller moves to in the status sweep; the two
   rules above go in the same commit as that rename. */
.phone-input-container .iti__input.is-valid {
  border-color: var(--success-line);
}

.phone-input-container .iti__input.is-invalid {
  border-color: var(--danger-line);
  color: var(--danger-strong);
}

.pagination {
  background-color: var(--bone-100);
  border-radius: var(--radius-xl);
  padding: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.page a {
  height: 28px;
  width: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--ink-muted);
  transition: all 0.3s ease;
  border-radius: var(--radius-lg);
}

.page a:hover {
  color: var(--orange-600);
  background-color: var(--bone-50);
  border-radius: var(--radius-lg);
}

.page.current {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  color: var(--orange-600);
  height: 28px;
  width: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.page.gap {
  background-color: var(--bone-100);
  color: var(--ink-muted);
  height: 28px;
  width: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.study-guide-content h1,
.study-guide-content h2,
.study-guide-content h3,
.study-guide-content h4,
.study-guide-content h5,
.study-guide-content h6 {
  color: var(--ink);
  padding-bottom: 4px;
  font-size: 16px;
}

.study-guide-content p {
  padding-bottom: 16px;
}

.study-guide-content:last-child {
  padding-bottom: 0;
}

.content-paragraphs p {
  margin-bottom: 8px;
}

.question-prompt p {
  line-height: 16px;
  margin-bottom: 4px;
}

.simple_format p {
  margin-bottom: 8px;
}

.block-prompt p {
  margin-bottom: 8px;
}

/* Message content - comprehensive markdown styling. One body line-height
   app-wide (1.5) and the page heading ramp, so chat prose matches the page. */
.message-content {
  line-height: 1.5;
  color: var(--ink-muted);
}

.message-content p {
  margin-bottom: 16px;
  color: var(--ink-muted);
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Headings: the page ramp (md sizes, weight 600, -0.03em), never 700 */
.message-content h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  margin-top: 24px;
  color: var(--ink);
}

.message-content h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  margin-top: 20px;
  color: var(--ink);
}

.message-content h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 26px;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  margin-top: 16px;
  color: var(--ink);
}

.message-content h4 {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  margin-top: 16px;
  color: var(--ink);
}

.message-content h5,
.message-content h6 {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  margin-top: 12px;
  color: var(--ink);
}

/* Lists */
.message-content ul,
.message-content ol {
  margin-bottom: 24px;
  padding-left: 18px;
}

.message-content li {
  margin-bottom: 12px;
  color: var(--ink-muted);
}

.message-content li:last-child {
  margin-bottom: 0;
}

.message-content ul li {
  list-style-type: disc;
}

.message-content ol li {
  list-style-type: decimal;
}

.message-content ul ul,
.message-content ol ol,
.message-content ul ol,
.message-content ol ul {
  margin-top: -4px;
  margin-bottom: 20px;
}

/* Code */
.message-content code {
  background-color: var(--bone-100);
  color: #dc2626; /* text-red-600 */
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family:
    "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New",
    monospace;
  font-size: 12px;
}

.message-content pre {
  background-color: var(--bone-100);
  border: 1px solid var(--bone-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: auto;
  font-family:
    "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New",
    monospace;
  font-size: 12px;
  line-height: 1.4;
}

.message-content pre code {
  background: none;
  color: var(--ink);
  padding: 0;
  border-radius: 0;
}

/* Blockquotes */
.message-content blockquote {
  border-left: 4px solid var(--orange-600);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--ink-muted);
  font-style: italic;
}

.message-content blockquote p {
  margin-bottom: 8px;
}

/* Links */
.message-content a {
  color: var(--orange-600);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.message-content a:hover {
  color: var(--orange-650);
}

/* Tables */
.message-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 13px;
}

.message-content th,
.message-content td {
  border: 1px solid var(--bone-200);
  padding: 8px 12px;
  text-align: left;
}

.message-content th {
  background-color: var(--bone-100);
  font-weight: 600;
  color: var(--ink);
}

.message-content td {
  color: var(--ink-muted);
}

/* Horizontal rule */
/* Same line as .divider; only the spacing is the chat's own. */
.message-content hr {
  border: none;
  height: 1px;
  background-color: var(--hairline);
  margin: 24px 0;
}

/* Emphasis: strong takes the global weight-only rule (600). */
.message-content em {
  font-style: italic;
}

/* Images */
.message-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 16px 0;
}

/* Nested lists styling */
.message-content ul ul,
.message-content ol ol,
.message-content ul ol,
.message-content ol ul {
  padding-left: 16px;
}

/* First element margin reset */
.message-content > *:first-child {
  margin-top: 0;
}

/* Last element margin reset */
.message-content > *:last-child {
  margin-bottom: 0;
}

/* Uniform body text colour (TA-507): chat prose is always neutral-500 —
   headings, bold labels, table cells and quotes included. Links (orange) and
   inline code (red) keep their semantic colour. Placed last so it wins over the
   per-element colours above. */
.message-content,
.message-content p,
.message-content li,
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6,
.message-content strong,
.message-content em,
.message-content blockquote,
.message-content th,
.message-content td {
  color: var(--ink-muted);
}

.analysis-summary p {
  margin-bottom: 12px;
}

/* --- Responsive Styles --- */

/* Small screens (sm) */
@media (min-width: 640px) {
  /* Add sm styles here */

}

/* Medium screens (md) */
@media (min-width: 768px) {
  /* Add md styles here */

  h1 {
    font-size: 36px;
    line-height: 40px;
  }

  .content-header {
    margin-bottom: 32px;
  }

  /* Icon plus label: the icon side takes the tighter padding, as .has-icon-left. */
  .btn.just-icon-on-mobile,
  .btn-sm.just-icon-on-mobile,
  .btn-lg.just-icon-on-mobile {
    width: auto;
  }

  .btn.just-icon-on-mobile {
    gap: 8px;
    padding: 0 16px 0 12px;
  }

  .btn-sm.just-icon-on-mobile {
    gap: 4px;
    padding: 0 12px 0 8px;
  }

  .btn-lg.just-icon-on-mobile {
    gap: 8px;
    padding: 0 20px 0 16px;
  }

  .btn.just-icon-on-mobile span,
  .btn-sm.just-icon-on-mobile span,
  .btn-lg.just-icon-on-mobile span {
    display: inline;
  }

  /* Hotkeys are desktop affordances: kbd badges and their padding appear
     here (md), matching where icon-only buttons switch to text+kbd forms.
     kbd.tertiary is listed too — it outranks .btn kbd and also covers the
     standalone badges inside search inputs. */
  .btn kbd,
  .btn-sm kbd,
  .btn-lg kbd,
  kbd.tertiary {
    display: inline-flex;
  }

  /* The 18px badge sits the same distance from the right edge as from top
     and bottom, rounded to the 4px grid. */
  .btn.has-hotkey,
  .btn-sm.has-hotkey {
    padding-right: 8px;
  }

  .btn-lg.has-hotkey {
    padding-right: 12px;
  }

  h2 {
    font-size: 24px;
    line-height: 32px;
  }

  h3 {
    font-size: 20px;
    line-height: 28px;
  }

  h4 {
    font-size: 18px;
    line-height: 26px;
  }

  h5 {
    font-size: 16px;
    line-height: 24px;
  }

  ul.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px; /* This gap will now be between the li (including its ::after) and the next li */
    line-height: 12px;
    margin-bottom: 16px;
    padding-left: 0; /* Remove default ul padding */
    list-style: none; /* Remove default list bullets */
    /* The whole trail is supporting text: muted, with only the link a crumb
       points to lifting to ink on hover. */
    color: var(--ink-muted);
    /* No overflow clipping here: the list's box ends at the baseline, so
       hiding overflow cuts the crumbs' underlines off before they paint. A
       long chain is kept in bounds by the cap on the last crumb instead. */
    max-width: 100%;
  }

  /* Add the separator after each list item except the last one */
  ul.breadcrumb li:not(:last-child)::after {
    content: "//";
    color: var(--ink-muted);
    margin-left: 8px;
    color: inherit;
    position: relative;
    top: -1px;
    text-decoration: none;
    pointer-events: none;
  }

  /* A crumb that is a link behaves like a secondary text link: muted and
     unmarked at rest, ink with the text-link underline on hover. Not orange —
     orange is the accent, and a breadcrumb is never the thing to look at. */
  /* Truncation. The cap sits on the last crumb — the current page, which is
     where a long record name actually lands — and nowhere else. A link is left
     unclipped on purpose: `overflow: hidden` clips to the padding box, and the
     underline sits below it, so clipping a link would take its underline with
     it. A chain long enough to run past the header is clipped by the list
     itself rather than wrapping. */
  ul.breadcrumb li:last-child {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }

  /* A crumb that links takes the text-link recipe at the caps-label size — 1px,
     3px under the word, the same muted-to-ink move over the same 0.3s — but
     shows the line only on hover. A trail carries three or four of these, and
     underlining every one turns the chain into a row of links competing with
     the page title under it. Not orange either: orange is the accent, and a
     breadcrumb is never the thing to look at. */
  ul.breadcrumb li a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    outline: none;
    transition: all 0.3s ease;
  }

  /* Focus shows the same thing as hover: at 9px a focus ring boxes the word and
     reads as a control, and the underline already says "this is a link". */
  ul.breadcrumb li a:hover,
  ul.breadcrumb li a:focus-visible {
    color: var(--ink);
    text-decoration-color: currentColor;
  }

  .agent-text {
    font-size: 24px; /* md:text-2xl */
    line-height: 1.5; /* Adjust as needed, e.g., 32px for text-2xl */
  }

  .list-item {
    flex-direction: row;
    align-items: center;
    padding: 16px;
  }

  .subnav-left {
    flex: 1;
  }

  .subnav-right {
    flex: 1;
  }
}

/* Large screens (lg) */
@media (min-width: 1024px) {
  /* Add lg styles here */

  .agent-text {
    font-size: 32px; /* lg:text-3xl */
    line-height: 48px;
    letter-spacing: -0.03em;
    /* padding remains md:px-6 as per original example, or adjust if needed */
  }

  :root {
    --content-max-width: 820px;
  }
}

/* Extra large screens (xl) */
@media (min-width: 1280px) {
  /* Add xl styles here */
}

/* Double extra large screens (2xl) */
@media (min-width: 1536px) {
  /* Add 2xl styles here */
  :root {
    --content-max-width: 1000px;
  }
}

/* Sortable Styles */
.sortable-ghost {
  opacity: 0.4;
}

.sortable-chosen {
  /* outline: 2px solid #f97316;
  outline-offset: 2px; */
}

.sortable-drag {
  transform: rotate(5deg);
}

/* Drag handle styles */
.drag-handle {
  transition: all 0.2s ease;
  /* padding: 10px; */
  background-color: white;
  border-radius: var(--radius-lg);
  cursor: grab;
  cursor: -webkit-grab;
  cursor: -moz-grab;
  color: var(--ink-muted);
}

.drag-handle:hover {
  color: var(--orange-600);
}

/* Only a study's owner edits it, and its plan only while it is a draft
   (TA-1287). A broadcast can't know who is watching, so it renders the
   controls for any draft; the page marks a viewer who may not edit, and their
   controls simply aren't there. */
[data-plan-locked] :is(.plan-control, .drag-handle, .tag-add, .tag-remove),
[data-study-readonly] .study-rename-control,
[data-analysis-readonly] .analysis-control,
[data-video-readonly] .video-control {
  display: none !important;
}

/* AI Typing Indicator Animation */
.typing-indicator {
  display: flex;
  gap: 4px;
  margin-left: 2px;
}

.typing-indicator span {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  corner-shape: round;
  background-color: var(--ink-disabled);
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Participant chat bubbles (TA-129). interviews/_message reaches the researcher
   transcript through the same broadcast, so it cannot know its reader; the
   participant look hangs off this container instead. The participant's turns
   use the account chat's user bubble (messages/_message, TA-507); the agent's
   sit left in white with a bone border. The researcher's name row, copy
   and jump tools and timestamps are not for the participant. */
.participant-chat {
  display: flex;
  flex-direction: column;
}

.participant-chat > .interview-message {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: var(--radius-2xl);
}

.participant-chat > .interview-message[data-message-role="assistant"] {
  align-self: flex-start;
  background-color: #ffffff;
  border: 1px solid var(--bone-200);
  border-bottom-left-radius: 0;
}

.participant-chat > .interview-message[data-message-role="user"] {
  align-self: flex-end;
  background-color: var(--bone-100);
  border-bottom-right-radius: 0;
}

.participant-chat .interview-message-meta {
  display: none;
}

/* Streamed chunks render in ink (interviews/_message_content); without this the
   finished reply would fade to ink-muted when the final re-render lands. */
.participant-chat .interview-message-content {
  color: var(--ink);
}

/* ── Brief chat at body-xl (TA-1114) ───────────────────────────────────────────
   The stakeholder brief chat sets Alice's turns — her greeting and replies —
   in the .body-xl type (18/26 on phones, 20/28 from 768px, 400, ink-muted,
   -0.01em; keep the two in step), so her questions read as the page's main
   content. The lead's own replies, the right-aligned bone bubbles, drop back
   to .body (13px / 1.5, 400, ink-muted) with padding to suit, so the two
   voices are easy to tell apart at a glance. The prose wrapper sets its own
   size, so the values are restated here rather than taken from the class.
   Turns are spaced wider than chat default: 32px on phones, 48px from 768px. Opt in with .question-focus on the
   message list (#chat_messages). Pure CSS, so server renders, Turbo appends
   and streamed chunks all pick it up.
   To revert: delete this block and the question-focus class in
   brief_interviews/show. */
.question-focus {
  row-gap: 32px;
}

.question-focus > .message {
  margin-bottom: 0;
}

.question-focus .message-content,
.question-focus .message-content .prose {
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.01em;
  font-weight: 400;
  color: var(--ink-muted);
  max-width: none;
}

/* Markdown at heading size: prose's em-based margins would open wide gaps,
   and its headings would outgrow the turn. */
.question-focus .message-content {
  overflow-wrap: break-word;
  text-wrap: pretty;

  /* Blocks take the turn's colour (ink-muted). */
  & :is(p, li, h1, h2, h3, h4, h5, h6, strong, em, blockquote, th, td) {
    color: inherit;
  }

  & :is(p, ul, ol, blockquote, pre, h1, h2, h3, h4) {
    margin-top: 0;
    margin-bottom: 0;
  }

  & :is(p, ul, ol, blockquote, pre, h1, h2, h3, h4) + :is(p, ul, ol, blockquote, pre, h1, h2, h3, h4) {
    margin-top: 0.5em;
  }

  & :is(ul, ol) {
    padding-left: 1.1em;
  }

  & li {
    margin-top: 0.15em;
    margin-bottom: 0.15em;
    padding-left: 0.1em;
  }

  & :is(h1, h2, h3, h4) {
    font-size: 1em;
    line-height: inherit;
  }

  & :is(strong, b) {
    font-weight: 600;
    color: inherit;
  }
}

@media (min-width: 768px) {
  .question-focus {
    row-gap: 48px;
  }

  .question-focus .message-content,
  .question-focus .message-content .prose {
    font-size: 20px;
    line-height: 28px;
  }
}

/* The lead's replies at .body. After the 768px block, which it ties on
   specificity, so it holds at every width. The bubble's px-4 py-2.5 was sized
   for 20px text; 12px by 8px suits 13px. */
.question-focus [data-message-role="user"] .message-content,
.question-focus [data-message-role="user"] .message-content .prose {
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: normal;
}

.question-focus [data-message-role="user"] > div {
  padding: 8px 12px;
}
/* ── end Brief chat at body-xl ── */

/* Inline animated ellipsis for in-progress labels (TA-510) — three dots that
   pulse in sequence in the current text colour, tuned subtler than
   .typing-indicator's bounce so it sits inline after a word. */
.loading-dots {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 2px;
  margin-left: 3px;
}

.loading-dots span {
  width: 3px;
  height: 3px;
  border-radius: 9999px;
  corner-shape: round;
  background-color: currentColor;
  opacity: 0.35;
  animation: loading-dots 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes loading-dots {
  0%,
  70%,
  100% {
    opacity: 0.35;
  }
  35% {
    opacity: 1;
  }
}

/* ── Tool-call trail (TA-510, Figma redesign) ────────────────────────────────
   No container box: clean rows of icon + tracked-caps label + chevron. The
   aggregate bar and each per-tool-call card share .tc-row; expanded items hang
   off a 1px connector. Default neutral-500, hover orange-500; the chevron shows
   only on hover or when expanded. */
.tc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 20px;
  padding: 4px 0 8px 0;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tc-ic {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--ink-faint);
  transition: color 0.15s ease;
}
.tc-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 500;
  line-height: 12px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.15s ease;
}
.tc-row:hover .tc-ic,
.tc-row:hover .tc-label,
.tc-row:focus-visible .tc-ic,
.tc-row:focus-visible .tc-label {
  color: var(--orange-600);
}

/* Items under a card — 1px connector line, names (or verbatim text + chips) */
.tc-items {
  list-style: none;
  margin: 2px 0 8px 6px;
  padding: 0 0 0 8px;
  border-left: 1px solid var(--bone-300);
}
.tc-item {
  padding: 2px 0 4px 6px;
  font-size: 11px;
}
.tc-name {
  font-size: 11px;
  line-height: 20px;
  color: var(--ink-faint);
  text-decoration: none;
}
a.tc-name:hover {
  color: var(--orange-600);
}
.tc-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-faint);
  text-decoration: none;
}
a.tc-text:hover {
  color: var(--orange-600);
}
.tc-text.tc-quote {
  font-style: italic;
}
.tc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 12px;
}
.tc-chip {
  font-size: 8px;
  font-weight: 500;
  line-height: 12px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: #fff;
  border: 1px solid var(--bone-200);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
}
.tc-empty {
  font-size: 13px;
  font-style: italic;
  color: var(--ink-faint);
  padding: 4px 0;
}
/* An empty search sits inside a .tc-items connector so it lines up with the
   rows a hit would have produced — item font-size, item padding, no double
   border of its own. */
.tc-items .tc-empty {
  font-size: 11px;
  padding: 2px 0 4px 6px;
}

/* --- TA-668: bar rows for cards where the data's shape is the finding.
   Same mark as the analysis renderers' .analysis-bar family, scaled to the
   tool-call card's 11px type and ~400px panel. Fills stack inside one track
   (orange = the primary share, muted = the removed/secondary share); widths
   are data-driven inline percentages, same idiom as .analysis-bar-fill. --- */
.tc-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.tc-bar-row {
  display: grid;
  grid-template-columns: minmax(64px, 38%) 1fr auto;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
}
.tc-bar-label {
  font-size: 11px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tc-bar-track {
  display: flex;
  width: 100%;
  height: 6px;
  background-color: var(--bone-200);
  border-radius: 999px;
  corner-shape: round;
  overflow: hidden;
}
.tc-bar-fill {
  display: block;
  height: 100%;
  background-color: var(--orange-600);
}
.tc-bar-fill--muted {
  background-color: var(--neutral-400);
}
.tc-bar-value {
  font-size: 10px;
  color: var(--ink-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Literal animated ellipsis for the searching state — the three periods reveal
   in sequence (opacity only, no layout shift). */
.tc-ell {
  display: inline-block;
  letter-spacing: 1.5px;
}
.tc-ell i {
  font-style: normal;
  opacity: 0;
  animation: tc-ell 1.4s infinite steps(1, end);
}
.tc-ell i:nth-child(2) {
  animation-delay: 0.23s;
}
.tc-ell i:nth-child(3) {
  animation-delay: 0.46s;
}
@keyframes tc-ell {
  0%,
  92%,
  100% {
    opacity: 0;
  }
  22%,
  84% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tc-ell i {
    animation: none;
    opacity: 0.7;
  }
}

/* Fade-in animation for content transitions */
.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced block type selection cards */
.block-type-card {
  transition: all 0.2s ease-in-out;
  transform: translateY(0);
}

.block-type-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.block-type-card.selected {
  border-color: #3b82f6 !important;
  background-color: #eff6ff !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Hide textarea resize handle while keeping functionality */
textarea {
  resize: vertical;
}

textarea::-webkit-resizer {
  display: none;
}

/* Global chat module (TA-460): three-card canvas [ Nav | Main content | Chat ].
   The chat panel is a layout-level sibling card of the main content card. Nav
   (14rem) and the chat card (400px) are fixed widths; only the main content
   card flexes. Opening/closing is a client-side class toggle (.show) — no
   page load, no sidenav collapse. */
:root {
  --chat-card-width: 400px;
  /* Fixed horizontal chrome around .content-container while the chat card is
     open: sidenav (224px) + main padding (16px) + main card padding (48px) +
     chat card incl. its gap (408px). Used to pin the container width so
     content never reflows on toggle — only card width + whitespace animate. */
  --chat-canvas-chrome: 696px;
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  width: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  /* Hidden, not just transparent: the closed panel's composer has autofocus,
     and a focusable field off the right edge made the browser scroll the
     canvas sideways to show it, shifting the nav and the page left. */
  visibility: hidden;
  /* Exit (closing): shorter + accelerate (ease-in) — the panel gets out of the
     way quickly once dismissed. See enter easing on .show below. */
  transition: all 0.22s cubic-bezier(0.4, 0, 1, 1);
}

/* Enter (opening): a touch longer + decelerate (ease-out) — the panel slides in
   and settles, so a deliberate open reads as "arriving". The asymmetry (open
   slower/decelerate, close quicker/accelerate) is the standard motion
   convention. */
.chat-sidebar.show {
  visibility: visible;
  transition: all 0.3s cubic-bezier(0, 0, 0.2, 1);
}

/* TA-506: a restored/reopened panel is revealed already-open (chat-toggle adds
   this for one reflow around the .show flip) so it does not slide in on every
   navigation. A deliberate user open animates (via .show above); a close
   animates (via the base rule). */
.chat-sidebar--no-anim {
  transition: none !important;
}

/* The chat card itself: a white rounded module matching the nav and main
   content cards. Fixed inner width so text never rewraps mid-animation. */
.chat-sidebar-content {
  width: var(--chat-card-width);
  height: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  background-color: #ffffff;
  border-radius: var(--radius-3xl);
  /* A resting card on the canvas, same lift as the main content card. */
  box-shadow: var(--elevation-whisper);
}

/* The panel's single scroll region (TA-461): min-height 0 lets the flex item
   shrink below its content so the messages scroll while the header and
   composer stay fixed. Auto-scroll pinning lives in chat-scroll. */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;

  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-input-area {
  flex-shrink: 0;
}

/* The page content wrapper on project/study/interview show pages. Its width
   comes from the shared ladder at the top of this file — do not give it a
   max-width of its own, or the .content-container rows nested inside it get
   clamped to a different width than the same rows on an index page. (The
   .chat-active squeeze variant is gone — the main card flexes on its own when
   the chat card opens.) */
.page-details-container {
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Mobile + tablet (<1024px): the chat is a full-screen takeover — it slides
   up over EVERYTHING, including the app header and menu button. A 60vh
   bottom sheet left half the page visible (and interactive-looking) behind
   it, which read as broken layout on phones. z-index sits above all app
   chrome but below toasts (1050+). */
@media (max-width: 1023.98px) {
  /* Sized against the VISUAL viewport, not the layout viewport. iOS Safari
     does not shrink the layout viewport for the software keyboard: 100dvh
     stays at full screen height and Safari scrolls the visual viewport up
     instead, which pushed this panel's header off the top of the screen the
     moment the composer was focused (it stays pinned on desktop, where there
     is no keyboard). The visual-viewport Stimulus controller on #chat-panel
     publishes the properties; both fall back to the layout viewport where the
     VisualViewport API is unavailable. `top` and `bottom` follow `inset` so
     they win over it. */
  .chat-sidebar {
    position: fixed;
    inset: 0;
    top: var(--visual-viewport-offset-top, 0px);
    bottom: auto;
    width: 100vw;
    height: var(--visual-viewport-height, 100dvh);
    transform: translateY(100%);
    z-index: 1000;
  }

  .chat-sidebar.show {
    width: 100vw;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Tighter gutters than the 24px desktop card — on a phone the panel is a
     full-screen takeover, so 24px a side is a real bite out of the width. */
  .chat-sidebar-content {
    width: 100%;
    height: 100%;
    padding: 16px;
    border: none;
    border-radius: 0;
  }
}

/* The brief interview (TA-1114) on phones and tablets: the shell is fixed to
   the VISIBLE viewport, for the reason .chat-sidebar is above. iOS Safari
   leaves the layout viewport full height under the software keyboard and
   scrolls the visual one instead, which would push the top bar off screen
   and leave the reply box behind the keyboard. The visual-viewport controller
   on the shell publishes the properties; without the API they fall back to
   the layout viewport. The bottom padding clears the home indicator where the
   browser reports one. From 1024px the shell fills the layout's card
   (@full_height_card) instead. */
@media (max-width: 1023.98px) {
  .brief-interview-shell {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--visual-viewport-offset-top, 0px);
    height: var(--visual-viewport-height, 100dvh);
    z-index: 30;
    padding: 16px 16px max(12px, env(safe-area-inset-bottom));
    background-color: var(--canvas);
  }
}

/* ── Pinned avatar (TA-1114) ──────────────────────────────────────────────────
   On the brief chat the agent's avatar stays in view above the turns instead
   of scrolling away with them: full size at the start, then 56px (44px on
   phones) once the chat has scrolled or holds more than its opening question.
   The experience shell wraps the avatar in a band (pin_avatar: true);
   brief-interview-chat#syncAvatar puts .avatar-pinned on the shell while the
   chat is on screen and .avatar-compact once it is under way. Without
   .avatar-pinned (the choice, voice and upload panels) nothing here applies.

   The band is sticky inside the scroller, so it stays in the DOM where every
   panel expects it; an opaque canvas fill hides the turns that pass behind
   it. The fades are overlays in the canvas colour (the white of the shell,
   on the card and on the phone takeover alike): one hangs under the band,
   one sits above the reply box. A mask-image on the scroller would fade the
   avatar too, since it scrolls inside it. pointer-events: none on both, so a
   faded line can still be clicked and selected. The scroller's end padding is
   at least the bottom fade, so the newest turn is never under it. */
.avatar-pinned {
  --avatar-fade: 32px;
  /* The fade under the avatar is long and eased, so turns dissolve as they
     scroll up rather than meeting a line. It shows only once the band is
     compact: at the start nothing sits under it. */
  --avatar-fade-top: 96px;
}

.avatar-pinned [data-experience-shell="scroller"] {
  /* Shrinking the band moves the turns under it; scroll anchoring would
     answer by scrolling back towards the top, and grow it again. */
  overflow-anchor: none;
}

.avatar-pinned [data-experience-shell="body"] {
  padding-top: 0;
  /* Room above the reply box: the shell's pb-6 (24px) plus 16px on phones,
     plus 24px from 768px. */
  padding-bottom: 40px;
}

.avatar-pinned [data-experience-shell="avatar-band"] {
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: stretch;
  display: flex;
  justify-content: center;
  /* The shell's own pt-8 md:pt-16 moves into the band, so the avatar sits
     where it always did at the start and keeps a margin when pinned. */
  padding-top: 32px;
  background-color: var(--canvas);
  transition: padding-top 220ms ease;
}

.avatar-pinned [data-experience-shell="avatar-band"]::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: var(--avatar-fade-top);
  background: linear-gradient(
    to bottom,
    var(--canvas) 0%,
    color-mix(in srgb, var(--canvas) 85%, transparent) 20%,
    color-mix(in srgb, var(--canvas) 55%, transparent) 50%,
    color-mix(in srgb, var(--canvas) 20%, transparent) 80%,
    transparent 100%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.avatar-pinned.avatar-compact [data-experience-shell="avatar-band"]::after {
  opacity: 1;
}

.avatar-pinned .experience-avatar {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-3xl);
  transition: width 220ms ease, height 220ms ease, border-radius 220ms ease;
}

.avatar-pinned [data-experience-shell="footer"] {
  position: relative;
}

.avatar-pinned [data-experience-shell="footer"]::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: var(--avatar-fade);
  background: linear-gradient(to bottom, transparent, var(--canvas));
  pointer-events: none;
}

.avatar-pinned.avatar-compact [data-experience-shell="avatar-band"] {
  padding-top: 12px;
}

/* rounded-3xl is 24px on 96–112px; the same proportion on 44–56px. */
.avatar-pinned.avatar-compact .experience-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xl);
}

@media (min-width: 768px) {
  .avatar-pinned {
    --avatar-fade: 48px;
    --avatar-fade-top: 144px;
  }

  /* The gap under the avatar is at least the fade, so the first turn is
     never under it at the start. */
  .avatar-pinned [data-experience-shell="body"] {
    row-gap: 48px;
    padding-bottom: 48px;
  }

  .avatar-pinned [data-experience-shell="avatar-band"] {
    padding-top: 64px;
  }

  .avatar-pinned .experience-avatar {
    width: 112px;
    height: 112px;
  }

  .avatar-pinned.avatar-compact [data-experience-shell="avatar-band"] {
    padding-top: 16px;
  }

  .avatar-pinned.avatar-compact .experience-avatar {
    width: 56px;
    height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-pinned [data-experience-shell="avatar-band"],
  .avatar-pinned [data-experience-shell="avatar-band"]::after,
  .avatar-pinned .experience-avatar {
    transition: none;
  }
}
/* ── end Pinned avatar ── */

/* A fresh brief chat holds every turn under the greeting until the greeting
   has finished writing itself out (brief-interview-chat#startGreeting), so the
   opening question never streams in beside a half-written greeting. */
#chat_messages[data-greeting-revealing] > :not(#brief_interview_greeting) {
  display: none;
}

/* Narrow desktop (1024–1439px): insetting the card would squeeze content
   below a readable width (~700px min), so the chat card overlays instead. */
@media (min-width: 1024px) and (max-width: 1439.98px) {
  .chat-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 1000;
  }

  .chat-sidebar.show {
    width: calc(var(--chat-card-width) + 0.5rem);
    padding: 0.5rem 0.5rem 0.5rem 0;
    opacity: 1;
    pointer-events: auto;
  }

  /* Overlay mode keeps the same lift: the chat card and the content card are
     the same level, whichever way the layout puts them. */
  .chat-sidebar-content {
    border: 1px solid var(--hairline);
  }
}

/* Wide desktop (≥1440px): inset mode — the chat card is a flex sibling on
   the canvas; the main content card narrows to make room. */
@media (min-width: 1440px) {
  .chat-sidebar {
    flex-shrink: 0;
    height: 100%;
  }

  .chat-sidebar.show {
    width: calc(var(--chat-card-width) + 0.5rem);
    padding: 0.5rem 0.5rem 0.5rem 0;
    opacity: 1;
    pointer-events: auto;
  }

  /* Pin the page wrappers at the width available when the chat card is
     OPEN, in both states: closed → they sit centred with whitespace either
     side; open → the main card narrows to hug them. Content width never
     changes, so nothing reflows on toggle. min(100%, cap) keeps the
     readable max-width without overflowing a narrower ancestor — which is
     also what makes the nesting safe, since a .content-container inside a
     .page-details-container just resolves to its already-pinned parent.
     All three wrappers are pinned together; pinning only some of them is
     what used to make show-page chrome jump while its body stayed put.

     NOT scoped to .chat-panel-canvas, deliberately. That class is only added
     when the chat panel is eligible, so pages excluded from it (the settings
     hub and its destinations) computed 100vw - 288px while every index page
     computed 100vw - 696px. Both are capped, so they agreed above 1696px and
     drifted below it — 6px apart at 1690px, 160px at 1536px — which read as
     the title and breadcrumb shifting a couple of pixels when you navigated
     between Settings and Projects. The pin is a WIDTH LADDER, not a chat
     feature; every page belongs on it. */
  .content-container,
  .page-details-container,
  .content-width-container {
    width: calc(100vw - var(--chat-canvas-chrome));
    max-width: min(100%, var(--content-max-width));
  }
}

/* Two panels side by side while the page card stays wider than one (TA-1286,
   Adam 25 Oct). With the Conversation and Researcher panels both open, the
   second panel takes another 400px plus its 8px gutter, so the pin above grows
   by that much and nothing reflows. The card is then 100vw - 1120px wide, which
   beats a 400px panel from 1521px. At 1520px or less the panel opened last
   covers the other. */
@media (min-width: 1521px) {
  .chat-panel-canvas:has(> .chat-sidebar.show ~ .chat-sidebar.show) {
    --chat-canvas-chrome: calc(696px + 400px + 0.5rem);
  }
}

/* At 1520px or less the two panels share the space: the one opened last
   covers the other, and closing it shows the other again
   (conversation_panel_controller, TA-1288). */
@media (max-width: 1520.98px) {
  .chat-sidebar.is-covered {
    display: none;
  }
}

/* The page card scrolls inside itself (TA-1286, Adam 25 Oct): it fills the
   height between 8px margins like the chat panels, and its content scrolls
   inside it, the row holding Back, the tabs and the researcher button
   included: that row scrolls away with the page, it doesn't stick (Adam,
   28 Oct). Pages opt in with content_for :scroll_page_card. Phones keep
   ordinary page scrolling. */
@media (min-width: 768px) {
  main:has(> .content-card--scroll) {
    overflow: hidden;
  }

  .content-card--scroll {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding-top: 0;
  }

  .content-card--scroll .subnav-header {
    padding-top: 1.5rem;
  }
}

/* --- Researcher summon (TA-490 Phase C) --- */

/* The AI researcher's avatar in the content card's top-right corner: the one
   consistent way to open a chat anchored to the page you're on, replacing the
   per-page "Ask <researcher>" CTAs that only ever existed on four pages.

   Placement is absolute so the slot is identical on every page regardless of
   what chrome the page puts at the top. Below 1280px the content runs the full
   width of the card, so the card reserves the corner with extra right padding;
   above it the contained page headers (see .content-width-container and the
   .content-container rows) leave that corner empty on their own and the card's
   own padding is enough. */
.content-card--summon {
  position: relative;
  /* Mobile-first: no reserved gutter — phones can't spare ~56px of width, so
     the summon floats over the corner and content runs the full card width.
     md+ restores the reserve so chrome never runs under the avatar. */
  padding-right: 1rem;
}

/* Inset tracks the content card's own padding (p-4 md:p-6) so the avatar sits
   on the same margin as the content beside it rather than nearer the corner. */
.researcher-summon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

/* mobile-search suppresses the summon while its overlay is open — a distinct
   class so it composes with (never fights) chat-toggle's `hidden` below. */
.researcher-summon.researcher-summon--suppressed {
  display: none;
}

/* chat-toggle hides the summon while the panel is open. application.css loads
   after Tailwind, so the display above would otherwise beat .hidden. */
.researcher-summon.hidden {
  display: none;
}

/* Colour, border and hover come from .btn-secondary, so the summon matches
   the icon buttons beside it. */

/* The INLINE variant (TA-626): a real member of a page header's right-hand
   cluster, sitting beside Filters rather than floating over the card's corner.
   Static positioning drops the absolute inset above, so the flex row places it
   like any other button; the 36px box already matches .btn-tertiary and the
   mobile icon buttons, so it lines up without further sizing. Pages opt in via
   ChatsHelper#researcher_summon_slot — where they don't, the layout's floating
   fallback still renders. */
.researcher-summon--inline {
  position: static;
  flex-shrink: 0;
}

/* The open state is carried by `aria-pressed` alone — deliberately no visual
   treatment. An orange ring here read as decoration rather than state, and it
   is redundant: on desktop the open panel sitting beside the button is the
   feedback, and on mobile the panel covers the button entirely.
   chat-toggle still toggles .researcher-summon--open for assistive tech and as
   a styling hook if a quieter treatment is ever wanted. */

@media (min-width: 768px) {
  /* No reserved gutter on md+ either — it made every summon page's right
     margin read ~3rem wider than the left. The card keeps its own symmetric
     padding (matches p-6) and the floating fallback sits over the corner. */
  .content-card--summon {
    padding-right: 1.5rem;
  }

  .researcher-summon {
    top: 1.5rem;
    right: 1.5rem;
  }

  /* `.summon-adjacent` lived here: an opt-in 52px margin that shifted a header
     row's right cluster clear of the floating avatar. TA-626 removed it along
     with its five callers — a page with a header row now renders the avatar
     INSIDE that row (researcher_summon_slot), so there is nothing to dodge.
     Pages still on the fallback never carried the class in the first place. */
}

/* Mobile header icon buttons (search opener, filters trigger). 36px square
   with 14px icons, matching the sidenav icon scale (.sidenav-item svg). On
   md+ these buttons show their text/kbd forms and take normal .btn sizing. */
@media (max-width: 767.98px) {
  /* .btn prefix so this outranks .btn.has-hotkey's asymmetric padding
     (16px right), which was dragging the icon off-centre. */
  .btn.mobile-icon-btn,
  .btn.icon-btn-only-mobile {
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    line-height: 1;
  }

  /* On summon-bearing pages the avatar floats over the card's top-right
     corner (the mobile gutter reserve was dropped) — shift the header row's
     right cluster clear of it: 36px avatar + 8px gap. Same gate as the md+
     rule: only dodge a summon that is actually floating. */
  .content-card--summon:has(
      > .researcher-summon:not(.researcher-summon--inline)
    )
    .content-header
    .subnav-right {
    margin-right: 44px;
  }
}

/* Header-width cleanup (TA-490 Phase C). Page chrome that used to run the full
   width of the content card — back bars, tab subnavs — is contained to the same
   width as the body content beneath it (.page-details-container). Two things
   follow: the page reads as one column, and the card's top-right corner is left
   free, which is what makes the summon slot land in the same place everywhere.
   Index pages use .content-container instead, matching their own list bodies.

   Its width now comes from the shared ladder at the top of this file, so it
   tracks the body it sits above at every breakpoint. */

/* Shimmer text effect for loading states */

/* For heading text, ink base */
.shimmer-text-900 {
  background: linear-gradient(
    90deg,
    var(--ink) 0%,
    var(--ink) 20%,
    var(--ink-disabled) 40%,
    var(--ink-disabled) 60%,
    var(--ink) 80%,
    var(--ink) 100%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
  /* Ensure shimmer works on mobile webkit browsers */
  -webkit-animation: shimmer 4s linear infinite;
}

/* For body text, ink-muted base */
.shimmer-text-500 {
  background: linear-gradient(
    90deg,
    var(--ink-muted) 0%,
    var(--ink-muted) 20%,
    var(--ink-disabled) 40%,
    var(--ink-disabled) 60%,
    var(--ink-muted) 80%,
    var(--ink-muted) 100%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
  /* Ensure shimmer works on mobile webkit browsers */
  -webkit-animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% center;
  }
  100% {
    background-position: -200% center;
  }
}

/* Webkit-specific keyframes for mobile Safari */
@-webkit-keyframes shimmer {
  0% {
    background-position: 200% center;
  }
  100% {
    background-position: -200% center;
  }
}

/* --- Toggle (atom, TA-859) ---
   The artifact's recipe. A 50 × 28 track on the raised surface with a hairline
   and a 20px knob on the sunk surface; on, the track fills with primary and
   the knob slides across in the inverse text colour, so it flips on ink.
   .toggle-switch-sm is 36 × 20 with a 14px knob. Markup:
   <label class="toggle-switch"><input type="checkbox"><span class="toggle-slider"></span></label>
   (the slider must directly follow the input). */
.toggle-switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 50px;
  height: 28px;
  margin: 0;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  background-color: var(--sunk);
  background-clip: padding-box;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.toggle-switch:hover .toggle-slider {
  background-color: var(--surface-hover);
  border-color: var(--hairline-hover);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background-color: var(--inverse-fg);
  background-clip: border-box;
  border-color: var(--inverse-fg);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.45;
  cursor: default;
}

.toggle-switch:has(input:disabled) {
  cursor: default;
}

.toggle-switch-sm {
  width: 36px;
  height: 20px;
}

.toggle-switch-sm .toggle-slider {
  border-radius: var(--radius-sm);
}

.toggle-switch-sm .toggle-slider::before {
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-xs);
}

.toggle-switch-sm input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* ===================================================================== */
/* --- Sidebar --- */
/* ===================================================================== */

/* Body scroll lock when mobile sidebar is open */
.sidebar-body-locked {
  overflow: hidden;
}

/* --- Mobile header --- */
.sidebar-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.5rem;
}

.sidebar-mobile-logo {
  height: 1.6rem;
  width: auto;
}

.sidebar-toggle-btn {
  padding: 0.5rem;
  padding-right: 0.25rem;
  color: var(--ink);
  cursor: pointer;
}

.sidebar-toggle-btn:focus {
  outline: none;
}

.sidebar-toggle-btn svg,
.sidebar-close-btn svg {
  width: 1rem;
  height: 1rem;
}

/* --- Mobile overlay --- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--scrim);
  -webkit-backdrop-filter: blur(var(--scrim-blur));
  backdrop-filter: blur(var(--scrim-blur));
  z-index: 40;
  display: none;
}

.sidebar-overlay.sidebar-overlay--visible {
  display: block;
}

/* --- Mobile close button --- */
.sidebar-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: var(--bone-100);
  color: var(--ink-muted);
  padding: 0.75rem;
  border-radius: var(--radius-xl);
  cursor: pointer;
}

.sidebar-close-btn:hover {
  color: var(--ink);
}

/* --- Sidebar content panel (mobile-first) --- */
.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* border-radius: var(--radius-3xl); */
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  width: 100%;
  padding: 0.5rem;
  overflow-y: auto;
  transition: transform 300ms ease-in-out;
  z-index: 50;
  background-color: #ffffff;
}

.sidebar-content.sidebar-content--open {
  transform: translateX(0);
}

/* --- Sidebar header (logo area, hidden on mobile) --- */
.sidebar-header {
  display: none;
  padding: 0.5rem;
  padding-top: 0.875rem;
  padding-bottom: 1.5rem;
}

.sidebar-header a {
  display: flex;
  align-items: center;
}

/* --- Sidenav items: base default color --- */
.sidenav-item {
  color: var(--ink);
}

.sidenav-item svg {
  width: 0.88rem;
  height: 0.88rem;
  flex-shrink: 0;
}

/* --- Sidebar nav lists --- */
.sidebar-nav {
  margin-top: 2.5rem;
}

.sidebar-nav--bottom {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* --- Sidebar spacer --- */
.sidebar-spacer {
  flex-grow: 1;
}

/* --- Section headers: the caps label (see Typography) --- */
.sidenav-section-header {
  margin-left: 0.75rem;
  padding-bottom: 0.75rem;
  line-height: 12px;
  color: var(--ink-muted);
}

.sidenav-section-header--spacing-lg {
  padding-top: 1.5rem;
}

/* --- Notification badge: inline, right-aligned within the nav item --- */
.sidenav-notification-badge {
  letter-spacing: 0.05em;
  background-color: var(--orange-600);
  color: #ffffff;
  /* Fully round — same dot language as .unread-dot on inbox rows */
  border-radius: 9999px;
  corner-shape: round;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  font-size: 9px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
}

/* The Help & Support badge loads after render and hides at 0 (support_badge_controller); the
   display:flex above would otherwise beat the hidden attribute. */
.sidenav-notification-badge[hidden] {
  display: none;
}

/* --- Agency client item: bottom margin + the workspace header's --first
   padding adds up to the same 1.5rem gap used before Bookmarks --- */
.sidenav-client-item {
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .sidenav-client-item {
    margin-bottom: 0.75rem;
  }
}

/* --- Client avatar (agency current-client item) --- */
.sidenav-client-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-md);
  background-color: var(--neutral-800);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Logo variant: same square, but the image supplies the fill — so drop the
   dark plate that backs the initial, and crop rather than distort. The hairline
   keeps a white or near-white logo from dissolving into the card behind it.
   box-sizing is border-box globally, so the square stays 24px. */
.sidenav-client-avatar--image {
  background-color: transparent;
  object-fit: cover;
  border: 1px solid var(--bone-300);
}

/* --- Client switcher menu (TA-502) --- */

/* The row holds its own space so nothing shifts when the card lifts out of
   flow: .sidenav-item is 36px tall with a 2px bottom margin. */
.sidenav-client-item {
  position: relative;
  min-height: 38px;
}

/* Open state: the card — row AND list — lifts out of flow at top:0, exactly
   where the row already sat, so the row does not move and the menu hovers over
   the nav below instead of pushing it down.

   The hairline is a box-shadow ring rather than a border: a border would add a
   pixel and nudge the row it is supposed to leave alone.

   :has() rather than an extra class, so the shared dropdown controller (which
   only toggles `hidden` on the menu) needs no changes. */
.sidenav-client-item:has(.client-switcher-menu:not(.hidden))
  .client-switcher-card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background-color: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow:
    0 0 0 1px var(--bone-200),
    0 8px 24px rgba(0, 0, 0, 0.08);
}

/* The row is a <button>, which has no pointer cursor of its own — the sibling
   nav items get theirs for free by being <a>. Its 2px bottom margin is also
   dropped: with the card flush to the row's top edge, that margin made the gap
   below the row 2px wider than the gap above it. .sidenav-client-item keeps a
   38px min-height, so the closed state's spacing is unaffected. */
.client-switcher-card .sidenav-item {
  margin-bottom: 0;
  cursor: pointer;
}

.client-switcher-menu {
  padding: 4px;
  border-top: 1px solid var(--bone-200);
}

.client-switcher-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Buttons and the current-client span share one box so the list does not jump
   between an <a>, a <button> and a <span>. */
.client-switcher-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-lg);
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

/* Text-only hover, matching the rest of the app's list rows: the option already
   sits on a white card, so a fill would fight the card rather than read as a
   highlight. */
.client-switcher-option:hover {
  color: var(--orange-600);
}

.client-switcher-empty {
  padding: 8px;
  color: var(--ink-faint);
  font-size: 12px;
}

.client-switcher-manage {
  display: block;
  margin-top: 4px;
  padding: 8px;
  border-top: 1px solid var(--bone-200);
  color: var(--ink-muted);
  font-size: 12px;
}

.client-switcher-manage:hover {
  color: var(--orange-600);
}

.client-switcher-loading {
  padding: 8px;
  color: var(--ink-faint);
  font-size: 12px;
}

/* --- Trailing chevron (client switcher) --- */
.sidenav-chevron {
  margin-left: auto;
  color: var(--ink-muted);
}

/* --- md breakpoint: tablet adjustments --- */
@media (min-width: 768px) {
  /* No transparent background here: the panel is still a slide-over until
     lg, and a see-through overlay reads as broken. Transparency belongs to
     the docked desktop state below. */
  .sidebar-content {
    padding: 1rem;
    padding-top: 1.5rem;
  }

  .sidenav-section-header--first {
    padding-top: 0.75rem;
  }

  .sidenav-section-header--first.sidenav-section-header--after-client {
    padding-top: 1.5rem;
  }

  .sidebar-nav--bottom {
    margin-bottom: 0;
  }
}

/* --- lg breakpoint: hide mobile elements, show desktop sidebar --- */
@media (min-width: 1024px) {
  .sidebar-mobile-header {
    display: none;
  }

  .sidebar-close-btn {
    display: none;
  }

  .sidebar-overlay {
    display: none;
  }

  .sidebar-content {
    transform: translateX(0);
    position: relative;
    z-index: 0;
    /* Docked beside the content card — the app background shows through. */
    background-color: transparent;
  }

  .sidebar-header {
    display: block;
  }

  .sidebar-nav {
    margin-top: 0;
  }
}

/* --- Desktop sidebar: fixed width, always expanded --- */
@media (min-width: 1024px) {
  .sidebar {
    width: 15rem;
    flex-shrink: 0;
  }

  .sidebar .sidebar-content {
    width: 100%;
    padding-left: 16px;
    padding-right: 8px;
    padding-top: 24px;
    overflow-x: hidden;
  }

  .sidebar .sidenav-text {
    display: inline-block;
    height: 1.4em;
    line-height: 1.4;
    white-space: nowrap;
  }

  /* --- Logo: background-image for proper crop, not squash --- */
  .sidebar .sidebar-logo {
    height: 24px;
    width: 220px;
    background-size: auto 100%;
    background-position: left center;
    background-repeat: no-repeat;
    flex-shrink: 0;
  }

  .sidebar .sidebar-header {
    padding-left: 7px;
    padding-right: 8px;
  }
}

/* ===================================================================== */
/* --- Study Chat Input --- */
/* ===================================================================== */

.study-chat-input {
  display: flex;
  align-items: flex-end; /* Buttons stay at bottom when textarea grows */
  background-color: var(--bone-100);
  border: 2px solid var(--bone-200);
  border-radius: var(--radius-2xl);
  transition: border-color 0.2s ease-in-out;
}

.study-chat-input:focus-within {
  border-color: var(--orange-600);
}

.study-chat-input textarea,
.study-chat-input textarea:focus {
  flex: 1;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 !important;
  resize: none;
  padding: 12px 8px 12px 16px !important;
}

.study-chat-input .study-chat-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-xl);
  background-color: var(--bone-100);
  border: 2px solid var(--bone-200);
  color: var(--ink-faint);
  transition: color 0.15s ease;
  margin: 6px 0;
}

.study-chat-input .study-chat-attach-btn:hover {
  color: var(--ink-muted);
}

.study-chat-input .study-chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-xl);
  background-color: var(--orange-600);
  border: 2px solid var(--orange-600);
  color: #ffffff;
  transition: background-color 0.15s ease;
  margin: 6px 8px 6px 6px;
}

.study-chat-input .study-chat-send-btn:hover {
  background-color: var(--orange-650);
  border-color: var(--orange-650);
}

/* ===================================================================== */
/* --- Details chevron rotation --- */
/* ===================================================================== */

details[open] .details-chevron {
  transform: rotate(180deg);
}

/* ===================================================================== */
/* Analysis Renderers (TA-238) — one consistent visual language for the   */
/* adaptive result-block components (shape-dispatched). Not chart chaos:   */
/* every shape shares the same envelope, bar mark, and citation drill.     */
/* ===================================================================== */

.analysis-block {
  background-color: #fff;
  border: 1px solid var(--bone-200);
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 12px;
}

.analysis-block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.analysis-block-provenance,
.analysis-block-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.analysis-block-meta {
  justify-content: flex-end;
}

/* Five text sizes on a page: 36 · 24 · 13 · 11 · 9 (TA-1286). The analysis
   blocks had their own 14, 12 and 10; each now takes its neighbour. */
.analysis-kind-tag {
  display: inline-flex;
  align-items: center;
  background-color: var(--neutral-800);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.analysis-reserved-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--orange-50);
  color: var(--orange-650);
  border: 1px solid var(--orange-200);
  border-radius: var(--radius-md);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.analysis-cohort-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--bone-100);
  color: var(--ink-muted);
  border: 1px solid var(--bone-300);
  border-radius: 999px;
  corner-shape: round;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
}

.analysis-count {
  font-size: 11px;
  color: var(--ink-muted);
}

.analysis-count strong {
  color: var(--ink);
}

.analysis-uncited {
  display: inline-flex;
  align-items: center;
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.analysis-block-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

/* --- :scalar --- */
.analysis-scalar-label {
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

/* A metric figure takes the title's size and weight (Adam, 27 Oct). */
.analysis-scalar-value {
  font-size: 36px;
  line-height: 40px;
  font-weight: 500;
  color: var(--ink);
}

.analysis-scalar-context {
  font-size: 11px;
  color: var(--ink-muted);
}

.analysis-scalar-prevalence {
  color: var(--orange-600);
  font-weight: 600;
}

/* --- shared bar mark (distribution + journey funnel) --- */
.analysis-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 30%) 1fr auto;
  align-items: center;
  gap: 10px;
}

.analysis-bar-label {
  font-size: 12px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-bar-track {
  display: block;
  width: 100%;
  height: 10px;
  background-color: var(--bone-200);
  border-radius: 999px;
  corner-shape: round;
  overflow: hidden;
}

.analysis-bar-fill {
  display: block;
  height: 100%;
  background-color: var(--orange-600);
  border-radius: 999px;
  corner-shape: round;
}

.analysis-bar-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.analysis-bar-pct {
  color: var(--ink-faint);
  font-weight: 400;
}

/* --- :quote_list --- */
.analysis-quote-list-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.analysis-quote-list-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.analysis-quote-list-quotes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analysis-quote {
  border-left: 3px solid var(--bone-300);
  padding-left: 12px;
}

.analysis-quote-text,
.analysis-citation-quote {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  margin-bottom: 4px;
}

.analysis-quote-footer,
.analysis-citation-source {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.analysis-citation-link {
  color: var(--orange-600);
  font-weight: 600;
  text-decoration: none;
}

.analysis-citation-link:hover {
  color: var(--orange-650);
  text-decoration: underline;
}

.analysis-citation-link-disabled {
  color: var(--ink-faint);
  font-weight: 400;
  cursor: default;
}

.analysis-citation-attr {
  color: var(--ink-faint);
}

/* --- citation drill --- */
.analysis-citations {
  margin-top: 12px;
  border-top: 1px solid var(--bone-200);
  padding-top: 10px;
}

.analysis-citations-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.analysis-citation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.analysis-citation {
  background-color: var(--bone-50);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
}

/* --- :contrast --- */
.analysis-contrast-dimension {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.analysis-contrast-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  corner-shape: round;
  overflow: hidden;
  background-color: var(--bone-200);
}

.analysis-contrast-segment {
  display: block;
  height: 100%;
}

.analysis-contrast-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
}

.analysis-contrast-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.analysis-tone-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  corner-shape: round;
  display: inline-block;
}

.analysis-contrast-group-value {
  font-weight: 600;
  color: var(--ink);
}

/* tone scale — shared by contrast + journey sentiment */
.analysis-tone-positive {
  background-color: #16a34a;
  color: #16a34a;
}
.analysis-tone-negative {
  background-color: #dc2626;
  color: #dc2626;
}
.analysis-tone-neutral {
  background-color: var(--neutral-400);
  color: var(--ink-muted);
}

.analysis-journey-sentiment {
  background-color: transparent;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* --- :journey --- */
.analysis-journey-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-journey-step {
  position: relative;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--bone-300);
  background-color: var(--bone-50);
}

.analysis-journey-step.has-friction {
  border-left-color: #dc2626;
  background-color: #fef2f2;
}

.analysis-journey-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.analysis-journey-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  corner-shape: round;
  background-color: var(--neutral-800);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.analysis-journey-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.analysis-journey-funnel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.analysis-journey-funnel .analysis-bar-track {
  height: 8px;
}

.analysis-journey-step-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11px;
}

.analysis-journey-dropoff {
  color: #b45309;
  font-weight: 600;
}

.analysis-journey-friction {
  color: #b91c1c;
  font-weight: 600;
}

.analysis-journey-note {
  color: var(--ink-muted);
}

/* --- Mesh surfaces -------------------------------------------------------
   The marketing footer's orange mesh, as a reusable in-app surface for
   promotional banners. The footer builds it from three blurred blob divs
   (filter: blur(160px)); here the same three blobs are layered radial
   gradients — visually equivalent, scales to any element size, and skips
   the blur's GPU cost on app pages.

   Usage: add .mesh-orange to the banner element (it provides its own
   position/overflow), render shared/noise_overlay as the first child for
   the grain, and wrap content in a relative z-10 element. */
.mesh-orange {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(ellipse 60% 160% at 55% -20%, #f08851 0%, transparent 70%),
    radial-gradient(ellipse 70% 180% at 12% 90%, #d34e0e 0%, transparent 70%),
    radial-gradient(ellipse 55% 170% at 92% 130%, #f6b896 0%, transparent 70%),
    #ea580c;
}

a.mesh-orange {
  transition: filter 0.3s ease;
}

a.mesh-orange:hover {
  filter: brightness(1.05);
}

/* ============================================================================
   THE THREAD (TA-373; design TA-1120, /preview page TA-1121)
   One surface for every page where the agent talks to someone. A turn is her
   line plus at most one way to answer. The avatar never moves; the page never
   scrolls, only the text column; a new turn's first line lands on the anchor,
   level with her top edge; past turns sit above in ink-disabled. Every value
   reads a token. The prototype (docs/prototypes/experience-thread.html) is the
   reference until the app's partials replace it.
   ============================================================================ */

/* --- The frame: a fixed card on the canvas ---
   .thread-page is fixed so the frame bounds itself whatever container it is
   rendered in (the app layout or the bare /preview layout); the card inside is
   the participant frame. Only .thread-scroll scrolls. */
.thread-page {
  position: fixed;
  inset: 0;
  padding: 8px;
  background-color: var(--canvas);
}

.experience {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 16px;
  background-color: var(--canvas);
  border-radius: var(--radius-3xl);
}

/* Page edges: Exit (left), progress or the logo (centre), Help (right). */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  flex-shrink: 0;
}

.topbar > * {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar .centre {
  justify-content: center;
}

.topbar .right {
  justify-content: flex-end;
}

.topbar .meter {
  width: min(200px, 40vw);
}

.topbar .logo {
  height: 22px;
  width: auto;
  max-width: none;
  flex-shrink: 0;
  display: block;
}

/* New-user pages: the logo takes the middle and there is no progress bar. */
.topbar.topbar-user .centre {
  flex: 3;
}

.thread-body {
  display: flex;
  gap: 24px;
  flex: 1;
  min-height: 0;
}

.experience .powered-by {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.experience .powered-by img {
  height: 22px;
  display: block;
}

.experience .powered-by p {
  margin: 0;
}

/* A prototype test's stimulus pane (TA-1157 adds the column layout). */
.stage-pane {
  display: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.stage-pane iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- The thread itself ---
   The anchor is a length, never a %: top: 30% resolves against height,
   padding-top: 30% against width. Every override is written on .thread. */
.thread {
  --avatar-size: 48px;
  --rail-top: 36px;
  --anchor: calc(var(--rail-top) + var(--avatar-size) + 16px);
  --fade: linear-gradient(to bottom, transparent 0, transparent calc(var(--anchor) - 32px), #000 calc(var(--anchor) - 4px), #000 86%, transparent 100%);

  position: relative;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  min-height: 0;
}

/* Her portrait on the anchor. Furniture: it never moves or re-renders. The
   corner is 2xl on every page, never 3xl, so it never changes mid-thread. */
.thread-rail {
  position: absolute;
  top: calc(var(--rail-top) - var(--shift, 0px));
  left: 0;
  width: var(--avatar-size);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
  transition: top 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.thread-rail .tile-avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: var(--radius-xl);
  box-shadow: none;
  transition: opacity 0.4s ease;
}

/* The empty-state gallery has one turn, so it needs no scrolling anchor. */
.preview-empty-thread {
  display: grid;
  align-items: start;
  gap: 24px;
}

.preview-empty-thread .thread-rail {
  position: static;
  transform: none;
  justify-self: center;
}

@media (min-width: 768px) {
  .preview-empty-thread {
    grid-template-columns: var(--avatar-size) minmax(0, 1fr);
    gap: 48px;
  }
}

/* A zero-size marker on the resting anchor, so the controller can read it as
   a length whatever unit --anchor was written in. The lift (--shift) is the
   controller's own number, so the marker never moves. */
.thread-anchor {
  position: absolute;
  top: var(--anchor);
  left: 0;
  width: 0;
  height: 0;
}

.thread-scroll {
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-left: calc(var(--avatar-size) + 48px);
  -webkit-mask-image: var(--fade);
  mask-image: var(--fade);
}

.thread-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* A thread with no script behind it (the /preview whole-frame states): the
   turns are listed newest first and the column runs in reverse, which every
   browser opens scrolled to the end, so the live turn lands on the anchor and
   the past turns scroll up behind her. The app's controller scrolls instead. */
.thread-scroll-static {
  display: flex;
  flex-direction: column-reverse;
  gap: 44px;
}

/* The live block fills the column from the anchor down, so it sits on the
   anchor whatever its content's height. No padding on the container: the
   percentage resolves against its content box. */
.thread-scroll-static .thread-live {
  flex-shrink: 0;
  min-height: calc(100% - var(--anchor));
}

/* Head room above the oldest turn, so it can scroll clear of the fade. */
.thread-scroll-static > :last-child {
  margin-top: var(--anchor);
}

.thread-scroll.can-skip {
  cursor: pointer;
}

.thread-col {
  display: flex;
  flex-direction: column;
  gap: 44px;
  min-width: 0;
  padding-top: var(--anchor);
  /* Tail room so the last turn can still scroll up to the anchor. */
  padding-bottom: calc(100vh - var(--anchor));
}

.turn {
  scroll-margin-top: var(--anchor);
}

.turn .say {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: flex-start;
  min-width: 0;
}

/* Her line in the thread reads left from the avatar and fades back once it
   is past. A past turn scrolled under the avatar lifts one step, never to ink. */
.thread .agent-text {
  text-align: left;
  margin: 0;
  color: var(--ink);
  transition: color 0.35s ease;
}

.turn.past .agent-text {
  color: var(--ink-disabled);
}

/* The turn just answered starts in ink and fades back as the new one slides
   in (the thread controller's arrive). */
.turn.past.from .agent-text {
  color: var(--ink);
}

.turn.past.focus .agent-text {
  color: var(--ink-faint);
}

.turn.past .actions {
  display: none;
}

.turn.past .shimmer-text-900 {
  animation: none;
  -webkit-text-fill-color: currentColor;
  background: none;
}

.turn.past .tc-ell {
  display: none;
}

/* The one ellipsis: three full stops in the line's own font, set as tight as
   the single "…" glyph. */
.agent-text .tc-ell {
  letter-spacing: -0.07em;
}

/* Cut off mid-sentence (voice): the dash after her last word is quieter. */
.agent-text .cut-dash {
  color: var(--ink-disabled);
}

/* Listening takes the anchor whenever she is not speaking. */
.thread .agent-text.listening {
  color: var(--ink-disabled);
}

/* Muted, or the mic has stopped: the line stops claiming she can hear you. */
.agent-text.listening.still .shimmer-soft {
  animation: none;
  -webkit-text-fill-color: var(--ink-disabled);
}

.agent-text.listening.still .tc-ell {
  display: none;
}

/* Their answer lands on the right as the chat's own bubble (messages/_message). */
.turn.reply {
  display: flex;
  justify-content: flex-end;
}

/* Steps she took: the tool-call trail, collapsed under her line. */
.turn .steps {
  margin-top: -8px;
}

.turn .steps .tc-items[hidden] {
  display: none;
}

/* Keep the preview painted until the final portrait has decoded. */
.auth-visual-image {
  opacity: 0;
  transition: opacity 0.45s ease;
}

.auth-visual-image.is-loaded {
  opacity: 1;
}

/* The auth portrait quote has its own art-directed size. */
.auth-visual-quote {
  font-size: 32px;
  text-wrap: balance;
}

/* Hang the opening mark outside the text edge, fading with the first word. */
.auth-visual-quote > .rw:first-child {
  position: relative;
}

.auth-visual-quote > .rw:first-child::before {
  content: "“";
  position: absolute;
  right: 100%;
}

/* Labels follow the shared quote reveal's start and completion. */
.auth-visual-copy {
  opacity: 0;
}

.auth-visual-copy:has(.auth-visual-quote .rw.in) {
  opacity: 1;
}

.auth-visual-copy > .caps-label {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.auth-visual-copy:has(.auth-visual-quote .rw.in) > p.caps-label {
  opacity: 1;
}

.auth-visual-copy:has(.auth-visual-quote[data-text-reveal-complete]) figcaption {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .auth-visual-copy > .caps-label,
  .auth-visual-image {
    transition: none;
  }
}

/* Line reveal: every word is laid out from the first frame, then fades in. */
.rw {
  transition: opacity 0.2s ease-out;
}

.reveal .rw:not(.in) {
  opacity: 0;
}

/* A block inside a streamed line (code, a table, a card) appears whole: it is
   one unit of the reveal and fades in as one step (decision 28). */
.rw-block {
  transition: opacity 0.2s ease-out;
}

.reveal .rw-block:not(.in) {
  opacity: 0;
}

/* Jump to latest: shown only when the reader has scrolled away from her live
   line; a new turn never drags them back down. */
.jump-latest {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 6;
}

.jump-latest[hidden] {
  display: none;
}

/* --- The answer slot ---
   One wrapper per turn, and the wrapper animates, so everything arrives
   together after the line has finished. Until then it is invisible and out
   of the tab order. .btn centres itself for the app's forms; here it sits left. */
.thread .actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}

.thread .actions > * {
  align-self: flex-start;
}

.thread .action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-reveal {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s cubic-bezier(0.22, 0.8, 0.24, 1),
    visibility 0s linear 0.5s;
}

.action-reveal.shown {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition:
    opacity 0.5s ease,
    transform 0.5s cubic-bezier(0.22, 0.8, 0.24, 1),
    visibility 0s;
}

.thread .answer {
  width: 100%;
  max-width: 560px;
}

/* The welcome pricing turn's cards (TA-1839) take the full thread column,
   as the briefing thread's pack chooser does. */
.thread .answer.answer-wide {
  max-width: none;
}

.thread .answer .form-field:last-of-type {
  margin-bottom: 16px;
}

/* The two end labels under a rating scale. */
.scale-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 560px;
  font-size: 11px;
  line-height: 16px;
  color: var(--ink-muted);
}

/* A read-only summary under her line (the colleague's "what Priya wants to learn"). */
.summary-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-card .summary-label {
  margin-bottom: 2px;
}

.summary-card .card-body {
  font-size: 15px;
  line-height: 1.5;
}

/* Contributors (TA-1122): one row per team member, a hairline between rows,
   the decision on the right; on a phone the decision drops under the name. */
.contributors-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 4px;
  padding-bottom: 4px;
}

.contributor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.contributor + .contributor {
  border-top: 1px solid var(--line, rgba(0, 0, 0, 0.08));
}

.contributor-who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.contributor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .contributor {
    flex-direction: column;
    align-items: stretch;
  }

  .contributor-actions {
    padding-left: 44px;
    flex-wrap: wrap;
  }
}

/* Invite rows: the name before the @, the account's domain fixed after it. */
.invite-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.input-suffix {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}

.input-suffix .input-lg {
  width: 100%;
  padding-right: 128px;
}

.input-suffix-text {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}

.field-refusal {
  flex-basis: 100%;
  color: var(--ink-muted);
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .rw,
  .rw-block,
  .action-reveal,
  .thread-rail,
  .thread .agent-text {
    transition: none;
  }
}

/* From 768px her portrait sits beside the turn, both near the centre; her
   footprint grows with the screen but is capped. */
@media (min-width: 768px) {
  .experience {
    padding: 24px;
  }

  .thread {
    --avatar-size: clamp(48px, 6vw, 104px);
    --anchor: 24vh;
    --rail-top: var(--anchor);
    /* The top fade shrinks as a tall turn lifts the anchor. */
    --fade: linear-gradient(to bottom, transparent 0, #000 max(24px, calc(14% - var(--shift, 0px))), #000 86%, transparent 100%);
  }

  .thread-rail .tile-avatar {
    border-radius: var(--radius-2xl);
  }
}

@media (min-width: 1024px) {
  .thread {
    --anchor: 26vh;
    --rail-top: var(--anchor);
  }
}

/* Phone: her portrait 56px, centred at the top; the turn starts under her at
   full width, because a keyboard is often up. Large answer buttons run edge
   to edge and rows of them stack; choice chips keep their own size. */
@media (max-width: 767px) {
  .thread {
    --avatar-size: 56px;
    --anchor: calc(var(--rail-top) + var(--avatar-size) + 24px);
    --fade: linear-gradient(to bottom, transparent 0, transparent calc(var(--anchor) - 20px), #000 calc(var(--anchor) - 4px), #000 86%, transparent 100%);
  }

  .thread-rail {
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    width: auto;
  }

  .thread-scroll {
    padding-left: 0;
  }

  .thread-col {
    gap: 32px;
  }

  .thread .actions > .btn-lg:not(.icon-btn),
  .thread .action-row > .btn-lg:not(.icon-btn),
  .thread .answer > .btn-lg:not(.icon-btn),
  .thread .answer form > .btn-lg:not(.icon-btn) {
    width: 100%;
    align-self: stretch;
  }

  .thread .action-row:has(> .btn-lg) {
    flex-direction: column;
    align-items: stretch;
    align-self: stretch;
    width: 100%;
  }
}

/* ============================================================================
   THE VOICE CALL (decision 51; reference docs/prototypes/call-states-dock.html)
   The anchor holds whatever is happening now: her line while she talks,
   Listening once she has finished. Things about the call sit on the anchor
   too, as one compact note, never in her voice. Your camera and its controls
   sit together in the dock. Every state is a modifier on its own element, so
   /preview can hold a dozen of them side by side.
   ============================================================================ */

/* The dock: in the flow by default (the gallery); .dock-anchored pins it to
   the bottom left of the frame with no card behind it. */
.dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  --stack: calc(4 * 36px + 3 * 8px);
}

.dock-anchored {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 4;
}

.dock-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Your camera: square, exactly as wide as the four buttons (168px), mirrored.
   Off: just the icon on bone, no text, no Rec. */
.selfview {
  position: relative;
  width: var(--stack);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  background-color: var(--color-bone-100);
  transition: opacity 0.4s ease;
}

.selfview video,
.selfview .stand-in {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
}

.selfview video[hidden] {
  display: none;
}

/* Rec: a fully round pill stepped in from the corner; only the dot pulses.
   It keeps the 18px, 7px-caps size pages no longer use (TA-1286). */
.rec {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  font-size: 7px;
  line-height: 12px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.selfview .rec {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 0 7px 0 6px;
  border-radius: 999px;
  corner-shape: round;
  background-color: rgb(255 255 255 / 0.92);
}

.rec-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  corner-shape: round;
  background-color: var(--danger);
  animation: rec-pulse 1.6s ease-in-out infinite;
}

@keyframes rec-pulse {
  50% {
    opacity: 0.35;
  }
}

.selfview .cam-off {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
}

.selfview .cam-off svg {
  width: 20px;
  height: 20px;
}

.selfview.off video,
.selfview.off .stand-in,
.selfview.off .rec {
  display: none;
}

.selfview.off .cam-off {
  display: flex;
}

/* The phone preview's minimise button: hidden here, shown by the phone rules. */
.cam-min {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  corner-shape: round;
  background-color: color-mix(in srgb, var(--ink) 45%, transparent);
  color: #fff;
  cursor: pointer;
}

.cam-min svg {
  width: 12px;
  height: 12px;
}

/* The buttons: Exit's 36px secondary with a 14px icon. Off: the struck-through
   icon on ink. Hearing you: the mic icon becomes three level bars. A device
   that failed: the warning tint. */
.ctl [data-off],
.ctl [data-level] {
  display: none;
}

.ctl.is-off [data-on] {
  display: none;
}

.ctl.is-off [data-off] {
  display: block;
}

.ctl.hearing:not(.is-off) [data-on] {
  display: none;
}

.ctl.hearing:not(.is-off) [data-level] {
  display: inline-flex;
}

.ctl.is-warn {
  background-color: var(--warning-tint);
  border-color: var(--warning-line);
  color: var(--warning-text);
}

.levels {
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 14px;
  height: 14px;
}

.levels i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 999px;
  corner-shape: round;
  background-color: currentColor;
  animation: lvl 0.8s ease-in-out infinite;
}

.levels i:nth-child(2) {
  animation-delay: 0.18s;
}

.levels i:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes lvl {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 13px;
  }
}

/* The soft shimmer for Listening: ink-disabled to ink-muted and back. */
.shimmer-soft {
  background: linear-gradient(
    90deg,
    var(--ink-disabled) 0%,
    var(--ink-disabled) 25%,
    var(--ink-muted) 45%,
    var(--ink-muted) 55%,
    var(--ink-disabled) 75%,
    var(--ink-disabled) 100%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 2s linear infinite;
  -webkit-animation: shimmer 2s linear infinite;
}

/* A call note: one line about the call, on the anchor, her current line 18px
   under it. Compact, wraps rather than clips; only ever one. */
.call-note {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 4px 4px 4px 12px;
  margin-bottom: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--hairline);
  background-color: var(--surface);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
}

.call-note[hidden] {
  display: none;
}

.call-note.warn {
  border-color: var(--warning-line);
  background-color: var(--warning-tint);
  color: var(--warning-text);
}

.call-note .msg {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}

.call-note .msg svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.call-note .acts {
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-note .btn-sm {
  flex-shrink: 0;
  white-space: nowrap;
}

.call-note select {
  width: auto;
  min-width: 0;
  max-width: 220px;
}

.call-note:not(:has(.btn-sm, select)) {
  padding-right: 12px;
}

.call-note .dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  corner-shape: round;
  background-color: var(--warning);
  animation: rec-pulse 1.2s ease-in-out infinite;
}

/* Connection lost: no banner. Her portrait and your camera fade right back and
   her line goes ink-disabled with no new words. A modifier on each element. */
.tile-avatar.lost,
.selfview.lost {
  opacity: 0.25;
}

.thread .agent-text.lost {
  color: var(--ink-disabled);
}

/* Before the call: one container that checks everything, a row per device. */
.checks {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  padding: 4px 20px;
}

.check {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}

.check + .check {
  border-top: 1px solid var(--hairline);
}

.check .what {
  flex: 1;
  min-width: 0;
}

.check .what .card-title {
  font-size: 14px;
}

.check .what .card-body {
  font-size: 13px;
}

.check .status {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.check .meter {
  width: 96px;
}

.check .btn-sm {
  white-space: nowrap;
}

.check .tick {
  color: var(--success);
}

.check.ok .tile-sm {
  --tile-fill: var(--success-tint);
  --tile-icon: var(--success);
}

.check.bad .tile-sm {
  --tile-fill: var(--warning-tint);
  --tile-icon: var(--warning);
}

.check.bad .card-body {
  color: var(--warning-text);
}

.check .tile-sm svg {
  width: 14px;
  height: 14px;
}

.check select {
  width: auto;
  max-width: 200px;
}

/* Level bars in a fixed box, aligned to the middle: they move, the text never does. */
.lv {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
  overflow: hidden;
  color: var(--ink-muted);
}

.lv i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 999px;
  corner-shape: round;
  background-color: currentColor;
  animation: lvl 0.9s ease-in-out infinite;
}

.lv i:nth-child(2) {
  animation-delay: 0.15s;
}

.lv i:nth-child(3) {
  animation-delay: 0.3s;
}

.lv i:nth-child(4) {
  animation-delay: 0.45s;
}

/* Your setup (the gear): the modal shell holding checks-style rows with no
   box, a 264px right-hand column so the lists line up, Done under a hairline. */
.setup-modal {
  width: min(600px, 100%);
}

.setup-modal .checks {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
}

.setup-modal .check:first-child {
  padding-top: 8px;
}

.setup-modal .check[hidden] {
  display: none;
}

.setup-modal .check .status {
  width: 264px;
}

.setup-modal .check .status select {
  flex: 1;
  width: auto;
  min-width: 0;
  max-width: none;
}

.setup-modal .vol {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  max-width: 200px;
}

.setup-modal input[type="range"] {
  flex: 1;
  accent-color: var(--ink);
}

.setup-modal .lv {
  margin-left: 6px;
}

.setup-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

@media (prefers-reduced-motion: reduce) {
  .rec-dot,
  .call-note .dot,
  .levels i,
  .lv i,
  .shimmer-soft {
    animation: none;
  }
}

/* Phone: the camera and the four buttons form one centred row above Powered
   by. The camera is a 36px square; Rec is a solid 10px white disc with the dot
   inside. Tapping the picture opens it to 168px with a minimise button. */
@media (max-width: 767px) {
  .dock,
  .dock-anchored {
    position: static;
    flex-shrink: 0;
    align-items: center;
    margin-top: 12px;
  }

  .dock-card {
    flex-direction: row;
    align-items: center;
    align-self: center;
  }

  .selfview {
    width: 36px;
    cursor: zoom-in;
  }

  .selfview .rec {
    top: 4px;
    left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
    min-height: 0;
    padding: 0;
    gap: 0;
    font-size: 0;
    line-height: 0;
    letter-spacing: 0;
    overflow: hidden;
    border: 0;
    border-radius: 50%;
    corner-shape: round;
    background-color: #fff;
  }

  .selfview .rec-dot {
    display: block;
    flex: none;
  }

  .dock.cam-big .dock-card {
    flex-direction: column;
  }

  .dock.cam-big .selfview {
    width: var(--stack);
    cursor: zoom-out;
  }

  .dock.cam-big .selfview .rec {
    top: 8px;
    left: 8px;
    width: auto;
    height: 18px;
    padding: 0 7px 0 6px;
    gap: 4px;
    font-size: 7px;
    line-height: 12px;
    border-radius: 999px;
  }

  .dock.cam-big .cam-min {
    display: flex;
  }

  .in-call .powered-by {
    padding-top: 24px;
  }

  .checks {
    padding: 4px 14px;
  }

  .check {
    flex-wrap: wrap;
  }

  .check.bad .status,
  .check .status:has(.lv) {
    width: 100%;
    padding-left: 46px;
  }

  .setup-modal .check .status {
    width: 100%;
    padding-left: 46px;
  }
}

/* --- Help & Support (support chat plan U6) ---
   Help search above the conversation, then the thread, the composer and the reply-time line. The
   thread scrolls inside itself so the composer stays in view, at 390px too. Bubbles follow the AI
   chat's user turn (messages/_message): bone, squared on the sender's side. */
/* The controllers show and hide with the hidden attribute; several of these classes set a
   display, which would otherwise beat it. */
.support-page [hidden] {
  display: none !important;
}

.support-page {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 760px;
}

.support-help-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
}

.support-help-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.support-help-results {
  margin-top: 4px;
}

.support-help-results .text-support,
.support-help > .text-support {
  margin-top: 12px;
}

.support-banner {
  margin-bottom: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink);
  background-color: var(--orange-50);
  border: 1px solid var(--orange-200);
  border-radius: var(--radius-xl);
}

.support-reconnecting {
  margin-bottom: 8px;
}

.support-thread {
  position: relative;
  min-height: 12rem;
  max-height: min(60dvh, 640px);
  overflow-y: auto;
  padding: 16px;
  background-color: var(--bone-50);
  border: 1px solid var(--bone-200);
  border-radius: var(--radius-2xl);
}

.support-load-earlier {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.support-messages {
  display: flex;
  flex-direction: column;
}

.support-empty {
  padding: 24px 8px;
  text-align: center;
}

.support-row {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

.support-row:first-child,
.support-row--continued {
  margin-top: 4px;
}

.support-row--user {
  align-items: flex-end;
}

.support-row--team {
  align-items: flex-start;
}

.support-row--pending .support-bubble {
  opacity: 0.55;
}

.support-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.support-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.support-bubble {
  max-width: 85%;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  border-radius: var(--radius-xl);
}

.support-bubble--user {
  background-color: var(--bone-200);
  border-bottom-right-radius: 0;
}

.support-bubble--team {
  margin-left: 32px;
  background-color: var(--surface);
  border: 1px solid var(--bone-200);
  border-top-left-radius: 0;
}

.support-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.support-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.support-body[hidden] + .support-images {
  margin-top: 0;
}

/* A fixed box, so a thumbnail that loads late never moves the rows below it: the thread opens
   at the first unread reply and marks replies read by where they sit on screen. */
.support-image-link {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-lg);
  cursor: zoom-in;
}

.support-image-link:focus-visible {
  outline: 2px solid var(--orange-500);
  outline-offset: 2px;
}

.support-image {
  display: block;
  width: 240px;
  max-width: 100%;
  height: 160px;
  object-fit: cover;
  background-color: var(--bone-100);
  border-radius: var(--radius-lg);
}

.support-image-preview {
  position: fixed;
  inset: 0;
  margin: auto;
  width: fit-content;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 48px 16px 16px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bone-50);
}

.support-image-preview::backdrop {
  background: var(--scrim);
}

.support-image-preview img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 96px);
  object-fit: contain;
}

.support-image-preview img[hidden] {
  display: none;
}

.support-image-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
}

.support-status {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.support-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  border-radius: 9999px;
  corner-shape: round;
}

.support-avatar--1 { background-color: var(--orange-100); color: var(--orange-700); }
.support-avatar--2 { background-color: var(--bone-300); color: var(--bone-900); }
.support-avatar--3 { background-color: var(--orange-200); color: var(--orange-700); }
.support-avatar--4 { background-color: var(--bone-400); color: var(--bone-950); }

.support-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.support-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--orange-600);
}

.support-divider::before,
.support-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--orange-200);
}

.support-new-reply-anchor {
  position: relative;
  height: 0;
}

.support-new-reply {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
}

.support-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.support-composer textarea {
  resize: vertical;
  min-height: 72px;
  font-size: 14px;
}

/* Focus moves here after a failed send so a screen reader hears it; it is not a control. */
.support-composer-error:focus {
  outline: none;
}

.support-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.support-composer-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--orange-700);
}


.support-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.support-attachment {
  position: relative;
}

.support-attachment-image {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--bone-200);
  border-radius: var(--radius-lg);
}

.support-attachment-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  font-size: 14px;
  line-height: 1;
  color: #ffffff;
  background-color: var(--ink);
  border-radius: 9999px;
  corner-shape: round;
}

.support-reply-time {
  margin-top: 8px;
}

.support-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--bone-500);
  border-top-color: transparent;
  border-radius: 9999px;
  corner-shape: round;
  animation: btn-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .support-spinner {
    animation: none;
  }
}

/* ============================================================================
   Operator components (TA-1651, design-system task)
   ----------------------------------------------------------------------------
   What /admin needs and the product never did: a dense data table, a queue
   row with a severity mark, a metric card that names its window, a key-value
   panel, an audit timeline, filter and context chips, the origin bar for a
   sideways arrival, and the admin top bar. Every value is a semantic token,
   so they follow the ground like the rest of this file. Documented on
   /preview (Components: Data table, Queue row, Metric card, Key-value panel,
   Timeline, Filter chips, Origin bar). Source mockup: the admin north-star
   plan, renders/CUS-1069/plan/shell.css.
   ============================================================================ */

/* --- Admin shell ---
   The app's own canvas (sidenav beside the white card) with one wider cap,
   because a nine-column table does not fit the product's 820px. The nav rows
   are 32px instead of 36px: admin lists about 30 pages. */
.admin-content {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

/* Admin sets no bold: emphasis inside a page is the heading weight (500),
   the strongest the design system's type scale uses outside the product's
   own reading surfaces. */
.admin-content :is(strong, b) {
  font-weight: 500;
}

.sidebar-nav--dense .sidenav-item {
  height: 32px;
  margin-bottom: 1px;
}

.sidebar-nav--dense .sidenav-section-header {
  padding-top: 16px;
  padding-bottom: 6px;
}

.sidenav-item .sidenav-external {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-faint);
}

/* A page still on Administrate's markup (admin_legacy) scrolls sideways inside
   its own box on a phone, so the top bar and the menu never move. */
.admin-legacy {
  min-width: 0;
  overflow-x: auto;
}

/* --- Admin top bar ---
   Search (the front door), the environment, and the clock with its zone, so
   every time on the page has a stated zone. On a phone the tags sit above a
   full-width search. */
.admin-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-search {
  position: relative;
  order: 2;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 20px;
  border: 1px solid var(--hairline);
  background-color: var(--surface);
  transition: all 0.3s ease;
}

/* The box is the kit's 36px search field (input[type="search"]: 12px in,
   radius-lg, 13/20 text), so a narrowed search's tag sits inside it at the
   tag's own 24px height, 6px clear of the line top and bottom. */
.admin-search:focus-within {
  background-color: var(--canvas);
  border-color: var(--field-focus-line);
  box-shadow: 0 0 0 3px var(--field-focus-ring);
}

.admin-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  outline: none;
}

.admin-search input:focus {
  border: 0;
  background: none;
  box-shadow: none;
}

.admin-search input::placeholder {
  color: var(--ink-faint);
}

.admin-search input:disabled {
  cursor: not-allowed;
}

.admin-search svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--ink-faint);
  pointer-events: none;
}

/* TA-1686: the kind a search is narrowed to, and the "/" list of kinds. */
.admin-search .admin-search-scope {
  flex-shrink: 0;
}

.admin-search-scopes {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  list-style: none;
}

.admin-search-scope[hidden],
.admin-search-scopes[hidden],
.admin-search-scopes .menu-item[hidden] {
  display: none;
}

.admin-topbar-meta {
  order: 1;
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-zone-clock {
  white-space: nowrap;
}

@media (min-width: 768px) {
  .admin-search {
    order: 0;
    flex: 1 1 auto;
    max-width: 520px;
  }

  .admin-topbar-meta {
    flex: 0 0 auto;
    margin-left: auto;
    justify-content: flex-end;
  }
}

/* --- Preview shell (/preview) ---
   The preview tool's chrome on the app canvas, as admin's (TA-1651): the
   sidenav lists every catalogue entry, and the white card holds one header
   row (breadcrumb left, the frame's switches right) and the stage. The iframe is what makes breakpoints real:
   resizing it fires genuine media queries, which a transform: scale() would
   not. */
.preview .sidenav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview .sidenav-status {
  flex-shrink: 0;
  margin-left: auto;
}

.preview-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* One row above the stage: the breadcrumb left, the frame's switches right,
   centred on each other. The breadcrumb's own bottom margin goes, since the
   row sets the spacing. */
.preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.preview-header ul.breadcrumb {
  margin-bottom: 0;
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* An icon-only tab: square at the tab's 28px, so the 14px icon keeps the
   track at 36px. */
.tab.tab-icon {
  width: 28px;
  padding: 0;
}

.preview-stage {
  display: flex;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 480px;
}

.preview-frame {
  width: 100%;
  max-width: 100%;
  height: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  background-color: var(--canvas);
  transition: max-width 0.18s ease;
}

/* --- Origin bar ---
   Arriving sideways (a "See all" from another record) carries the way back:
   Back goes to that page, not to the section root. The origin comes from the
   link's origin= parameter, never the referrer. */
.origin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

/* --- Filter bar and chips ---
   A chip is the design system's bone tag (.tag.tag-light), whether you set
   the filter here or it came with you from another page (.chip-context).
   .chip only adds the remove link, the on state and
   truncation; colour, size and weight are the tag's. Removing a chip widens
   the list. The URL is the only state, so a filtered list can be shared. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-input {
  position: relative;
  flex: 1 1 220px;
  max-width: 360px;
}

.filter-input input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--hairline);
  background-color: var(--sunk);
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: all 0.3s ease;
}

.filter-input input:focus {
  border-color: var(--field-focus-line);
  box-shadow: 0 0 0 3px var(--field-focus-ring);
}

.filter-input svg {
  position: absolute;
  left: 12px;
  top: 11px;
  width: 14px;
  height: 14px;
  color: var(--ink-faint);
  pointer-events: none;
}

/* A labelled date field in a filter bar, for lists and reports read over a range. */
.filter-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-date input[type="date"] {
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  outline: none;
}

.filter-date input[type="date"]:focus {
  border-color: var(--field-focus-line);
  box-shadow: 0 0 0 3px var(--field-focus-ring);
}

.chip {
  max-width: 100%;
}

.chip:has(.chip-x),
.chip:has(.admin-search-scope-x) {
  padding-right: 4px;
}

.chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The top bar's scope chip shares the remove button but not the class: a
   list's remove link stays the first .chip-x on the page. */
.chip-x,
.admin-search-scope-x {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  color: inherit;
  transition: all 0.3s ease;
}

.chip-x:hover,
.admin-search-scope-x:hover {
  background-color: var(--hairline-hover);
}

/* An on quick filter is the ink tag, the design system's plain .tag
   (Adam, 2026-11-24). */
.chip[aria-pressed="true"] {
  border-color: var(--inverse);
  background-color: var(--inverse);
  color: var(--inverse-fg);
}

.chip-x svg,
.admin-search .admin-search-scope-x svg {
  width: 10px;
  height: 10px;
  color: inherit;
}

/* --- Data table ---
   The app had no table class (Components: Table). Sentence-case headers on one
   hairline, about 40px rows, tabular figures with numbers right-aligned, a
   hover fill on rows. Below 768px the .opt columns hide and the first cell's
   .data-table-fold line shows what they held, so nothing scrolls sideways. */
.table-wrap {
  overflow-x: auto;
  margin: 0 -8px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: var(--canvas);
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: var(--ink-muted);
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--hairline-hover);
  white-space: nowrap;
}

.data-table th a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.3s ease;
}

.data-table th a:hover,
.data-table th[aria-sort="ascending"] a,
.data-table th[aria-sort="descending"] a {
  color: var(--ink);
}

.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  vertical-align: top;
  line-height: 20px;
  overflow-wrap: break-word;
}

/* Secondary lines carry emails and ids, which may break anywhere so a long
   one never widens the table; a cell's own words break only between letters
   when one word cannot fit. */
.data-table td .body-sm {
  overflow-wrap: anywhere;
}

.data-table td .body-sm {
  line-height: 16px;
}

.data-table tbody tr {
  transition: background-color 0.3s ease;
}

.data-table tbody tr:hover td {
  background-color: var(--hover);
}

.data-table .cell-num {
  text-align: right;
  white-space: nowrap;
}

.data-table .cell-muted {
  color: var(--ink-muted);
}

.data-table a.row-link {
  color: var(--ink);
  font-weight: 500;
}

.data-table a.row-link:hover,
.data-table a.ref:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--hairline-active);
}

.data-table a.ref {
  color: var(--ink);
}

.data-table-fold {
  display: none;
}

.table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.table-empty {
  padding: 32px 8px;
  color: var(--ink-muted);
}

@media (max-width: 767px) {
  .table-wrap {
    margin: 0;
  }

  .data-table .opt {
    display: none;
  }

  .data-table td,
  .data-table th {
    padding-left: 4px;
    padding-right: 4px;
  }

  .data-table-fold {
    display: block;
  }
}

/* --- Severity mark ---
   How soon a queue row needs you: Act today, This week, Watching. Its own
   small dot, never a card fill, because the three status tones already mean
   done, waiting and failed. The word is always written beside or in the
   heading, so colour is never the only signal. */
.sev {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sev::before {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 9999px;
  corner-shape: round;
  background-color: var(--ink-faint);
}

.sev-1::before { background-color: var(--danger); }
.sev-2::before { background-color: var(--warning); }
.sev-3::before { background-color: var(--ink-faint); }

/* --- Queue row ---
   One thing that needs an operator: severity, what broke, the records it
   touches, its section, its age and one named next step. On a phone the
   step drops under the title and the section hides. */
.queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.queue-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  grid-template-areas: "sev main age" ". actions actions";
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
  color: var(--ink);
  transition: background-color 0.3s ease;
}

.queue-row:last-child {
  border-bottom: 1px solid var(--hairline);
}

.queue-row > .sev { grid-area: sev; align-self: start; padding-top: 6px; }
.queue-row > .queue-main { grid-area: main; min-width: 0; }
.queue-row > .queue-age { grid-area: age; align-self: start; text-align: right; color: var(--ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.queue-row > .queue-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 4px; }

.queue-title {
  color: var(--ink);
}

@media (min-width: 768px) {
  .queue-row {
    grid-template-columns: 20px minmax(0, 1fr) 64px auto;
    grid-template-areas: "sev main age actions";
    padding: 12px 8px;
  }

  .queue-row:hover {
    background-color: var(--hover);
    border-radius: var(--radius-lg);
  }

  .queue-row > .queue-actions { justify-content: flex-end; }

  /* On Home every row shares one set of columns, so ages, steps and Snooze
     line up down the page; the step column is as wide as its widest button. */
  .admin-home-activity {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto auto auto;
    column-gap: 12px;
  }

  .admin-home-activity > *,
  .admin-home-activity .queue-group > * {
    grid-column: 1 / -1;
  }

  .admin-home-activity .queue-group,
  .admin-home-activity .queue-row {
    display: grid;
    grid-template-columns: subgrid;
  }

  .admin-home-activity .queue-row {
    grid-template-areas: none;
  }

  .admin-home-activity .queue-row > * { grid-area: auto; }
  .admin-home-activity .queue-row > .queue-actions { display: contents; }
  .admin-home-activity .queue-row > .sev { grid-column: 1; }
  .admin-home-activity .queue-row > .queue-main { grid-column: 2; }
  .admin-home-activity .queue-row > .queue-age { grid-column: 3; justify-self: end; align-self: center; }
  .admin-home-activity .queue-actions > a { grid-column: 4; justify-self: end; }
  .admin-home-activity .queue-actions button { grid-column: 5; justify-self: end; }
}

/* --- Admin Home (TA-1652) ---
   The queue beside the machinery panel, one column below 1100px; the line
   an empty queue shows; and a count inside a filter tab. */
.admin-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

@media (min-width: 1100px) {
  .admin-home-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}

.queue-group + .queue-group {
  margin-top: 24px;
}

.queue-parts {
  overflow-wrap: anywhere;
}

/* Home's Activity feed and Running lists (TA-1664): plain rows, the
   records linked, the time at the far right. */
.activity-feed {
  margin-top: 32px;
}

.queue-group + .activity-feed,
.body-sm + .activity-feed {
  margin-top: 40px;
}

.activity-day {
  margin: 16px 0 4px;
}

.activity-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
}

.activity-row:last-child {
  border-bottom: 1px solid var(--hairline);
}

.activity-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.activity-time {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.running-checked {
  margin-bottom: 12px;
  color: var(--ink-muted);
}

.queue-empty {
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-muted);
}

.tab .count {
  color: var(--ink-faint);
  font-size: 11px;
}

/* --- Machinery rows ---
   One piece of the app's own machinery: a status dot with its label, and
   the word and time it is about on the right. The word carries the status,
   so colour is never the only signal. */
.machinery-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
}

.machinery-row:last-child {
  border-bottom: 1px solid var(--hairline);
}

.machinery-detail {
  text-align: right;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 9999px;
  corner-shape: round;
  background-color: var(--ink-faint);
}

.status-dot-ok::before { background-color: var(--success); }
.status-dot-warning::before { background-color: var(--warning); }
.status-dot-danger::before { background-color: var(--danger); }

/* --- Admin search results --- */
.search-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 8px;
  border-top: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  color: var(--ink);
  transition: background-color 0.3s ease;
}

.search-results li:last-child .search-result {
  border-bottom: 1px solid var(--hairline);
}

.search-result:hover {
  background-color: var(--hover);
}

.search-result-label {
  overflow-wrap: anywhere;
}

/* Admin Notifications & emails: the catalogue frame under the page header. */
.notifications-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 480px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
}


/* --- Metric card ---
   One number, its label, the window it covers (.metric-window, set on every
   number that covers a span of time, so "this week" never means two things;
   left off when the label already says what the number is) and a delta in
   moss or brick only where up or down is good or bad. A linked card opens the
   list behind it. */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 32px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  background-color: var(--sunk);
  color: var(--ink-muted);
  transition: all 0.3s ease;
}

.metric-linked {
  position: relative;
}

.metric-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-label .info-tip {
  z-index: 1;
}

.metric-linked:hover {
  border-color: var(--hairline-hover);
  background-color: var(--hover);
}

.metric-value {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.metric-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  min-width: 0;
}

.metric-top .tag { flex-shrink: 0; margin-left: auto; }

.metric-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-window {
  font-size: 11px;
  line-height: 16px;
  color: var(--ink-faint);
}

.metric-delta-up { color: var(--success-text); }
.metric-delta-down { color: var(--danger-text); }
.metric-delta-flat { color: var(--ink-faint); }


.metric-spark {
  display: none;
  margin-left: auto;
  width: 72px;
  height: 20px;
  flex-shrink: 0;
}

.metric-spark path {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
}

@media (min-width: 768px) {
  /* One row while the cards fit, each at least 176px wide: up to six on a
     desktop, wrapping only when there is no room. */
  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    gap: 12px;
  }

  /* Cards whose value or line runs long (the researcher scorecard): at least
     280px each, so three to a row on a desktop. */
  .metrics-wide {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .metric {
    padding: 14px 16px;
  }

  .metric-value {
    font-size: 22px;
    line-height: 30px;
  }

  .metric-spark {
    display: block;
  }
}


/* --- Key-value panel ---
   A record's own facts: key, value, one unbroken hairline between rows (the
   space between key and value is the key's padding, not a grid gap, so the
   line runs across both). Long values wrap instead of widening the page. */
.kv {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  margin: 0;
}

.kv dt {
  color: var(--ink-muted);
  padding: 8px 16px 8px 0;
  border-top: 1px solid var(--hairline);
  line-height: 20px;
}

.kv dd {
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--hairline);
  color: var(--ink);
  line-height: 20px;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* A key-value row with one status tag: the text first, the tag alone at the
   far right (Admin copy rule, 2026-11-23). */
.kv dd.kv-tagged {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.kv dt:first-of-type,
.kv dd:first-of-type {
  border-top: 0;
}

@media (min-width: 768px) {
  .kv {
    grid-template-columns: 196px minmax(0, 1fr);
  }
}

/* A value that is good or bad: moss, brick, or ochre for "look soon". Used in
   key-value panels and table cells; never for decoration. */
.value-positive, .data-table .value-positive { color: var(--success-text); }
.value-negative, .data-table .value-negative { color: var(--danger-text); }
.value-warning, .data-table .value-warning { color: var(--warning-text); }

/* --- Audit timeline ---
   Who did what to which record, why, and when; newest first. An ochre dot
   marks a session where staff viewed an account as its customer. */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 16px 24px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  corner-shape: round;
  background-color: var(--ink);
}

.timeline li::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background-color: var(--hairline-hover);
}

.timeline li:last-child::after {
  display: none;
}

.timeline-what {
  color: var(--ink);
}

.timeline .timeline-impersonation::before {
  background-color: var(--warning);
}

/* The Interview 360 Transcript tab (TA-1876): the transcript in the chat
   panel's message style, and the chosen AI reply's trace in a column that
   stays in view beside it on a desktop. On a phone only the transcript shows
   and the trace opens in the slide-over. */
.transcript-chat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.transcript-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.transcript-right {
  align-items: flex-end;
}

.transcript-left {
  align-items: flex-start;
}

.transcript-meta {
  display: flex;
  gap: 8px;
}

.transcript-turn {
  display: block;
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  padding: 10px 16px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.transcript-turn:hover,
.transcript-turn[aria-current="true"] {
  border-color: var(--hairline-hover);
  background-color: var(--hover);
}

.transcript-turn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.transcript-trace {
  display: none;
}

@media (min-width: 1024px) {
  .transcript-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .transcript-trace {
    display: block;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
}

.turn-trace-frame {
  display: block;
  min-width: 0;
}

.turn-trace-frame[busy] {
  opacity: 0.5;
}

.turn-trace {
  padding: 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background-color: var(--sunk);
}

.turn-trace.turn-trace-modal {
  padding: 0 24px 24px;
  border: 0;
  background: none;
}

.turn-trace .table-empty {
  margin: 0 0 12px;
  padding: 0;
}

.turn-trace-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.turn-trace-step + .turn-trace-step {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.turn-trace-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.turn-trace .kv {
  grid-template-columns: 96px minmax(0, 1fr);
  font-variant-numeric: tabular-nums;
}

.turn-trace-text {
  margin: 8px 0 0;
}

.turn-trace-text dt {
  color: var(--ink-muted);
  margin-top: 8px;
}

.turn-trace-text dd {
  margin: 4px 0 0;
}

.turn-trace-text pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 18px;
  color: var(--ink);
}

.turn-trace-text pre + pre {
  margin-top: 8px;
}

/* --- Panel heading ---
   A section of a record or overview page, with the section it comes from
   and a "See all" that carries the filter. */
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* --- Field name ---
   The name of a value: a fact's key, a metric's label, a filter's label.
   Sentence case in ink at 64%, so it reads as a word, not a heading. Admin
   keeps uppercase only for the breadcrumb, side-nav groups and tags. */
.field-name {
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
}

/* Tabs straight under a page title (Home, the scorecard) sit 24px below it:
   the header's own margin, without the tabs' gap above, which is for tabs
   that follow a record's facts. */
.content-header:has(+ .admin-record-tabs) {
  margin-bottom: 24px;
}

.content-header + .admin-record-tabs {
  margin-top: 0;
}

/* --- Record facts ---
   A hub record's few headline facts under its title (Account 360, a
   person): key over value, in a row that wraps on a phone. The links out
   to other tools sit at the right end of the same row, level with the
   values, and drop below the facts when the row runs out of room. The row
   keeps 24px from whatever follows it, the same as the record tabs keep
   from the content under them; record tabs right under it drop their own
   top margin so the gap stays 24px. */
.record-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 32px;
  margin: 4px 0 calc(var(--spacing) * 6);
}

.record-summary + .admin-record-tabs {
  margin-top: 0;
}

.record-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin: 0;
}

.record-facts dd {
  margin: 2px 0 0;
  color: var(--ink);
}

.record-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  font-size: 12px;
  line-height: 20px;
}

/* --- Info tip (TA-1665) ---
   A small "i" in the disabled ink colour, beside a heading or on a card,
   for detail the screen can do without. The panel opens on hover, keyboard
   focus or tap (info_tip_controller.js), opens toward the side with room
   and stays inside a 390px viewport.
   Self-contained: it changes no rule above. */
.info-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.info-tip-button {
  display: inline-flex;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-disabled);
  cursor: help;
}

.info-tip-button:hover,
.info-tip-button:focus-visible {
  color: var(--ink-muted);
}

.info-tip-button svg {
  width: 16px;
  height: 16px;
}

.info-tip-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: -8px;
  z-index: 30;
  width: max-content;
  max-width: min(280px, calc(100vw - 32px));
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  background-color: var(--inverse);
  color: var(--inverse-fg);
  font-size: 12px;
  font-weight: 400;
  line-height: 17px;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  white-space: normal;
}

.info-tip-panel[data-align="start"] {
  right: auto;
  left: -8px;
}

.info-tip-panel[data-placement="above"] {
  top: auto;
  bottom: calc(100% + 6px);
}

.info-tip-panel[hidden] {
  display: none;
}

/* --- Info tip (TA-1665) ---
   A small "i" in the disabled ink colour, beside a heading or on a card,
   for detail the screen can do without. The panel opens on hover, keyboard
   focus or tap (info_tip_controller.js), opens toward the side with room
   and stays inside a 390px viewport.
   Self-contained: it changes no rule above. */
.info-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.info-tip-button {
  display: inline-flex;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-disabled);
  cursor: help;
}

.info-tip-button:hover,
.info-tip-button:focus-visible {
  color: var(--ink-muted);
}

.info-tip-button svg {
  width: 16px;
  height: 16px;
}

.info-tip-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: -8px;
  z-index: 30;
  width: max-content;
  max-width: min(280px, calc(100vw - 32px));
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  background-color: var(--inverse);
  color: var(--inverse-fg);
  font-size: 12px;
  font-weight: 400;
  line-height: 17px;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  white-space: normal;
}

.info-tip-panel[data-align="start"] {
  right: auto;
  left: -8px;
}

.info-tip-panel[data-placement="above"] {
  top: auto;
  bottom: calc(100% + 6px);
}

.info-tip-panel[hidden] {
  display: none;
}

/* --- Funnel (TA-1664) ---
   admin/application/_funnel, drawn after the study's invite funnel: ink bars
   with 8px corners, a hatched bone gap carrying the next step with its share
   in a white pill, and the outcome step in orange. */
.admin-funnel {
  margin: 0;
}

.admin-funnel-plot,
.admin-funnel-labels {
  display: grid;
  column-gap: 4px;
}

.admin-funnel-plot {
  position: relative;
  height: 160px;
  border-bottom: 1px solid var(--hairline);
}

.admin-funnel-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--hairline);
  pointer-events: none;
}

.admin-funnel-step .admin-chart-card {
  display: none;
  left: 50%;
  transform: translateX(-50%);
}

.admin-funnel-step .admin-chart-card-right {
  top: 0;
  left: calc(100% + 8px);
  transform: none;
}

.admin-funnel-step .admin-chart-card-left {
  top: 0;
  right: calc(100% + 8px);
  left: auto;
  transform: none;
}

.admin-funnel-step:hover .admin-chart-card {
  display: flex;
}

.admin-funnel-plot:has(.admin-funnel-step:hover) .admin-funnel-step:not(:hover) .admin-funnel-bar {
  background-color: var(--bone-300);
  opacity: 1;
}

/* The ink card a chart shows on hover (TA-1664): the date or step, the value,
   and its change or share. Chart.js charts draw the same card on canvas
   (admin_charts.js); this is the HTML one for charts drawn in a view. */
.admin-chart-card {
  position: absolute;
  z-index: 5;
  flex-direction: column;
  width: max-content;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  background-color: var(--inverse);
  color: var(--inverse-fg);
  font-size: 12px;
  line-height: 16px;
  pointer-events: none;
}

.admin-chart-card-title {
  color: var(--inverse-fg-muted);
}

.admin-chart-card-value {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.admin-funnel-step,
.admin-funnel-gap {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding-bottom: 2px;
}

.admin-funnel-bar,
.admin-funnel-carry {
  width: 100%;
  border-radius: var(--radius-lg);
}

.admin-funnel-bar {
  background-color: var(--inverse);
}

.admin-funnel-outcome {
  background-color: var(--orange-600);
  opacity: 0.78;
}

.admin-funnel-carry {
  background: repeating-linear-gradient(-45deg, var(--bone-500) 0 1px, var(--bone-50) 1px 5px);
}

.admin-funnel-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--bone-200);
  border-radius: 999px;
  corner-shape: round;
  background-color: var(--surface);
  font-size: 11px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.admin-funnel-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 12px;
  text-align: center;
}

.admin-funnel-count {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

