/* SharePi — Share Ventures Design System 2.0.0 */

@font-face {
  font-family: "Aeonik Pro";
  src: url("fonts/aeonikprovf.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --sv-black: #000000;
  --sv-white: #ffffff;
  --sv-off-white: #e8e6e4;
  --sv-home-bg: #f1f4f5;
  --sv-gray-light: #c8cbcc;
  --sv-gray-mid: #939799;
  --sv-gray-dark: #5e6366;
  --sv-gray-xdark: #2b3033;
  --sv-green: #00d65d;

  --sv-surface: var(--sv-home-bg);
  --sv-surface-raised: var(--sv-white);
  --sv-surface-sunken: var(--sv-off-white);
  --sv-ink: var(--sv-black);
  --sv-ink-secondary: var(--sv-gray-dark);
  --sv-ink-tertiary: var(--sv-gray-mid);
  --sv-hairline: var(--sv-gray-light);
  --sv-accent: var(--sv-green);
  --sv-accent-ink: var(--sv-black);

  --sv-font-sans: "Aeonik Pro", "Aeonik", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --sv-text-display: clamp(3rem, 8vw, 6rem);
  --sv-text-h1: clamp(2.5rem, 5vw, 3.5rem);
  --sv-text-h2: clamp(2rem, 3.5vw, 2.5rem);
  --sv-text-h3: 1.75rem;
  --sv-text-h4: 1.25rem;
  --sv-text-intro: 1.5rem;
  --sv-text-body: 1.125rem;
  --sv-text-small: 0.9375rem;
  --sv-text-caption: 0.8125rem;
  --sv-leading-display: 1.02;
  --sv-leading-heading: 1.1;
  --sv-leading-intro: 1.35;
  --sv-leading-body: 1.6;
  --sv-tracking-display: -0.02em;
  --sv-tracking-heading: -0.01em;
  --sv-tracking-caps: 0.04em;

  --sv-space-1: 0.25rem;
  --sv-space-2: 0.5rem;
  --sv-space-3: 0.75rem;
  --sv-space-4: 1rem;
  --sv-space-5: 1.25rem;
  --sv-space-6: 1.5rem;
  --sv-space-8: 2rem;
  --sv-space-12: 3rem;
  --sv-space-16: 4rem;
  --sv-space-24: 6rem;
  --sv-space-32: 8rem;
  --sv-space-48: 12rem;

  --sv-container: 90rem;
  --sv-gutter: clamp(1.25rem, 4vw, 4rem);
  --sv-rail: 18rem;
  --sv-activity-rail: 20rem;
  --sv-radius: 0;
  --sv-hairline-w: 1px;

  --sv-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sv-ease-inout: cubic-bezier(0.76, 0, 0.24, 1);
  --sv-dur-instant: 100ms;
  --sv-dur-fast: 200ms;
  --sv-dur-base: 300ms;
  --sv-dur-slow: 600ms;
  --sv-dur-cine: 1000ms;

  --sv-z-nav: 100;
  --sv-z-overlay: 200;
  --sv-z-modal: 300;
  --sv-z-toast: 400;
}

.sv-dark {
  --sv-surface: var(--sv-black);
  --sv-surface-raised: var(--sv-gray-xdark);
  --sv-surface-sunken: var(--sv-black);
  --sv-ink: var(--sv-white);
  --sv-ink-secondary: var(--sv-gray-light);
  --sv-ink-tertiary: var(--sv-gray-mid);
  --sv-hairline: var(--sv-gray-dark);
  --sv-accent: var(--sv-green);
  --sv-accent-ink: var(--sv-black);
  color: var(--sv-ink);
  background: var(--sv-surface);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  scrollbar-color: var(--sv-gray-dark) transparent;
  scrollbar-width: thin;
}

html,
body {
  width: 100%;
  height: 100%;
}

html {
  background: var(--sv-home-bg);
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--sv-black);
  background: var(--sv-home-bg);
  font-family: var(--sv-font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  border-radius: var(--sv-radius);
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--sv-green);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--sv-black);
  background: var(--sv-gray-light);
}

.response-selection-actions {
  position: fixed;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  color: var(--sv-white);
  background: var(--sv-black);
  border: 1px solid var(--sv-gray-xdark);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.response-selection-actions button {
  min-height: 32px;
  padding: 0 10px;
  color: inherit;
  font: inherit;
  font-size: 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.response-selection-actions button:hover,
.response-selection-actions button:focus-visible {
  color: var(--sv-black);
  background: var(--sv-green);
  outline: 0;
}

.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.brand-mark {
  display: block;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: currentColor;
  font-size: 18px;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Supplied SharePi logo: preserve its square artwork and crop the black field
   to the circular outer ring rather than stretching it into a wordmark icon. */
.wordmark-symbol {
  display: block;
  height: 1.8em;
  width: 1.8em;
  flex: none;
  object-fit: cover;
  border-radius: 50%;
}

.wordmark-text b {
  font-weight: 700;
}

.wordmark-text span {
  font-weight: 300;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: calc(var(--sv-z-modal) + 1);
  top: var(--sv-space-4);
  left: 50%;
  min-height: 44px;
  padding: var(--sv-space-3) var(--sv-space-6);
  color: var(--sv-white);
  background: var(--sv-black);
  font-weight: 500;
  text-decoration: none;
  transform: translate(-50%, calc(-100% - var(--sv-space-6)));
  transition: transform var(--sv-dur-fast) var(--sv-ease-out);
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-width, var(--sv-rail)) minmax(0, 1fr);
  width: 100%;
  height: 100svh;
  overflow: hidden;
}

.app.activity-open {
  grid-template-columns: var(--sidebar-width, var(--sv-rail)) minmax(0, 1fr) var(--sv-activity-rail);
}

/* Sidebar */

.sidebar {
  position: relative;
  z-index: var(--sv-z-nav);
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* see .main: implicit auto columns don't shrink */
  /* head / primary nav / project list / footer. The PROJECTS caption row is
   * gone: the workspace groups inside the list already name their sections. */
  grid-template-rows: var(--sv-space-16) auto minmax(0, 1fr) var(--sv-space-16);
  width: var(--sidebar-width, var(--sv-rail));
  min-width: 0;
  overflow: hidden;
  border-right: var(--sv-hairline-w) solid var(--sv-hairline);
}

.app.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app.sidebar-collapsed.activity-open {
  grid-template-columns: 0 minmax(0, 1fr) var(--sv-activity-rail);
}

.app.sidebar-collapsed .sidebar {
  visibility: hidden;
  transform: translateX(-100%);
}

.sidebar-resize-handle {
  position: absolute;
  z-index: calc(var(--sv-z-nav) + 1);
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-width, var(--sv-rail)) - 4px);
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}

.sidebar-resize-handle::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  background: var(--sv-green);
  content: "";
  opacity: 0;
  transition: opacity var(--sv-dur-fast) var(--sv-ease-out);
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle:focus-visible::after,
.app.is-resizing-sidebar .sidebar-resize-handle::after { opacity: 1; }

.app.sidebar-collapsed .sidebar-resize-handle { display: none; }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-4);
  padding: 0 var(--sv-space-4) 0 var(--sv-space-6);
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
}

.sidebar-head-actions { position: relative; display: flex; flex: none; }
.sidebar-head-actions .icon-btn { width: 40px; height: 40px; flex-basis: 40px; color: var(--sv-gray-light); }
.app-launcher-menu {
  position: fixed;
  z-index: var(--sv-z-nav);
  top: 54px;
  left: min(calc(var(--sidebar-width, var(--sv-rail)) - 256px), 32px);
  width: 248px;
  padding: var(--sv-space-3);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sv-space-2);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-mid);
}
.app-launcher-menu[hidden] { display: none; }
.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sv-space-1);
  padding: var(--sv-space-2) var(--sv-space-1);
  min-height: 44px;
  color: inherit;
  text-decoration: none;
  text-align: center;
}
.app-tile:hover, .app-tile:focus-visible { background: var(--sv-surface-sunken); outline-offset: -2px; }
.app-tile[aria-current="page"] { color: var(--sv-gray-dark); cursor: default; }
.app-tile-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sv-off-white);
  font-size: var(--sv-text-small);
  font-weight: 600;
  color: var(--sv-gray-xdark);
  flex-shrink: 0;
}
.app-tile-icon::before { content: attr(data-initials); }
.app-tile[aria-current="page"] .app-tile-icon { opacity: 0.5; }
.app-tile-name {
  font-size: var(--sv-text-caption);
  line-height: 1.2;
  word-break: break-word;
}

.brand {
  display: flex;
  min-width: 0;
  color: var(--sv-white);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  color: inherit;
  background: transparent;
  border: var(--sv-hairline-w) solid transparent;
  transition:
    color var(--sv-dur-instant) var(--sv-ease-out),
    background-color var(--sv-dur-instant) var(--sv-ease-out),
    border-color var(--sv-dur-instant) var(--sv-ease-out);
}

.icon-btn:hover {
  color: var(--sv-ink);
  border-color: var(--sv-hairline);
}

.sidebar-primary {
  padding: var(--sv-space-4);
}

.new-chat-btn,
.welcome-action,
.auth-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sv-space-3);
  min-width: 160px;
  height: 48px;
  padding: 0 var(--sv-space-6);
  color: var(--sv-surface);
  background: var(--sv-ink);
  border: var(--sv-hairline-w) solid transparent;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out),
    border-color var(--sv-dur-fast) var(--sv-ease-out);
}

.sidebar .new-chat-btn {
  width: 100%;
}

/* New chat + New project sit side by side, and stack once the sidebar is too
 * narrow for two labels. auto-fit + a 140px floor does this off the real column
 * width, so it tracks the resize handle and not just the viewport; 140px is the
 * measured point where "New project" stops ellipsing. */
.sidebar-create {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sv-space-3);
  /* Creating things and browsing things are two different jobs: this gap is
   * wider than the 12px between the nav rows so the split reads as a group
   * break rather than an uneven list. */
  margin-bottom: var(--sv-space-5);
}

.sidebar-create .new-chat-btn {
  min-width: 0;
  padding: 0 var(--sv-space-4);
  font-size: var(--sv-text-small);
}

.sidebar-create .new-chat-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Secondary weight: same size and hit area as New chat, outlined not filled,
 * so the primary action stays the obvious one. */
.new-chat-btn.secondary {
  color: var(--sv-ink);
  background: transparent;
  border-color: var(--sv-hairline);
}

/* The sidebar is always .sv-dark, so hover fills with the raised surface
 * (gray-xdark) — --sv-gray-light would put white ink on a near-white plate. */
.new-chat-btn.secondary:hover {
  color: var(--sv-ink);
  border-color: var(--sv-ink);
  background: var(--sv-surface-raised);
}

.chat-search-btn {
  display: flex;
  align-items: center;
  gap: var(--sv-space-3);
  width: 100%;
  height: 40px;
  margin-bottom: var(--sv-space-3);
  padding: 0 var(--sv-space-4);
  color: var(--sv-ink-secondary);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  font-size: var(--sv-text-small);
  text-align: left;
}
.chat-search-btn:hover,
.chat-search-btn.active { color: var(--sv-ink); border-color: var(--sv-ink); }
.chat-search-btn.active { background: var(--sv-gray-light); }
.chat-search-btn .icon { width: 17px; height: 17px; }
.chat-search-btn kbd { margin-left: auto; font-size: 11px; color: var(--sv-gray-dark); }

.messages-nav-btn .messages-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 1px 6px;
  color: var(--sv-black);
  background: var(--sv-green);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.new-chat-btn .icon,
.welcome-action .icon {
  width: 20px;
  height: 20px;
}

.new-chat-btn:hover,
.welcome-action:hover,
.auth-signout:hover {
  color: var(--sv-ink);
  background: transparent;
  border-color: var(--sv-ink);
}

.sidebar-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  /* Carries the hairline the removed PROJECTS header used to provide, so the
   * list still reads as its own region under the nav. */
  padding: var(--sv-space-2) 0 var(--sv-space-6);
  border-top: var(--sv-hairline-w) solid var(--sv-hairline);
}

.project {
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-xdark);
}

.project-row,
.thread-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--sv-ink-secondary);
  background: transparent;
  transition:
    color var(--sv-dur-instant) var(--sv-ease-out),
    background-color var(--sv-dur-instant) var(--sv-ease-out);
}

.project-row {
  padding: 0 var(--sv-space-2) 0 var(--sv-space-1);
  color: var(--sv-ink);
  font-size: var(--sv-text-small);
  font-weight: 500;
}

/* Reorder grip: reserved space at all times so revealing it on hover never
   shifts the row label. */
.project-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 32px;
  flex: 0 0 20px;
  color: var(--sv-ink-secondary);
  background: transparent;
  border: 0;
  opacity: 0;
  cursor: grab;
  touch-action: none;
  transition: opacity var(--sv-dur-instant) var(--sv-ease-out);
}

.project-drag .icon {
  width: 16px;
  height: 16px;
}

.project-row:hover .project-drag,
.project-row:focus-within .project-drag,
.project.is-reordering .project-drag {
  opacity: 1;
}

.project-drag:focus-visible {
  opacity: 1;
  outline: var(--sv-hairline-w) solid var(--sv-hairline);
  outline-offset: -1px;
}

/* The row being dragged lifts out of the list; everything else keeps its own
   hairline so the drop position stays readable. */
.project.is-reordering {
  position: relative;
  z-index: 2;
  background: var(--sv-surface);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
}

.project.is-reordering .project-row {
  color: var(--sv-white);
  background: var(--sv-gray-xdark);
}

.project.is-reordering .project-drag {
  cursor: grabbing;
}

/* A drag must not select row labels or hover-highlight rows it passes over. */
body.reordering-projects {
  cursor: grabbing;
  user-select: none;
}

body.reordering-projects .project-row:hover,
body.reordering-projects .thread-row:hover {
  color: var(--sv-ink-secondary);
  background: transparent;
}

body.reordering-projects .project.is-reordering .project-row {
  color: var(--sv-white);
  background: var(--sv-gray-xdark);
}

.thread-row {
  padding: 0 var(--sv-space-2) 0 var(--sv-space-12);
  font-size: var(--sv-text-small);
  font-weight: 400;
}

.project-row:hover,
.thread-row:hover,
.project-row:focus-within,
.thread-row:focus-within,
.thread-row.selected {
  color: var(--sv-white);
  background: var(--sv-gray-xdark);
}


.chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--sv-space-6);
  height: var(--sv-space-6);
  flex: 0 0 var(--sv-space-6);
  margin-right: var(--sv-space-1);
  transition: transform var(--sv-dur-fast) var(--sv-ease-out);
}

.chevron .icon {
  width: 16px;
  height: 16px;
}

.project.open .chevron {
  transform: rotate(90deg);
}

/* Live-agent status dot: a quiet ring when idle, a gentle accent pulse while a
   turn is in flight (including turns started in another tab or resumed after a
   restart). Sidebar rows and the thread header share the same mark. */
.status-dot {
  position: relative;
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  margin-right: var(--sv-space-2);
  border: 1px solid var(--sv-gray-dark);
  border-radius: 50%;
  background: transparent;
  transition:
    background-color var(--sv-dur-fast) var(--sv-ease-out),
    border-color var(--sv-dur-fast) var(--sv-ease-out);
}

.status-dot.live {
  border-color: var(--sv-green);
  background: var(--sv-green);
  animation: status-breathe 1800ms var(--sv-ease-inout) infinite;
}

/* The halo is a pseudo-element so the dot itself never shifts layout. */
.status-dot.live::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid var(--sv-green);
  border-radius: 50%;
  animation: status-halo 1800ms var(--sv-ease-out) infinite;
}

.project-row .status-dot,
.thread-row .status-dot {
  opacity: 0.55;
}

.project-row .status-dot.live,
.thread-row .status-dot.live,
.thread-row.selected .status-dot {
  opacity: 1;
}

.thread-status {
  width: 7px;
  height: 7px;
  flex-basis: 7px;
  margin-right: var(--sv-space-1);
  border-color: var(--sv-gray-mid);
}

@keyframes status-breathe {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

@keyframes status-halo {
  0% {
    opacity: 0.5;
    transform: scale(0.6);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.project-name,
.thread-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-name,
.thread-name {
  flex: 1 1 0;
}

.thread-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  white-space: normal;
}

.thread-title-text,
.thread-live-status {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-live-status {
  color: var(--sv-green);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.thread-row:has(.thread-live-status) {
  min-height: 58px;
}

/* Unanswered is not progress; it must not borrow the working-green. */
.thread-live-status[data-phase="stalled"] { color: #b42318; }

.thread-row.selected .thread-live-status,
.thread-row:hover .thread-live-status {
  color: var(--sv-green);
}

.thread-row.selected .thread-live-status[data-phase="stalled"],
.thread-row:hover .thread-live-status[data-phase="stalled"] {
  color: #b42318;
}

.row-actions {
  display: flex;
  align-items: center;
  /* Fixed-size targets that must never be pushed past the rail's edge: the row
   * label yields instead (it already truncates). */
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--sv-dur-instant) var(--sv-ease-out);
}

.project-row:hover .row-actions,
.thread-row:hover .row-actions,
.project-row:focus-within .row-actions,
.thread-row:focus-within .row-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Actions never participate in row layout. On devices without hover they are
   permanently visible; leaving them in the flex row made their invisible (or
   hidden) hit area consume the label, which read like a vertical line blocking
   text. Hover rows use the same ink as their parent; touch rows use the sidebar
   surface so the controls remain legible. */
.project-row .row-actions,
.thread-row .row-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  padding-left: var(--sv-space-2);
  background: var(--sv-gray-xdark);
}

@media (hover: none) {
  .project-row .row-actions,
  .thread-row .row-actions {
    background: var(--sv-surface);
  }

  /* Keep labels out from under always-visible touch controls. These margins
     reserve only the visible action cluster; hidden desktop controls reserve
     nothing. */
  .project-row:has(.row-actions .icon-btn:nth-child(3)) .project-name { margin-right: 104px; }
  .project-row:has(.row-actions .icon-btn:nth-child(4)) .project-name { margin-right: 136px; }
  .project-row:has(.row-actions .icon-btn:nth-child(5)) .project-name { margin-right: 168px; }
  .thread-row:has(.row-actions .icon-btn:nth-child(2)) .thread-name { margin-right: 72px; }
  .thread-row:has(.row-actions .icon-btn:nth-child(3)) .thread-name { margin-right: 104px; }
  .thread-row:has(.row-actions .icon-btn:nth-child(4)) .thread-name { margin-right: 136px; }
}

.row-actions .icon-btn {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.row-actions .icon {
  width: 16px;
  height: 16px;
}

.row-actions .danger:hover {
  color: var(--sv-white);
}

.threads {
  display: block;
}

.project:not(.open) .threads {
  display: none;
}

.threads-inner {
  border-top: var(--sv-hairline-w) solid var(--sv-gray-xdark);
}

.sidebar-empty {
  padding: var(--sv-space-8) var(--sv-space-6);
  color: var(--sv-ink-secondary);
  font-size: var(--sv-text-small);
  line-height: 1.5;
}

.sidebar-empty p {
  margin: 0 0 var(--sv-space-4);
}

.sidebar-empty button {
  padding: 0;
  color: var(--sv-white);
  background: transparent;
  border-bottom: 1px solid currentColor;
  font-size: inherit;
  font-weight: 500;
}

.inline-input {
  width: 100%;
  height: 36px;
  min-width: 0;
  padding: 0 var(--sv-space-2);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-black);
}

.sidebar-foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sv-space-3);
  min-width: 0;
  padding: 0 var(--sv-space-4) 0 var(--sv-space-6);
  border-top: var(--sv-hairline-w) solid var(--sv-hairline);
}

/* Profile row: identity plus the per-viewer view switches (archived chats,
 * hidden workspaces), kept out of the primary nav. */
.profile-trigger {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: var(--sv-space-3);
  min-width: 0;
  height: 52px;
  margin-left: calc(var(--sv-space-6) * -1);
  padding: 0 var(--sv-space-2) 0 var(--sv-space-6);
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.profile-trigger:hover .profile-name,
.profile-trigger[aria-expanded="true"] .profile-name {
  color: var(--sv-white);
}

.profile-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--sv-ink-secondary);
  transform: rotate(-90deg);
  transition: transform var(--sv-dur-fast) var(--sv-ease-out);
}

.profile-trigger[aria-expanded="true"] .profile-chevron {
  transform: rotate(90deg);
}

.profile-menu {
  position: absolute;
  right: var(--sv-space-4);
  bottom: calc(100% + var(--sv-space-2));
  left: var(--sv-space-4);
  z-index: 5;
  display: grid;
  gap: 0;
  padding: var(--sv-space-2);
  background: var(--sv-black);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
}

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

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sv-space-3);
  width: 100%;
  height: 40px;
  padding: 0 var(--sv-space-3);
  color: var(--sv-ink-secondary);
  background: transparent;
  border: 0;
  font-size: var(--sv-text-small);
  text-align: left;
}

.profile-menu-item:hover,
.profile-menu-item[aria-pressed="true"] {
  color: var(--sv-white);
  background: var(--sv-gray-xdark);
}

.profile-menu-item .icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.profile-menu-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 28px;
  flex: 0 0 24px;
  color: var(--sv-white);
}

.profile-avatar img {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 50%;
}

.profile-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-name {
  color: var(--sv-white);
  font-size: var(--sv-text-small);
  font-weight: 500;
}


.user-button-slot {
  display: flex;
  flex: 0 0 auto;
}

.user-button-slot:empty {
  display: none;
}

.sidebar-scrim {
  display: none;
}

/* Thread activity */

.activity-panel {
  position: relative;
  z-index: 1;
  display: none;
  grid-template-columns: minmax(0, 1fr); /* see .main: implicit auto columns don't shrink */
  grid-template-rows: var(--sv-space-16) minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  color: var(--sv-black);
  background: rgb(255 255 255 / 0.78);
  border-left: var(--sv-hairline-w) solid rgb(200 203 204 / 0.72);
  box-shadow: -12px 0 32px rgb(0 0 0 / 0.04);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
}

.app.activity-open .activity-panel {
  display: grid;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-4);
  padding: 0 var(--sv-space-4) 0 var(--sv-space-6);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.activity-head h2 {
  margin: 0;
  font-size: var(--sv-text-small);
  font-weight: 700;
  line-height: 1.2;
}

.activity-close-btn {
  display: none;
}

.activity-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.activity-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.assumptions-section,
.todos-section,
.agent-messages-section {
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.assumptions-section h3,
.todos-section h3,
.agent-messages-section h3,
.activity-section-heading {
  padding: var(--sv-space-4) var(--sv-space-6) var(--sv-space-2);
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.assumptions-list {
  display: grid;
  gap: var(--sv-space-2);
  padding: 0 var(--sv-space-6) var(--sv-space-4) calc(var(--sv-space-6) + 1.25rem);
  margin: 0;
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  line-height: 1.45;
}

.assumptions-list li {
  padding-left: var(--sv-space-1);
  overflow-wrap: anywhere;
}

.assumptions-empty,
.todos-empty {
  padding: 0 var(--sv-space-6) var(--sv-space-4);
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 300;
}

.todos-list {
  display: grid;
  gap: var(--sv-space-2);
  padding: 0 var(--sv-space-6) var(--sv-space-4);
  margin: 0;
  list-style: none;
}

.todos-list li {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: var(--sv-space-2);
  align-items: start;
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  line-height: 1.45;
  overflow-wrap: anywhere;
  position: relative;
}

/* Dependency depth reads as one cascade; flat lists carry no data-level. */
.todos-list li[data-level="1"] { margin-left: 0.85rem; }
.todos-list li[data-level="2"] { margin-left: 1.7rem; }
.todos-list li[data-level="3"] { margin-left: 2.55rem; }
.todos-list li[data-level="4"] { margin-left: 3.4rem; }

.todos-list li[data-level]:not([data-level="0"])::before {
  position: absolute;
  top: 0.55em;
  left: -0.6rem;
  width: 0.45rem;
  height: var(--sv-hairline-w);
  background: var(--sv-gray-light);
  content: "";
}

.todo-body {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.todo-needs {
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 300;
}

.todos-list li.is-blocked .todo-text { color: var(--sv-gray-dark); }
.todos-list li.is-blocked .todo-mark { border-style: dashed; }

.todo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-top: 0.22em;
  color: var(--sv-white);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
}

.todos-list li.is-done .todo-text { color: var(--sv-gray-dark); text-decoration: line-through; }
.todos-list li.is-done .todo-mark { color: var(--sv-black); background: var(--sv-green); border-color: var(--sv-green); }

.agent-messages-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.agent-message {
  padding: var(--sv-space-3) var(--sv-space-6) var(--sv-space-4);
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.agent-message-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--sv-space-2);
}

.agent-message-direction {
  padding: 2px 6px;
  color: var(--sv-black);
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--sv-home-bg);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  text-transform: uppercase;
}

.agent-message[data-direction="received"] .agent-message-direction {
  background: color-mix(in srgb, var(--sv-green) 28%, white);
  border-color: color-mix(in srgb, var(--sv-green) 55%, white);
}

.agent-message-peer {
  overflow: hidden;
  font-size: var(--sv-text-small);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-message-exchange {
  margin-top: var(--sv-space-2);
}

.agent-message-exchange summary {
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  cursor: pointer;
}

.agent-message-exchange summary:focus-visible {
  outline: 2px solid var(--sv-green);
  outline-offset: 2px;
}

.agent-message-content {
  padding: var(--sv-space-3);
  margin-top: var(--sv-space-2);
  color: var(--sv-black);
  font-size: var(--sv-text-caption);
  background: rgb(241 244 245 / 0.72);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.agent-message-content strong {
  display: block;
  margin-bottom: var(--sv-space-1);
  font-size: 0.6875rem;
  text-transform: uppercase;
}

.agent-message-content p {
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.agent-message-content p + strong {
  margin-top: var(--sv-space-3);
}

.activity-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--sv-space-3);
  padding: var(--sv-space-4) var(--sv-space-6);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.activity-tool-group {
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.activity-tool-summary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 16px;
  align-items: start;
  gap: var(--sv-space-3);
  padding: var(--sv-space-4) var(--sv-space-6);
  cursor: pointer;
  list-style: none;
}

.activity-tool-summary::-webkit-details-marker {
  display: none;
}

.activity-tool-summary:focus-visible {
  outline: 2px solid var(--sv-green);
  outline-offset: -2px;
}

.activity-tool-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 32px;
  transition: transform var(--sv-dur-fast) var(--sv-ease-out);
}

.activity-tool-chevron .icon {
  width: 16px;
  height: 16px;
}

.activity-tool-group details[open] .activity-tool-chevron {
  transform: rotate(90deg);
}

.activity-tool-hint::before {
  content: "Expand to view";
}

.activity-tool-group details[open] .activity-tool-hint::before {
  content: "Hide details";
}

.activity-tool-list {
  padding: 0;
  margin: 0;
  background: rgb(241 244 245 / 0.48);
  list-style: none;
}

.activity-tool-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sv-space-3);
  padding: var(--sv-space-3) var(--sv-space-6) var(--sv-space-3)
    calc(var(--sv-space-6) + 32px + var(--sv-space-3));
  border-top: var(--sv-hairline-w) solid rgb(200 203 204 / 0.64);
}

.activity-tool-entry-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--sv-space-1);
}

.activity-tool-entry-title {
  overflow: hidden;
  color: var(--sv-black);
  font-size: var(--sv-text-caption);
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-tool-entry-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sv-gray-dark);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.3;
}

.activity-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--sv-black);
  background: var(--sv-home-bg);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.activity-icon .icon {
  width: 16px;
  height: 16px;
}

.activity-item[data-status="running"] .activity-icon,
.activity-tool-group[data-status="running"] .activity-icon {
  background: var(--sv-green);
  border-color: var(--sv-green);
}

.activity-item-main {
  min-width: 0;
}

.activity-item-meta,
.activity-item-status {
  display: flex;
  align-items: center;
}

.activity-item-meta {
  justify-content: space-between;
  gap: var(--sv-space-2);
  margin-bottom: var(--sv-space-1);
}

.activity-kind,
.activity-time,
.activity-item-status {
  color: var(--sv-gray-dark);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.3;
}

.activity-kind {
  overflow: hidden;
  letter-spacing: var(--sv-tracking-caps);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.activity-time {
  flex: 0 0 auto;
  font-weight: 300;
}

.activity-title {
  display: block;
  overflow: hidden;
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.activity-title:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.activity-detail {
  display: -webkit-box;
  margin-top: var(--sv-space-1);
  overflow: hidden;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 300;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.activity-message {
  display: block;
  width: 100%;
  padding: 0;
  margin-top: var(--sv-space-1);
  overflow: hidden;
  color: var(--sv-gray-dark);
  font-family: inherit;
  font-size: var(--sv-text-caption);
  font-weight: 300;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
}

.activity-message.is-expanded {
  max-height: 14rem;
  padding: var(--sv-space-2) var(--sv-space-3);
  overflow-y: auto;
  white-space: pre-wrap;
  background: rgb(241 244 245 / 0.72);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  overflow-wrap: anywhere;
}

.activity-message:hover {
  color: var(--sv-black);
}

.activity-message:focus-visible {
  outline: 2px solid var(--sv-green);
  outline-offset: -2px;
}

.activity-item-status {
  gap: 6px;
  margin-top: var(--sv-space-2);
}

.activity-status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  background: var(--sv-gray-mid);
}

.activity-item[data-status="running"] .activity-status-dot {
  background: var(--sv-green);
  animation: activity-pulse 1.2s var(--sv-ease-inout) infinite;
}

.activity-item[data-status="error"] .activity-status-dot {
  background: var(--sv-black);
  outline: 1px solid var(--sv-black);
  outline-offset: 2px;
}

.activity-tool-entry[data-status="running"] .activity-status-dot {
  background: var(--sv-green);
  animation: activity-pulse 1.2s var(--sv-ease-inout) infinite;
}

.activity-tool-entry[data-status="error"] .activity-status-dot {
  background: var(--sv-black);
  outline: 1px solid var(--sv-black);
  outline-offset: 2px;
}

@keyframes activity-pulse {
  50% {
    opacity: 0.35;
  }
}

.activity-empty {
  display: flex;
  min-height: 18rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sv-space-8) var(--sv-space-6);
  color: var(--sv-gray-dark);
}

.activity-list:not(:empty) + .activity-empty {
  display: none;
}

.activity-empty p {
  margin: 0 0 var(--sv-space-2);
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 700;
}

.activity-empty span {
  max-width: 28ch;
  font-size: var(--sv-text-caption);
  font-weight: 300;
  line-height: 1.5;
}

.activity-toggle-btn {
  position: relative;
}

.activity-count {
  position: absolute;
  top: 1px;
  /* Flush with the button box: a negative inset overhung the header's right
   * gutter on phones, where the gutter is 12px rather than 4rem. */
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  color: var(--sv-white);
  background: var(--sv-black);
  border: 2px solid var(--sv-home-bg);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.activity-toggle-btn.has-running .activity-count {
  color: var(--sv-black);
  background: var(--sv-green);
}

.activity-scrim {
  display: none;
}

/* Main conversation */

.main {
  position: relative;
  display: grid;
  /* Rows-only templates still generate an implicit column, and that column is
   * auto-sized — so it floors at the widest child's min-content (the composer)
   * and refuses to shrink. On a zoomed-in phone (Safari page zoom shrinks the
   * effective viewport to ~220px) the whole shell rendered ~526px wide and got
   * clipped. Declaring the single column as minmax(0, 1fr) makes the grid track
   * the viewport instead of its contents. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--sv-space-16) minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: var(--sv-black);
  background: var(--sv-home-bg);
}

.thread-head {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-4);
  min-width: 0;
  padding: 0 var(--sv-gutter);
  background: var(--sv-home-bg);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.thread-leading,
.thread-actions,
.thread-context-actions {
  display: flex;
  align-items: center;
  min-width: 0;
}

.thread-leading {
  /* Take the slack: the title truncates, the action buttons never shrink. */
  flex: 1 1 auto;
  gap: var(--sv-space-3);
}

/* The live dot belongs to the title line, so it is a grid cell in that row
 * rather than a flex item nudged by a magic margin (which sat ~3px above the
 * title's cap axis on phones and read as a floating bullet). Centring on the
 * title's line box puts it exactly on the cap centre at every text size. */
.thread-heading {
  display: grid;
  /* The dot column is a fixed reservation, not auto: the title then keeps the
   * same indent whether or not the dot is rendered, so it does not jump
   * sideways when a turn starts. */
  grid-template-columns: calc(7px + var(--sv-space-2)) minmax(0, 1fr);
  grid-template-areas:
    "dot title"
    ".   sub";
  align-items: center;
  min-width: 0;
}

.thread-heading > .thread-status {
  grid-area: dot;
  margin-right: 0;
  justify-self: start;
}

.thread-heading > .thread-title {
  grid-area: title;
}

.thread-heading > .thread-subline {
  grid-area: sub;
}

/* Subtitle and turn status share one line instead of stacking a third row
 * (which grew the header and showed a second, duplicate live dot). */
.thread-subline {
  display: flex;
  align-items: baseline;
  gap: var(--sv-space-2);
  min-width: 0;
}

.thread-subline .thread-context {
  flex: 0 1 auto;
}

.thread-title,
.thread-context {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-title {
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 700;
  line-height: 1.25;
}

.thread-context {
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 300;
  line-height: 1.25;
}

.thread-actions {
  /* Never let the action cluster be squeezed narrower than its buttons —
   * min-width:0 + intrinsic children pushed the last icon off-screen on phones. */
  flex: 0 0 auto;
  gap: var(--sv-space-1);
}

.thread-context-actions {
  display: flex;
  align-items: center;
  gap: var(--sv-space-1);
}

.thread-actions .icon-btn {
  color: var(--sv-black);
}

.share-thread-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sv-space-2);
  min-width: 96px;
  height: 40px;
  padding: 0 var(--sv-space-4);
  color: var(--sv-white);
  background: var(--sv-black);
  border: var(--sv-hairline-w) solid var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 600;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out);
}

.share-thread-button .icon {
  width: 18px;
  height: 18px;
}

.share-thread-button:hover {
  color: var(--sv-black);
  background: transparent;
}

.share-thread-button.active::after {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: var(--sv-green);
  border: 1px solid var(--sv-black);
  content: "";
}

.share-thread-button:disabled {
  color: var(--sv-gray-dark);
  background: var(--sv-gray-light);
  border-color: var(--sv-gray-light);
}

.share-thread-button.loading .icon {
  animation: share-button-pulse 750ms var(--sv-ease-inout) infinite alternate;
}

@keyframes share-button-pulse {
  to { opacity: 0.35; }
}

.sidebar-open-btn {
  display: none;
}

.app.sidebar-collapsed .sidebar-open-btn {
  display: inline-flex;
}

.messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sv-space-12) var(--sv-gutter) var(--sv-space-16);
  scroll-behavior: smooth;
}

.messages-inner {
  width: min(100%, 64rem);
  margin: 0 auto;
}

.msg,
.status-line,
.notice {
  width: 100%;
}

.msg + .msg,
.msg + .status-line,
.msg + .notice,
.status-line + .msg,
.notice + .msg {
  margin-top: var(--sv-space-8);
}

.msg.assistant {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: var(--sv-space-6);
  padding-top: var(--sv-space-6);
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.msg.user {
  display: flex;
  justify-content: flex-end;
}

.msg.user .bubble {
  width: min(72ch, 78%);
  padding: var(--sv-space-4) var(--sv-space-6);
  color: var(--sv-white);
  background: var(--sv-black);
  font-size: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.peer {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: var(--sv-space-6);
  padding: var(--sv-space-4) 0;
  background: var(--sv-off-white);
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.peer-role {
  display: flex;
  align-items: flex-start;
  gap: var(--sv-space-2);
  padding-left: var(--sv-space-4);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 500;
}

.peer-role .icon { width: 16px; height: 16px; }

.peer-message {
  max-width: 72ch;
  padding-right: var(--sv-space-4);
  color: var(--sv-black);
  font-size: 15px;
  line-height: var(--sv-leading-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-role {
  display: flex;
  align-items: center;
  color: var(--sv-black);
}

/* Assistant attribution uses the composed brand mark, not a chip + "Share". */
.wordmark-role {
  font-size: 16px; /* design-system minimum for wordmark text */
}

.msg.assistant .md {
  min-width: 0;
  max-width: 72ch;
  color: var(--sv-black);
  font-size: 17px;
  line-height: var(--sv-leading-body);
  overflow-wrap: anywhere;
}

.response-copy-button {
  grid-column: 2;
  justify-self: start;
  margin-top: var(--sv-space-3);
  color: var(--sv-gray-dark);
}
.response-copy-button:hover { color: var(--sv-black); }

.contextual-next-move {
  grid-column: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sv-space-4);
  max-width: 72ch;
  margin-top: var(--sv-space-4);
  padding: var(--sv-space-4) var(--sv-space-5);
  color: var(--sv-black);
  background: var(--sv-off-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  border-radius: 10px;
}

.contextual-next-move-copy {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
}
button.contextual-next-move-copy { cursor: pointer; }
button.contextual-next-move-copy:hover p { text-decoration: underline; }
button.contextual-next-move-copy:focus-visible { outline: 2px solid var(--sv-black); outline-offset: 4px; }
.contextual-next-move strong { font-size: var(--sv-text-small); }
.contextual-next-move p { margin: var(--sv-space-1) 0 0; font-size: 15px; line-height: 1.45; }
.contextual-next-move-dismiss {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--sv-gray-dark);
  background: transparent;
  border: 0;
  border-radius: 50%;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.contextual-next-move-dismiss:hover { color: var(--sv-black); background: var(--sv-gray-light); }
.contextual-next-move-dismiss:focus-visible { outline: 2px solid var(--sv-black); outline-offset: 2px; }

.md.streaming::after {
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: var(--sv-space-1);
  background: currentColor;
  content: "";
  vertical-align: -0.12em;
  animation: caret-blink 900ms steps(1, end) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.msg-footer {
  grid-column: 2;
  margin-top: var(--sv-space-4);
  padding-top: var(--sv-space-3);
  color: var(--sv-gray-dark);
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
  font-size: var(--sv-text-caption);
  font-weight: 300;
}

.status-line {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: var(--sv-space-6);
}

.status-chip {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-3);
  width: fit-content;
  min-height: 32px;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 2px;
  flex: 0 0 24px;
  background: currentColor;
  transform-origin: left center;
  animation: progress-pulse 900ms var(--sv-ease-inout) infinite;
}

@keyframes progress-pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scaleX(0.25);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

.notice {
  padding: var(--sv-space-4);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  font-size: var(--sv-text-small);
  line-height: 1.5;
}

.notice-action {
  min-height: 2.75rem;
  padding: 0 var(--sv-space-4);
  margin-left: var(--sv-space-3);
  color: var(--sv-white);
  background: var(--sv-black);
  border: 0;
  font: inherit;
  cursor: pointer;
}

.notice-action:hover {
  background: var(--sv-gray-dark);
}

.loading-state,
.empty,
.thread-starter {
  width: min(100%, 64rem);
  margin: 0 auto;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sv-space-3);
  min-height: 100%;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
}

.empty,
.thread-starter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 100%;
  padding: var(--sv-space-16) 0;
}

.empty h2,
.thread-starter h2 {
  max-width: 18ch;
  margin: 0;
  color: var(--sv-black);
  font-size: var(--sv-text-h1);
  font-weight: 400;
  line-height: var(--sv-leading-heading);
  letter-spacing: var(--sv-tracking-heading);
}

.empty p {
  max-width: 56ch;
  margin: var(--sv-space-6) 0 var(--sv-space-8);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-body);
  line-height: var(--sv-leading-body);
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sv-hairline-w);
  width: 100%;
  margin-top: var(--sv-space-12);
  background: var(--sv-gray-light);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.suggestion {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--sv-space-4);
  min-height: 112px;
  padding: var(--sv-space-6);
  color: var(--sv-black);
  background: var(--sv-white);
  text-align: left;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out);
}

.suggestion:hover {
  color: var(--sv-white);
  background: var(--sv-black);
}

.suggestion-icon {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 32px;
  height: 32px;
  color: inherit;
  background: transparent;
}

.suggestion-icon .icon {
  width: 24px;
  height: 24px;
}

.suggestion-copy {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-2);
  min-width: 0;
}

.suggestion-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
}

.suggestion-badge {
  display: inline-block;
  padding: 1px var(--sv-space-2);
  color: var(--sv-black);
  background: var(--sv-green);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
  vertical-align: 2px;
  white-space: nowrap;
}

.suggestion-detail {
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
  font-weight: 400;
  line-height: 1.45;
}

.suggestion:hover .suggestion-detail {
  color: var(--sv-gray-light);
}

/* Markdown */

.md > * + * {
  margin-top: 0.8em;
}

.md > :first-child {
  margin-top: 0;
}

.md > :last-child {
  margin-bottom: 0;
}

.md h1,
.md h2,
.md h3,
.md h4 {
  margin-bottom: 0;
  color: var(--sv-black);
  font-weight: 500;
  line-height: var(--sv-leading-heading);
  letter-spacing: var(--sv-tracking-heading);
}

.md h1 {
  font-size: 1.75em;
}

.md h2 {
  font-size: 1.45em;
}

.md h3 {
  font-size: 1.2em;
}

.md h4 {
  font-size: 1em;
}

.md p {
  margin-bottom: 0;
}

.md ul,
.md ol {
  padding-left: 1.4em;
}

.md li + li {
  margin-top: 0.35em;
}

.md a {
  color: var(--sv-black);
  text-decoration-color: currentColor;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--sv-dur-fast) var(--sv-ease-out);
}

.md a:hover {
  text-decoration-color: var(--sv-green);
}

.md code {
  padding: 0.12em 0.3em;
  color: var(--sv-black);
  background: var(--sv-off-white);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86em;
}

.md .codeblock {
  overflow: hidden;
  color: var(--sv-white);
  background: var(--sv-black);
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
}

.md .codebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 var(--sv-space-4);
  color: var(--sv-gray-light);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 300;
}

.code-copy {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-2);
  min-height: 32px;
  padding: 0;
  color: var(--sv-white);
  background: transparent;
  border-bottom: 1px solid transparent;
  font-size: var(--sv-text-caption);
}

.code-copy:hover,
.code-copy.copied {
  border-bottom-color: currentColor;
}

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

.md pre {
  margin: 0;
  padding: var(--sv-space-4);
  overflow-x: auto;
}

.md pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  font-size: 0.84em;
  line-height: 1.6;
}

.md blockquote {
  margin-left: 0;
  padding-left: var(--sv-space-4);
  color: var(--sv-gray-dark);
  border-left: 1px solid var(--sv-black);
}

.md hr {
  margin: var(--sv-space-8) 0;
  border: 0;
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.md table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--sv-text-small);
}

.md th,
.md td {
  padding: var(--sv-space-3) var(--sv-space-4);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  text-align: left;
  vertical-align: top;
}

.md th {
  color: var(--sv-black);
  background: var(--sv-off-white);
  font-weight: 700;
}

/* Composer */

.composer-wrap {
  padding: var(--sv-space-3) var(--sv-gutter) var(--sv-space-4);
  background: var(--sv-home-bg);
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* see .main: implicit auto columns don't shrink */
  width: min(100%, 64rem);
  margin: 0 auto;
  overflow: visible;
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-black);
  transition: border-color var(--sv-dur-fast) var(--sv-ease-out);
}

.mention-picker {
  position: absolute;
  z-index: var(--sv-z-nav);
  right: var(--sv-space-3);
  bottom: calc(100% - 4px);
  left: var(--sv-space-3);
  max-height: min(16rem, 45vh);
  overflow-y: auto;
  padding: var(--sv-space-2);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-mid);
}
.mention-picker[hidden] { display: none; }
.mention-option { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; min-height: 44px; padding: var(--sv-space-2) var(--sv-space-3); text-align: left; background: transparent; border: 0; }
.mention-option strong, .mention-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-option span { color: var(--sv-gray-dark); font-size: var(--sv-text-caption); }
.mention-option[aria-selected="true"], .mention-option:hover { background: var(--sv-gray-light); }
+.mention-empty { margin: var(--sv-space-2) var(--sv-space-3); color: var(--sv-gray-dark); font-size: var(--sv-text-caption); }
+.mention-manage { min-height: 40px; margin: 0 var(--sv-space-2) var(--sv-space-2); padding: 0 var(--sv-space-3); color: var(--sv-black); background: transparent; border: var(--sv-hairline-w) solid var(--sv-gray-mid); }
+.mention-manage:hover, .mention-manage:focus-visible { border-color: var(--sv-black); }

.composer:focus-within {
  border-color: var(--sv-black);
  outline: 2px solid var(--sv-green);
  outline-offset: 2px;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  padding: var(--sv-space-4);
  resize: none;
  overflow-y: auto;
  color: var(--sv-black);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: var(--sv-gray-dark);
  opacity: 1;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--sv-space-6);
  z-index: 95;
  max-width: min(90vw, 34rem);
  transform: translateX(-50%);
  padding: var(--sv-space-3) var(--sv-space-4);
  color: var(--sv-white);
  background: var(--sv-black);
  border: var(--sv-hairline-w) solid var(--sv-black);
  font-size: var(--sv-text-small);
  line-height: 1.4;
}

.toast[hidden] {
  display: none;
}

.message-popups {
  position: fixed;
  z-index: var(--sv-z-toast);
  top: var(--sv-space-4);
  right: var(--sv-space-4);
  display: grid;
  gap: var(--sv-space-2);
  width: min(calc(100vw - (var(--sv-space-4) * 2)), 22rem);
  pointer-events: none;
}

.message-popup {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sv-space-2) var(--sv-space-4);
  padding: var(--sv-space-4);
  color: var(--sv-white);
  background: var(--sv-black);
  pointer-events: auto;
  animation: message-popup-in var(--sv-dur-fast) var(--sv-ease-out);
}

.message-popup strong { padding-right: var(--sv-space-6); font-size: var(--sv-text-small); }
.message-popup p {
  grid-column: 1 / -1;
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--sv-gray-light);
  font-size: var(--sv-text-caption);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.message-popup-open {
  justify-self: start;
  padding: 0;
  color: var(--sv-green);
  background: transparent;
  font-size: var(--sv-text-small);
  font-weight: 700;
}
.message-popup-dismiss {
  position: absolute;
  top: var(--sv-space-2);
  right: var(--sv-space-2);
  width: 32px;
  height: 32px;
  color: var(--sv-gray-light);
  background: transparent;
  font-size: 22px;
}
@keyframes message-popup-in { from { opacity: 0; transform: translateY(-8px); } }

/* Lift clear of the composer when a thread is open. */
.app:has(#composer-wrap:not([hidden])) ~ .toast,
body:has(#composer-wrap:not([hidden])) .toast {
  bottom: 11rem;
}

/* Drag-and-drop overlay */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sv-space-6);
  background: color-mix(in srgb, var(--sv-home-bg) 78%, transparent);
  backdrop-filter: blur(2px);
}

.drop-overlay[hidden] {
  display: none;
}

.drop-overlay-card {
  padding: var(--sv-space-6) var(--sv-space-8, 2rem);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-black);
  outline: 2px solid var(--sv-green);
  outline-offset: 4px;
  font-size: var(--sv-text-h4);
  font-weight: 700;
  letter-spacing: var(--sv-tracking-heading);
}

body.is-dragging-files .composer {
  border-color: var(--sv-green);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sv-space-2);
  padding: 0 var(--sv-space-4) var(--sv-space-3);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-2);
  max-width: 100%;
  min-height: 30px;
  padding: 5px 7px 5px 9px;
  color: var(--sv-black);
  background: var(--sv-gray-light);
  font-size: var(--sv-text-caption);
  line-height: 1.2;
}

.attachment-chip img {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  object-fit: cover;
  background: var(--sv-white);
}

.attachment-chip .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.attachment-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip.attachment-pdf {
  background: var(--sv-off-white);
  border-left: 3px solid var(--sv-black);
}

.attachment-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  color: var(--sv-black);
  border: 0;
  background: transparent;
  font-size: 19px;
  line-height: 1;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  margin-left: auto;
  padding: 0;
  overflow: visible;
  color: var(--sv-black);
  background: transparent;
  border: 0;
}

.attach-btn:hover { background: var(--sv-gray-light); }
.live-voice-end,
.live-voice-text {
  min-height: 36px;
  padding: 0 var(--sv-space-3);
  color: var(--sv-black);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-black);
  font: inherit;
  font-size: var(--sv-text-caption);
}
.live-voice-end:hover,
.live-voice-text:hover { color: var(--sv-white); background: var(--sv-black); }

/* Two distinct voice paths: a saved dictation to the working agent, or an
 * ephemeral live call. Keep them visibly paired without consuming a text
 * label's worth of narrow composer space. */
/* One right-aligned action cluster. Every control is the same 40px square so
 * nothing floats mid-bar, and a hairline separates "say it" from "send it". */
.composer-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: var(--sv-space-1);
  margin-left: auto;
  padding-right: var(--sv-space-2);
}

/* Zoomed-in phones (Safari page zoom / large accessibility text) can drive the
 * effective viewport under ~240px. The 20px gutter floor plus the fixed action
 * buttons no longer fit, so tighten the gutter rather than clip the composer. */
@media (max-width: 420px) {
  :root {
    --sv-gutter: clamp(0.75rem, 4vw, 4rem);
  }

  /* The chip only restates the project the button already names; drop it here
   * so the project name itself keeps readable width. The button's title
   * attribute still carries the full "<project> · <workspace>" text. */
  .composer-workspace {
    display: none;
  }
}


.composer-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  margin: 0;
  padding: 0;
  color: var(--sv-gray-dark);
  background: transparent;
  border: 0;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out);
}
.composer-icon-btn .icon { width: 20px; height: 20px; overflow: visible; stroke-width: 1.75; }
.composer-icon-btn:hover { color: var(--sv-black); background: var(--sv-gray-light); }
.composer-icon-btn.stop-btn { color: #b42318; }
.composer-icon-btn.stop-btn:hover:not(:disabled) { color: #b42318; background: color-mix(in srgb, #b42318 10%, transparent); }
.composer-icon-btn:disabled { color: var(--sv-hairline); background: transparent; }
.composer-icon-btn:focus-visible { outline-offset: -3px; }
.composer-actions-rule {
  width: var(--sv-hairline-w);
  height: 20px;
  flex: 0 0 auto;
  margin: 0 var(--sv-space-1);
  background: var(--sv-hairline);
}
/* Only the action cluster may claim the free space. A second `margin-left:auto`
 * sibling splits it and strands the buttons in the middle of the bar. */
.composer-bar > .voice-status { margin-left: 0; margin-right: var(--sv-space-2); }
/* Recording is a live state, so it reads filled rather than merely hovered. */
.voice-btn.is-recording { color: var(--sv-white); background: var(--sv-black); }
.voice-btn.is-recording:hover { color: var(--sv-white); background: var(--sv-gray-dark); }
/* Live call: a full-screen stage, not a panel. The call is the whole surface —
 * a cinematic dark room with one animated object (the S), the running
 * transcript beneath it, and exactly one green live indicator. */
.live-voice-stage {
  position: fixed;
  z-index: calc(var(--sv-z-modal) + 2);
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: var(--sv-space-6) var(--sv-gutter) var(--sv-space-8);
  overflow: hidden;
  background: var(--sv-black);
  animation: live-voice-enter var(--sv-dur-base) var(--sv-ease-out) both;
}
.live-voice-stage[hidden] { display: none; }
/* Everything behind the stage is inert while a call is up: no tabbing into a
 * composer you cannot see, no background scroll under it. */
body.is-calling .app { pointer-events: none; }
body.is-calling .live-voice-stage { pointer-events: auto; }

@keyframes live-voice-enter {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: none; }
}

.live-voice-bar {
  display: flex;
  align-items: center;
  gap: var(--sv-space-4);
  min-height: 32px;
}
.live-voice-state {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--sv-space-2);
  color: var(--sv-ink);
  font-size: var(--sv-text-caption);
  font-weight: 500;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}
.live-voice-state::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sv-ink-tertiary);
}
.live-voice-state[data-kind="live"]::before { background: var(--sv-green); }
.live-voice-state[data-kind="pending"]::before {
  background: var(--sv-ink-tertiary);
  animation: live-voice-pulse 1.2s ease-in-out infinite;
}
/* Errors read as a hollow marker plus the retry action, so the stage keeps to
 * the brand palette instead of introducing a red. */
.live-voice-state[data-kind="error"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 var(--sv-hairline-w) var(--sv-ink);
}
.live-voice-state[data-kind="idle"]::before { background: var(--sv-ink-tertiary); opacity: 0.5; }
@keyframes live-voice-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.live-voice-thread {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--sv-ink-secondary);
  font-size: var(--sv-text-caption);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Mic-input meter: the only proof the browser is actually hearing you. */
.live-voice-meter {
  flex: 0 0 clamp(60px, 14vw, 160px);
  height: 2px;
  background: var(--sv-hairline);
  opacity: 0;
  transition: opacity 160ms ease;
}
.live-voice-meter i { display: block; width: 0%; height: 100%; background: var(--sv-ink); transition: width 90ms linear; }
.live-voice-stage[data-active="true"] .live-voice-meter { opacity: 1; }

/* The avatar: one canvas, drawn from the official S geometry. No WebGL, no
 * video, no per-minute cost — it reacts to audio levels already in the page. */
.live-voice-figure {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: var(--sv-space-6) 0;
}
.live-voice-avatar {
  display: block;
  width: min(100%, 46vh);
  height: min(100%, 46vh);
  aspect-ratio: 1;
}

.live-voice-transcript {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-3);
  width: min(100%, 46rem);
  max-height: min(34vh, 20rem);
  margin: 0 auto;
  padding: var(--sv-space-2) 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--sv-ink);
  font-size: var(--sv-text-body);
  line-height: var(--sv-leading-body);
  /* Older turns recede rather than being clipped mid-sentence. */
  mask-image: linear-gradient(to bottom, transparent, #000 var(--sv-space-8), #000 100%);
  scrollbar-width: none;
}
.live-voice-transcript::-webkit-scrollbar { width: 0; height: 0; }
.live-voice-transcript:empty { display: none; }
.live-voice-line { margin: 0; }
.live-voice-line span {
  display: block;
  color: var(--sv-ink-tertiary);
  font-size: var(--sv-text-caption);
  font-weight: 500;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}
.live-voice-line[data-final="false"] { color: var(--sv-ink-secondary); }
.live-voice-lookup {
  display: flex;
  align-items: baseline;
  gap: var(--sv-space-2);
  margin: 0;
  color: var(--sv-ink-secondary);
  font-size: var(--sv-text-small);
  font-style: italic;
}
.live-voice-lookup::before {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sv-ink-tertiary);
  content: "";
  transform: translateY(-2px);
}
.live-voice-lookup[data-state="running"]::before { animation: live-voice-pulse 1.2s ease-in-out infinite; }
.live-voice-lookup[data-state="done"]::before { background: var(--sv-ink); }
.live-voice-lookup[data-state="error"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 var(--sv-hairline-w) var(--sv-ink);
}

.live-voice-actions {
  display: flex;
  justify-content: center;
  gap: var(--sv-space-3);
  padding-top: var(--sv-space-6);
}
.live-voice-end,
.live-voice-text {
  min-height: 48px;
  padding: 0 var(--sv-space-6);
  color: var(--sv-ink);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out);
}
.live-voice-text {
  border-color: var(--sv-hairline);
  color: var(--sv-ink-secondary);
}
.live-voice-text:hover { color: var(--sv-black); background: var(--sv-ink); }
.live-voice-end { color: var(--sv-black); background: var(--sv-ink); }
.live-voice-end:hover { color: var(--sv-ink); background: transparent; }
.live-voice-text[hidden] { display: none; }

.voice-btn.is-recording {
  color: var(--sv-white);
  background: var(--sv-black);
}
.voice-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--sv-black);
  font-size: var(--sv-text-caption);
  font-variant-numeric: tabular-nums;
}
.voice-status[hidden] { display: none; }
.voice-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d62d20;
  animation: voice-pulse 1.2s ease-in-out infinite;
}
.voice-status button {
  width: 22px;
  height: 22px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font-size: 20px;
  line-height: 1;
}
@keyframes voice-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .voice-status-dot { animation: none; } }
.attach-btn .icon {
  width: 22px;
  height: 22px;
  overflow: visible;
  stroke-width: 2;
}

.composer-context { margin-right: auto; }

/* The project name is the only elastic part of the composer bar. */
#composer-project {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sv-space-2);
  margin-top: var(--sv-space-3);
}

.message-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  color: var(--sv-white);
  background: rgb(255 255 255 / 12%);
  font-size: var(--sv-text-caption);
}

.message-attachment .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  stroke-width: 2;
}

.message-attachment .attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment.attachment-image {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: stretch;
  width: min(100%, 216px);
  padding: 0;
  overflow: hidden;
}

.message-attachment.attachment-image img {
  display: block;
  width: 72px;
  height: 58px;
  object-fit: cover;
  background: var(--sv-gray-xdark);
}

.message-attachment.attachment-image .attachment-name {
  align-self: center;
  padding: 0 8px;
}

.message-attachment.attachment-pdf {
  border-left: 3px solid var(--sv-green);
}

@media (max-width: 560px) {
  .message-attachment.attachment-image {
    grid-template-columns: 60px minmax(0, 1fr);
    width: min(100%, 190px);
  }

  .message-attachment.attachment-image img {
    width: 60px;
    height: 48px;
  }
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Stays a single row: a wrapping flex container breaks lines using each
   * item's content size *before* shrinking anything, which pushed the buttons
   * onto a second row on ordinary phones. Instead the project label absorbs
   * the squeeze (see .composer-context); wrapping is re-enabled only at the
   * extreme zoom widths handled further down. */
  flex-wrap: nowrap;
  min-width: 0;
  min-height: 48px;
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
}

@media (max-width: 560px) {
  .live-voice-stage { padding: var(--sv-space-4) var(--sv-space-4) var(--sv-space-6); }
  .live-voice-bar { flex-wrap: wrap; row-gap: var(--sv-space-2); }
  .live-voice-meter { order: 3; flex-basis: 100%; }
  .live-voice-avatar { width: min(100%, 34vh); height: min(100%, 34vh); }
  .live-voice-transcript { font-size: var(--sv-text-small); max-height: 30vh; }
  .live-voice-actions { flex-wrap: wrap; padding-top: var(--sv-space-4); }
  .live-voice-end,
  .live-voice-text { min-height: 48px; flex: 1 1 auto; padding: 0 var(--sv-space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .live-voice-state[data-kind="pending"]::before { animation: none; opacity: 1; }
  .live-voice-lookup[data-state="running"]::before { animation: none; }
  .live-voice-meter i { transition: none; }
}

.composer-context {
  display: flex;
  align-items: center;
  gap: var(--sv-space-2);
  /* Shrink before the fixed-width action buttons do, so a narrow/zoomed
   * viewport truncates the project name instead of wrapping the whole row. */
  flex: 0 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 0 var(--sv-space-4);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 300;
  background: transparent;
  border: 0;
  text-align: left;
}

button.composer-context:not(:disabled) { cursor: pointer; }
button.composer-context:not(:disabled):hover { color: var(--sv-ink); }
button.composer-context:disabled { cursor: default; }

.composer-workspace {
  flex: 0 1 auto;
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  padding: 2px var(--sv-space-2);
  color: var(--sv-gray-dark);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.composer-context-caret { width: 12px; height: 12px; opacity: 0; transition: opacity 120ms ease; }
button.composer-context:not(:disabled):hover .composer-context-caret,
button.composer-context:not(:disabled):focus-visible .composer-context-caret { opacity: 1; }

.composer-context .icon {
  width: 16px;
  height: 16px;
}

.composer-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  margin-left: var(--sv-space-1);
  color: var(--sv-black);
  background: var(--sv-green);
  border: var(--sv-hairline-w) solid transparent;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out),
    border-color var(--sv-dur-fast) var(--sv-ease-out);
}

#send-btn .icon {
  width: 20px;
  height: 20px;
}

#send-btn:hover:not(:disabled) {
  color: var(--sv-black);
  background: transparent;
  border-color: var(--sv-green);
}

#send-btn:disabled {
  color: var(--sv-gray-dark);
  background: var(--sv-gray-light);
}

/* Phone: 44px targets. Must come after the #send-btn base rules — equal
 * specificity means source order decides the winner. */
@media (max-width: 560px) {
  .composer-icon-btn,
  #send-btn { width: 44px; height: 44px; flex: 0 0 44px; }
  .composer-actions { gap: 0; padding-right: var(--sv-space-1); }
  .composer-actions-rule { margin: 0; }
  .composer-context { padding-right: var(--sv-space-2); }
}

/* Deep zoom (Safari page zoom / large accessibility text can push the effective
 * viewport near 200px): four 44px targets no longer fit beside the project
 * label. Trim to 40px and drop the label rather than clip the send button.
 * Must follow the 560px block — equal specificity, source order wins. */
@media (max-width: 300px) {
  .composer-icon-btn,
  #send-btn { width: 40px; height: 40px; flex: 0 0 40px; }
  #send-btn { margin-left: 0; }
  .composer-context { display: none; }
}

.composer-note {
  width: min(100%, 64rem);
  margin: var(--sv-space-2) auto 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 300;
  line-height: 1.4;
}

/* Dialog */

.app-dialog {
  width: min(calc(100% - (var(--sv-space-6) * 2)), 30rem);
  max-width: none;
  padding: 0;
  color: var(--sv-black);
  background: transparent;
  border: 0;
  opacity: 0;
  transform: translateY(var(--sv-space-4));
  transition:
    opacity var(--sv-dur-base) var(--sv-ease-out),
    transform var(--sv-dur-base) var(--sv-ease-out),
    display var(--sv-dur-base) allow-discrete,
    overlay var(--sv-dur-base) allow-discrete;
}

.app-dialog[open] {
  opacity: 1;
  transform: none;
}

@starting-style {
  .app-dialog[open] {
    opacity: 0;
    transform: translateY(var(--sv-space-4));
  }
}

.app-dialog::backdrop {
  background: rgb(0 0 0 / 0.6);
  opacity: 0;
  transition:
    opacity var(--sv-dur-base) var(--sv-ease-out),
    display var(--sv-dur-base) allow-discrete,
    overlay var(--sv-dur-base) allow-discrete;
}

.app-dialog[open]::backdrop {
  opacity: 1;
}

@starting-style {
  .app-dialog[open]::backdrop {
    opacity: 0;
  }
}

.dialog-card {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-4);
  padding: var(--sv-space-8);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-black);
}

.chat-search-dialog { width: min(calc(100% - (var(--sv-space-6) * 2)), 42rem); }
.chat-search-card {
  max-height: calc(100vh - (var(--sv-space-3) * 2));
  max-height: calc(100dvh - (var(--sv-space-3) * 2));
  gap: var(--sv-space-3);
  padding: var(--sv-space-6);
}
.chat-search-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--sv-space-3); }
.chat-search-heading .icon-btn { color: var(--sv-black); }
.chat-search-field { display: flex; align-items: center; gap: var(--sv-space-3); height: 50px; flex: 0 0 50px; padding: 0 var(--sv-space-4); border: var(--sv-hairline-w) solid var(--sv-black); }
.chat-search-field .icon { width: 19px; height: 19px; color: var(--sv-gray-dark); }
.chat-search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--sv-black); background: transparent; font: inherit; font-size: 16px; }
.chat-search-meta { margin: 0; color: var(--sv-gray-dark); font-size: var(--sv-text-caption); }
.chat-search-results { min-height: 0; max-height: min(55vh, 420px); overflow: auto; border-top: var(--sv-hairline-w) solid var(--sv-hairline); }
.chat-search-result { display: block; width: 100%; padding: var(--sv-space-4) 0; color: inherit; background: transparent; border: 0; border-bottom: var(--sv-hairline-w) solid var(--sv-hairline); text-align: left; }
.chat-search-result:hover, .chat-search-result.active { padding-left: var(--sv-space-3); padding-right: var(--sv-space-3); color: var(--sv-white); background: var(--sv-black); }
.chat-search-result-title { display: flex; justify-content: space-between; gap: var(--sv-space-4); font-size: var(--sv-text-small); font-weight: 600; }
.chat-search-result-project { color: var(--sv-gray-dark); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-search-result:hover .chat-search-result-project, .chat-search-result.active .chat-search-result-project { color: var(--sv-gray-light); }
.chat-search-result-snippet { display: block; margin-top: var(--sv-space-2); color: var(--sv-gray-dark); font-size: var(--sv-text-caption); line-height: 1.4; }

/* New chat: project picker */
.project-picker-dialog { width: min(calc(100% - (var(--sv-space-6) * 2)), 34rem); }
.project-picker-card { gap: var(--sv-space-3); padding: var(--sv-space-6); }
.project-picker-results { max-height: min(50vh, 380px); overflow: auto; border-top: var(--sv-hairline-w) solid var(--sv-hairline); }
.project-picker-group { margin: var(--sv-space-4) 0 0; color: var(--sv-gray-dark); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.project-picker-group:first-child { margin-top: var(--sv-space-3); }
.project-picker-result .chat-search-result-snippet { margin-top: var(--sv-space-1); }
.project-picker-name { display: inline-flex; align-items: center; gap: var(--sv-space-2); min-width: 0; }
.project-picker-name .icon { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.7; }
.project-picker-workspace { font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; font-size: 10px; }
.project-picker-note { margin: 0; color: var(--sv-gray-dark); font-size: var(--sv-text-caption); }
.project-picker-card .dialog-actions { border-top: var(--sv-hairline-w) solid var(--sv-hairline); padding-top: var(--sv-space-4); }

/* Direct messages */
.messages-dialog { width: min(calc(100% - (var(--sv-space-6) * 2)), 58rem); }
.messages-dialog-card { gap: 0; height: min(78vh, 44rem); padding: 0; overflow: hidden; }
.messages-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sv-space-4);
  padding: var(--sv-space-6);
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
}
.messages-dialog-head h2 { margin: 0; font-size: var(--sv-text-h4); }
.messages-dialog-head p { margin: var(--sv-space-1) 0 0; color: var(--sv-gray-dark); font-size: var(--sv-text-small); }
.messages-layout { display: grid; grid-template-columns: 18rem minmax(0, 1fr); min-height: 0; flex: 1; }
.message-contacts { min-width: 0; overflow-y: auto; border-right: var(--sv-hairline-w) solid var(--sv-hairline); }
.message-contact-picker { display: block; padding: var(--sv-space-3); border-bottom: var(--sv-hairline-w) solid var(--sv-hairline); }
.message-contact-picker select {
  width: 100%;
  height: 40px;
  padding: 0 var(--sv-space-3);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-mid);
}
.message-contact-list { display: grid; }
.message-contact {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: var(--sv-space-3) var(--sv-space-4);
  color: var(--sv-black);
  background: transparent;
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
  text-align: left;
}
.message-contact:hover, .message-contact.selected { background: var(--sv-home-bg); }
.message-contact.selected { box-shadow: inset 3px 0 var(--sv-black); }
.message-contact-top { display: flex; align-items: center; gap: var(--sv-space-2); min-width: 0; }
.message-contact-top strong { overflow: hidden; font-size: var(--sv-text-small); text-overflow: ellipsis; white-space: nowrap; }
.message-online-dot { width: 8px; height: 8px; flex: none; background: var(--sv-gray-mid); border-radius: 50%; }
.message-online-dot.online { background: var(--sv-green); }
.message-online-dot.agent { width: 10px; height: 10px; background: var(--sv-black); box-shadow: inset 0 0 0 3px var(--sv-green); }
.message-contact.agent-contact { border-bottom-color: var(--sv-gray-mid); }
.message-contact.agent-contact .message-contact-preview { color: var(--sv-black); }
.message-contact-unread {
  min-width: 18px;
  margin-left: auto;
  padding: 0 5px;
  color: var(--sv-black);
  background: var(--sv-green);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
.message-contact-preview { overflow: hidden; color: var(--sv-gray-dark); font-size: var(--sv-text-caption); text-overflow: ellipsis; white-space: nowrap; }
/* A column, not a fixed row grid: the reply banner, pending chips and room
 * context are all conditionally hidden, and a fixed template would hand the
 * thread an auto track and squeeze the composer off the screen. Every child is
 * intrinsic except the thread, which is the only scroller. */
.message-conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.message-conversation > * { flex: none; min-width: 0; }
.message-conversation-top { display: flex; align-items: stretch; min-width: 0; border-bottom: var(--sv-hairline-w) solid var(--sv-hairline); }
.message-conversation-head { min-width: 0; flex: 1; padding: var(--sv-space-4); overflow: hidden; font-size: var(--sv-text-small); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.message-back-btn { display: none; flex: none; align-items: center; justify-content: center; width: 44px; color: var(--sv-black); background: transparent; border: 0; border-right: var(--sv-hairline-w) solid var(--sv-hairline); cursor: pointer; }
.message-thread { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; gap: var(--sv-space-3); padding: var(--sv-space-4); overflow-y: auto; overscroll-behavior: contain; }
.direct-message { align-self: flex-start; max-width: min(80%, 34rem); padding: var(--sv-space-3); background: var(--sv-home-bg); }
.direct-message.outgoing { align-self: flex-end; color: var(--sv-white); background: var(--sv-black); }
.direct-message.agent-message { max-width: min(72%, 42rem); padding: var(--sv-space-3) var(--sv-space-4); background: var(--sv-white); border: var(--sv-hairline-w) solid var(--sv-hairline); border-left: 3px solid var(--sv-black); }
.direct-message.agent-message::before { display: block; margin-bottom: var(--sv-space-2); color: var(--sv-gray-dark); content: "JARVIS"; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.agent-md { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.agent-md > :first-child { margin-top: 0; }
.agent-md > :last-child { margin-bottom: 0; }
.agent-md p { margin: 0 0 var(--sv-space-3); white-space: normal; }
.agent-md ol, .agent-md ul { margin: 0 0 var(--sv-space-3); padding-left: 1.35rem; }
.agent-md li + li { margin-top: var(--sv-space-1); }
.direct-message p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.direct-message > span { display: block; margin-top: var(--sv-space-1); color: var(--sv-gray-dark); font-size: 11px; }
.direct-message.outgoing > span { color: var(--sv-gray-light); }
.message-context-link { display: inline-block; margin-top: var(--sv-space-2); color: inherit; font-size: var(--sv-text-caption); font-weight: 700; }
.message-composer { display: flex; align-items: flex-end; gap: var(--sv-space-2); min-width: 0; padding: var(--sv-space-3); border-top: var(--sv-hairline-w) solid var(--sv-hairline); }
.message-composer textarea { min-height: 42px; max-height: 9rem; min-width: 0; flex: 1; resize: vertical; padding: var(--sv-space-2) var(--sv-space-3); border: var(--sv-hairline-w) solid var(--sv-gray-mid); }
.message-composer .dialog-button { flex: none; }
.message-error { min-height: 1.25rem; margin: 0; padding: 0 var(--sv-space-3) var(--sv-space-2); color: #b42318; font-size: var(--sv-text-caption); }
.message-empty { margin: var(--sv-space-4); color: var(--sv-gray-dark); font-size: var(--sv-text-small); line-height: 1.4; }
.message-empty.thread-empty { margin: auto; text-align: center; }

/* Rooms */
.message-rail-group + .message-rail-group { border-top: var(--sv-hairline-w) solid var(--sv-hairline); }
.message-rail-title {
  margin: 0;
  padding: var(--sv-space-3) var(--sv-space-4) var(--sv-space-2);
  color: var(--sv-gray-dark);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.message-room .message-contact-top strong::before { content: "#"; margin-right: 2px; color: var(--sv-gray-dark); }
.group-message-author { display: block; margin-bottom: var(--sv-space-1); font-size: 11px; font-weight: 700; }
.message-search-wrap { position: relative; padding: var(--sv-space-2) var(--sv-space-4); border-bottom: var(--sv-hairline-w) solid var(--sv-hairline); }
.message-search-wrap .chat-search-field { width: 100%; }
.message-search-results { position: absolute; z-index: 20; top: calc(100% - 2px); right: var(--sv-space-4); left: var(--sv-space-4); max-height: 18rem; overflow: auto; background: var(--sv-white); border: 1px solid var(--sv-gray-mid); box-shadow: var(--sv-shadow-lg); }
.message-search-result { display: block; width: 100%; min-height: 40px; padding: var(--sv-space-3); overflow: hidden; background: none; border: 0; border-bottom: 1px solid var(--sv-hairline); cursor: pointer; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.room-context { display: flex; align-items: center; gap: var(--sv-space-2); min-width: 0; padding: var(--sv-space-2) var(--sv-space-4); color: var(--sv-gray-dark); border-bottom: 1px solid var(--sv-hairline); font-size: var(--sv-text-caption); }
.room-context > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.room-context button, .room-context select, .message-action { min-height: 32px; }
.message-replying { padding: var(--sv-space-2) var(--sv-space-3); overflow: hidden; color: var(--sv-gray-dark); background: var(--sv-home-bg); font-size: var(--sv-text-caption); text-overflow: ellipsis; white-space: nowrap; }
.message-parent-quote { display: block; width: 100%; margin-bottom: var(--sv-space-2); padding: var(--sv-space-2); overflow: hidden; color: inherit; background: color-mix(in srgb, currentColor 8%, transparent); border: 0; border-left: 3px solid currentColor; cursor: pointer; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.message-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--sv-space-2); }
.message-action { padding: 2px 8px; color: inherit; background: transparent; border: 1px solid currentColor; cursor: pointer; font-size: 11px; }
/* Reply stays in reach; the rest of the verbs are behind More so a bubble is a
 * message first and a toolbar second. */
.message-actions-more[hidden] { display: none; }
.message-actions-more { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.message-request-card, .message-work-card { display: grid; gap: 4px; margin-top: var(--sv-space-2); padding: var(--sv-space-3); color: var(--sv-black); background: var(--sv-white); border: 1px solid var(--sv-gray-mid); }
.message-highlight { outline: 3px solid var(--sv-green); outline-offset: 2px; }
.message-deleted { color: var(--sv-gray-dark); font-style: italic; }
.share-card {
  display: flex;
  gap: var(--sv-space-2);
  align-items: flex-start;
  margin-top: var(--sv-space-2);
  padding: var(--sv-space-2) var(--sv-space-3);
  color: inherit;
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  text-decoration: none;
}
.share-card:hover { border-color: var(--sv-black); }
.direct-message.outgoing .share-card { color: var(--sv-white); background: transparent; border-color: rgba(255, 255, 255, 0.4); }
.direct-message.outgoing .share-card:hover { border-color: var(--sv-white); }
.share-card .icon { width: 15px; height: 15px; flex: none; margin-top: 2px; opacity: 0.75; }
.share-card-body { display: grid; gap: 2px; min-width: 0; }
.share-card-title { overflow: hidden; font-size: var(--sv-text-small); text-overflow: ellipsis; white-space: nowrap; }
/* A long pages host must truncate rather than widen the card. */
.share-card-meta { overflow: hidden; color: var(--sv-gray-dark); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.direct-message.outgoing .share-card-meta { color: var(--sv-gray-light); }
.message-pending { display: flex; flex-wrap: wrap; gap: var(--sv-space-2); padding: var(--sv-space-2) var(--sv-space-3) 0; }
.message-pending-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-1);
  max-width: 18rem;
  padding: 2px var(--sv-space-2);
  background: var(--sv-home-bg);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  font-size: 11px;
}
.message-pending-chip .icon { width: 13px; height: 13px; flex: none; }
.message-pending-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-pending-remove { padding: 0 2px; color: var(--sv-gray-dark); background: none; border: 0; cursor: pointer; font-size: 14px; line-height: 1; }
.message-pending-remove:hover { color: var(--sv-black); }
.message-share-actions { display: flex; flex-direction: column; gap: var(--sv-space-1); }
.message-share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-1);
  padding: var(--sv-space-1) var(--sv-space-2);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-mid);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.message-share-btn:hover { border-color: var(--sv-black); }
.message-share-btn .icon { width: 13px; height: 13px; }

/* Browser-notification opt-in, in the Messages header */
.messages-head-actions { display: flex; align-items: center; gap: var(--sv-space-2); flex: none; }
.message-notify-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-1);
  min-height: 32px;
  padding: var(--sv-space-1) var(--sv-space-3);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-mid);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.message-notify-btn:hover:not(:disabled) { border-color: var(--sv-black); }
.message-notify-btn.on { color: var(--sv-white); background: var(--sv-black); border-color: var(--sv-black); }
.message-notify-btn:disabled { color: var(--sv-gray-dark); cursor: not-allowed; }
.message-notify-btn .icon { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; }

/* Share picker (chat or artifact into a room) */
.share-picker-dialog { width: min(calc(100% - (var(--sv-space-6) * 2)), 34rem); }
.share-picker-card { gap: var(--sv-space-3); padding: var(--sv-space-6); }
.share-picker-results { display: grid; max-height: min(50vh, 380px); overflow: auto; border-top: var(--sv-hairline-w) solid var(--sv-hairline); }
.share-picker-row {
  display: flex;
  gap: var(--sv-space-2);
  align-items: flex-start;
  padding: var(--sv-space-3) var(--sv-space-2);
  background: none;
  border: 0;
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
  cursor: pointer;
  text-align: left;
}
.share-picker-row:hover { background: var(--sv-home-bg); }
.share-picker-row .icon { width: 15px; height: 15px; flex: none; margin-top: 2px; opacity: 0.7; }
.share-picker-body { display: grid; gap: 2px; min-width: 0; }
.share-picker-body strong { overflow: hidden; font-size: var(--sv-text-small); text-overflow: ellipsis; white-space: nowrap; }
.share-picker-body span { color: var(--sv-gray-dark); font-size: 11px; }

@media (max-width: 700px) {
  .messages-dialog { width: 100%; max-height: none; margin: 0; }
  /* Full-bleed on a phone: the generic small-screen .dialog-card padding would
   * otherwise inset this card and leave white gutters around the room. */
  .messages-dialog .messages-dialog-card { width: 100vw; height: 100svh; padding: 0; border: 0; }
  .messages-dialog-head { padding: var(--sv-space-4); }
  /* One pane at a time. Two columns on a 390px screen leaves a 270px
   * conversation, which is why bubbles, cards and the composer all fought for
   * the same 30 characters of width. */
  .messages-layout { grid-template-columns: minmax(0, 1fr); }
  .messages-layout[data-pane="conversation"] > .message-contacts { display: none; }
  .messages-layout[data-pane="list"] > .message-conversation { display: none; }
  .message-contacts { border-right: 0; }
  .message-back-btn { display: inline-flex; }
  .message-contact-picker { padding: var(--sv-space-2); }
  .message-contact-picker select { font-size: 12px; }
  .message-contact { min-height: 56px; padding: var(--sv-space-3) var(--sv-space-4); }
  .message-contact-top { align-items: center; }
  .direct-message { max-width: 88%; }
  .message-popup { margin-top: env(safe-area-inset-top); }
  .message-rail-title { padding: var(--sv-space-2); }
  .message-share-actions { flex-direction: row; }
  .message-share-btn span { display: none; }
  .message-share-btn { min-height: 40px; min-width: 40px; justify-content: center; }
  /* Keep the opt-in tappable but let the header keep its close button. */
  .message-notify-btn { min-width: 40px; min-height: 40px; justify-content: center; padding: 0 var(--sv-space-2); }
  .message-notify-btn span { display: none; }
  /* A 112px-wide Send plus a share pair does not fit one phone row. */
  .message-composer { flex-wrap: wrap; padding-bottom: max(var(--sv-space-3), env(safe-area-inset-bottom)); }
  .message-composer textarea { min-height: 44px; flex: 1 1 100%; order: -1; }
  .message-composer .dialog-button { min-width: 0; flex: 1; height: 44px; padding: 0 var(--sv-space-4); }
  /* Two rows of chrome under the thread is one too many when the keyboard is
   * up; the error line only claims space when it says something. */
  .message-error:empty { display: none; min-height: 0; }
  .message-pending-chip { max-width: 100%; }
  .messages-dialog-head p { display: none; }
  /* Search belongs to the list pane on a phone: in a conversation it was
   * spending 67px of the thread's height on a field nobody is using. */
  .message-search-wrap { padding: var(--sv-space-2); }
  .messages-dialog[data-pane="conversation"] .message-search-wrap { display: none; }
  .message-search-results { right: var(--sv-space-2); left: var(--sv-space-2); }
  .message-conversation-head, .room-context, .message-thread { min-width: 0; max-width: 100%; }
  /* Room purpose and its controls scroll rather than eating the thread. */
  .room-context { max-height: 5.5rem; flex-wrap: wrap; padding: var(--sv-space-2); overflow-y: auto; }
  .room-context button, .room-context select, .message-action, .message-parent-quote { min-height: 40px; }
  .message-action { padding: 2px 10px; font-size: 12px; }
  .direct-message, .share-card, .message-request-card, .message-work-card { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
}
.chat-search-result:hover .chat-search-result-snippet, .chat-search-result.active .chat-search-result-snippet { color: var(--sv-gray-light); }
.chat-search-empty { padding: var(--sv-space-6) 0; color: var(--sv-gray-dark); font-size: var(--sv-text-small); }

.dialog-card h2 {
  margin: 0;
  font-size: var(--sv-text-h3);
  font-weight: 500;
  line-height: var(--sv-leading-heading);
  letter-spacing: var(--sv-tracking-heading);
}

.dialog-card > p {
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
  line-height: 1.5;
}

.dialog-card > p:empty {
  display: none;
}

.dialog-field {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-2);
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 500;
}

.dialog-field input,
.dialog-field select {
  width: 100%;
  height: 48px;
  padding: 0 var(--sv-space-4);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  font-size: 16px;
  font-weight: 400;
  transition: border-color var(--sv-dur-fast) var(--sv-ease-out);
}

.dialog-field input:focus,
.dialog-field select:focus {
  border-color: var(--sv-black);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sv-space-3);
  margin-top: var(--sv-space-2);
}

.dialog-button {
  min-width: 112px;
  height: 48px;
  padding: 0 var(--sv-space-6);
  color: var(--sv-black);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-black);
  font-size: 16px;
  font-weight: 500;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out),
    border-color var(--sv-dur-fast) var(--sv-ease-out);
}

.dialog-button:hover {
  color: var(--sv-white);
  background: var(--sv-black);
}

.dialog-button.primary,
.dialog-button.primary.danger {
  color: var(--sv-white);
  background: var(--sv-black);
}

.dialog-button.primary:hover,
.dialog-button.primary.danger:hover {
  color: var(--sv-black);
  background: transparent;
}

.dialog-button:disabled,
.dialog-button:disabled:hover {
  color: var(--sv-gray-dark);
  background: var(--sv-gray-light);
  border-color: var(--sv-gray-light);
}

.share-dialog {
  width: min(calc(100% - (var(--sv-space-6) * 2)), 42rem);
}

.share-dialog-card {
  gap: var(--sv-space-6);
  border-top: 4px solid var(--sv-green);
}

.share-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sv-space-4);
}

.share-dialog-heading .icon-btn {
  margin: calc(var(--sv-space-2) * -1) calc(var(--sv-space-2) * -1) 0 0;
  color: var(--sv-black);
}

.share-close-icon {
  width: 20px;
  height: 20px;
}

.share-dialog-kicker {
  margin: 0 0 var(--sv-space-2);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 700;
  letter-spacing: var(--sv-tracking-caps);
  line-height: 1;
  text-transform: uppercase;
}

.share-dialog-copy {
  max-width: 62ch;
}

.share-audience-field {
  display: grid;
  gap: var(--sv-space-2);
  margin: var(--sv-space-5) 0;
  padding: var(--sv-space-4);
  border: var(--sv-hairline-w) solid var(--sv-gray-mid);
}

.share-audience-field legend { padding: 0 var(--sv-space-1); font-weight: 700; }
.share-audience-field label { display: flex; align-items: baseline; gap: var(--sv-space-2); font-size: var(--sv-text-small); }
.share-audience-field small { color: var(--sv-gray-dark); }
.share-audience-field textarea { width: 100%; resize: vertical; padding: var(--sv-space-3); border: var(--sv-hairline-w) solid var(--sv-black); background: var(--sv-home-bg); font: inherit; }
.share-audience-field textarea:disabled { opacity: .5; }

.share-link-field {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-2);
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 600;
}

.share-link-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.share-link-control input {
  min-width: 0;
  height: 48px;
  padding: 0 var(--sv-space-4);
  color: var(--sv-black);
  background: var(--sv-home-bg);
  border: var(--sv-hairline-w) solid var(--sv-black);
  border-right: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: var(--sv-text-caption);
}

.share-copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sv-space-2);
}

.share-copy-button .icon {
  width: 18px;
  height: 18px;
}

.share-dialog-meta,
.share-dialog-status {
  min-height: 1.25rem;
  margin-top: calc(var(--sv-space-4) * -1) !important;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption) !important;
}

.share-dialog-status {
  color: var(--sv-black) !important;
  font-weight: 600;
}

.share-dialog-actions {
  justify-content: space-between;
  padding-top: var(--sv-space-4);
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.dialog-button.danger-quiet {
  color: var(--sv-black);
  border-color: var(--sv-gray-mid);
}

.dialog-button.danger-quiet:hover {
  color: var(--sv-white);
  background: var(--sv-black);
  border-color: var(--sv-black);
}

/* Sign-in */

.auth-screen {
  position: fixed;
  z-index: calc(var(--sv-z-modal) + 1);
  inset: 0;
  display: grid;
  /* Same trap as .main: the implicit column is auto-sized, so it floored at the
   * embedded Clerk card's min-content (~403px) and pushed the card off a zoomed
   * phone screen. Pin the column to the viewport and let the card shrink. */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  overflow-y: auto;
  padding: var(--sv-gutter);
  color: var(--sv-black);
  background: var(--sv-home-bg);
}

.auth-glow {
  display: none;
}

.auth-card {
  position: relative;
  width: min(100%, 28rem);
  max-width: 100%;
  padding: var(--sv-space-8);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-black);
}

.auth-title {
  margin: 0;
  color: var(--sv-black);
  font-size: inherit;
  font-weight: inherit;
}

.auth-title .wordmark {
  font-size: 24px;
}

.auth-tagline {
  margin: var(--sv-space-6) 0 var(--sv-space-8);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
  line-height: 1.5;
}

.auth-loading {
  display: flex;
  justify-content: center;
  padding: var(--sv-space-8) 0;
  color: var(--sv-black);
}

#clerk-signin {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

/* The Clerk widget ships its own fixed-ish card width; let it track our card
 * instead of overflowing it on narrow/zoomed viewports. */
#clerk-signin .cl-rootBox,
#clerk-signin .cl-cardBox,
#clerk-signin .cl-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.auth-blocked {
  padding-top: var(--sv-space-4);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
  line-height: 1.5;
}

.auth-blocked p {
  margin: 0 0 var(--sv-space-6);
}

.auth-blocked strong {
  color: var(--sv-black);
  font-weight: 700;
}

.auth-signout {
  color: var(--sv-white);
  background: var(--sv-black);
}

/* Responsive
 *
 * Each rail is demoted to an overlay by its own width cap, plus a touch-tablet
 * clause. A landscape iPad Pro is 1366x1024 CSS px (1376 on the 13" M4) —
 * desktop-wide, so the width caps alone kept all three columns docked and left
 * the conversation ~750px, with no pointer to reclaim it: the resize handle
 * wants a mouse. Pairing the tablet cap with hover/pointer keeps a 1366px
 * laptop docked and demotes only coarse-pointer tablets, portrait included.
 * app.js mirrors both query lists in matchMedia — keep the two in step. */

@media (max-width: 1180px), (max-width: 1400px) and (hover: none) and (pointer: coarse) {
  .app.activity-open {
    grid-template-columns: var(--sv-rail) minmax(0, 1fr);
  }

  .app.sidebar-collapsed.activity-open {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .activity-panel,
  .app.activity-open .activity-panel {
    position: fixed;
    z-index: var(--sv-z-overlay);
    inset: 0 0 0 auto;
    display: grid;
    width: min(100%, calc(var(--sv-activity-rail) + var(--sv-space-12)));
    visibility: hidden;
    transform: translateX(100%);
    transition:
      transform var(--sv-dur-base) var(--sv-ease-inout),
      visibility 0s linear var(--sv-dur-base);
  }

  .app.activity-open .activity-panel {
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .activity-scrim {
    position: fixed;
    z-index: calc(var(--sv-z-overlay) - 1);
    inset: 0;
    display: block;
    visibility: hidden;
    background: transparent;
    opacity: 0;
    transition:
      opacity var(--sv-dur-base) var(--sv-ease-out),
      visibility 0s linear var(--sv-dur-base);
  }

  .app.activity-open .activity-scrim {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
  }
}

@media (max-width: 900px), (max-width: 1400px) and (hover: none) and (pointer: coarse) {
  .app,
  .app.sidebar-collapsed {
    display: block;
  }

  .sidebar-resize-handle { display: none; }

  .sidebar,
  .app.sidebar-collapsed .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: var(--sv-z-overlay);
    width: min(100%, calc(var(--sv-rail) + var(--sv-space-16)));
    visibility: visible;
    transform: translateX(-100%);
    transition: transform var(--sv-dur-base) var(--sv-ease-inout);
  }

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

  .sidebar-scrim {
    position: fixed;
    z-index: calc(var(--sv-z-overlay) - 1);
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgb(0 0 0 / 0.6);
    opacity: 0;
    transition:
      opacity var(--sv-dur-base) var(--sv-ease-out),
      visibility 0s linear var(--sv-dur-base);
  }

  .app.sidebar-open .sidebar-scrim {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
  }

  .main {
    width: 100%;
    height: 100svh;
  }

  .sidebar-open-btn,
  .app.sidebar-collapsed .sidebar-open-btn {
    display: inline-flex;
  }

  .messages {
    padding-top: var(--sv-space-8);
  }
}

/* The Workboard overlay lands on top of the thread header's own toggle, so on a
 * touch tablet it needs the way back the phone already gets. */
@media (max-width: 1400px) and (hover: none) and (pointer: coarse) {
  .activity-panel,
  .app.activity-open .activity-panel {
    background: var(--sv-white);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .activity-close-btn {
    display: inline-flex;
  }
}

@media (max-width: 600px) {
  .sidebar-head-actions .icon-btn { width: 44px; height: 44px; flex-basis: 44px; }
  .app-launcher-menu { right: var(--sv-space-3); left: auto; width: min(208px, calc(100vw - 24px)); }
  .thread-head {
    padding: 0 var(--sv-space-3);
  }

  .activity-panel,
  .app.activity-open .activity-panel {
    width: 100%;
  }

  .activity-head {
    padding: 0 var(--sv-space-3) 0 var(--sv-space-4);
  }

  .activity-close-btn {
    display: inline-flex;
  }

  .assumptions-list {
    padding-right: var(--sv-space-4);
    padding-left: calc(var(--sv-space-4) + 1.25rem);
  }

  .assumptions-empty,
  .todos-empty {
    padding-right: var(--sv-space-4);
    padding-left: var(--sv-space-4);
  }

  .todos-list {
    padding-right: var(--sv-space-4);
    padding-left: var(--sv-space-4);
  }

  .activity-item {
    padding: var(--sv-space-4);
  }

  .activity-tool-summary {
    padding: var(--sv-space-4);
  }

  .activity-tool-entry {
    padding-right: var(--sv-space-4);
    padding-left: calc(var(--sv-space-4) + 32px + var(--sv-space-3));
  }

  .thread-context {
    display: none;
  }

  /* The subtitle is the separator's left-hand side. With it hidden the pill's
   * leading "·" was an orphan bullet at the start of the line. */
  .turn-status::before {
    display: none;
  }

  .messages {
    padding: var(--sv-space-8) var(--sv-gutter) var(--sv-space-12);
  }

  .msg.assistant {
    display: block;
    padding-top: var(--sv-space-4);
  }

  .response-copy-button { grid-column: auto; min-height: 40px; }

  .msg.peer { display: block; }
  .peer-role { margin-bottom: var(--sv-space-3); }
  .peer-message { padding: 0 var(--sv-space-4); }

  .msg-role {
    margin-bottom: var(--sv-space-4);
  }

  .msg-footer {
    grid-column: auto;
  }

  .msg.user .bubble {
    width: 92%;
    padding: var(--sv-space-4);
  }

  .status-line {
    display: block;
  }

  .empty,
  .thread-starter {
    justify-content: flex-start;
    padding: var(--sv-space-16) 0;
  }

  .empty h2,
  .thread-starter h2 {
    font-size: var(--sv-text-h2);
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
    margin-top: var(--sv-space-8);
  }

  .suggestion {
    min-height: 96px;
    padding: var(--sv-space-4);
  }

  .composer-wrap {
    padding: var(--sv-space-3) var(--sv-gutter);
  }

  .composer-note {
    display: none;
  }

  .dialog-card,
  .auth-card {
    padding: var(--sv-space-6);
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-button {
    width: 100%;
  }

  /* Phone header: keep only Share + Activity. Fork and New chat stay reachable
   * from the sidebar row actions, and dropping them stops the overflow. */
  .thread-context-actions .icon-btn {
    display: none;
  }

  .share-thread-button {
    min-width: 0;
    padding: 0 var(--sv-space-3);
  }

  .share-link-control {
    grid-template-columns: 1fr;
  }

  .share-link-control input {
    border-right: var(--sv-hairline-w) solid var(--sv-black);
    border-bottom: 0;
  }

  .share-dialog-actions {
    flex-direction: column-reverse;
  }
}

/* Phones: the Share pill goes icon-only so the thread title keeps enough room
 * to be readable rather than a truncated stub. */
@media (max-width: 420px) {
  .share-thread-button span {
    display: none;
  }

  .share-thread-button {
    gap: 0;
    width: 40px;
    padding: 0;
  }
}

@media (max-width: 359px) {
  .brand .wordmark-text {
    display: none;
  }
}

/* Deep zoom: the sidebar rail is only as wide as the viewport, and on touch
 * devices every row's action buttons are permanently visible (see the
 * hover:none block). Five 32px targets no longer fit beside the row label, so
 * tighten them rather than let the last one sit outside the rail. */
@media (max-width: 300px) {
  .row-actions .icon-btn {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  /* At this width the title truncates to a stub like "S…", which is noise next
   * to the controls. The full title is still the document title and is shown
   * on the thread row in the sidebar. */
  .thread-title {
    display: none;
  }

  /* With the title gone the dot would keep its own (now empty) heading row and
   * float above the status line. Collapse the grid to one row so it stays on
   * the axis of whatever text remains. */
  .thread-heading {
    grid-template-areas: "dot sub";
  }
}

@media (hover: none) {
  .row-actions {
    opacity: 1;
    pointer-events: auto;
  }

  /* No hover to reveal it on touch, and a finger needs a real target. */
  .project-drag {
    width: 28px;
    height: 44px;
    flex-basis: 28px;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --sv-dur-instant: 1ms;
    --sv-dur-fast: 1ms;
    --sv-dur-base: 1ms;
    --sv-dur-slow: 1ms;
    --sv-dur-cine: 1ms;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .activity-panel {
    background: var(--sv-white);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .project-row,
  .thread-row,
  .notice,
  .suggestion,
  .composer,
  .dialog-field input {
    border-color: currentColor;
  }

  .activity-panel {
    background: rgb(255 255 255 / 0.96);
    border-color: var(--sv-black);
  }
}

@media (forced-colors: active) {
  .thread-row.selected {
    outline: 2px solid CanvasText;
    outline-offset: -2px;
  }

  .spinner {
    background: CanvasText;
  }

  .status-dot {
    border-color: CanvasText;
  }

  .status-dot.live {
    background: Highlight;
    border-color: Highlight;
  }
}

/* ---------- Multi-member workspaces ---------- */

.workspace-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-2);
  padding: var(--sv-space-4) var(--sv-space-6) var(--sv-space-2);
  color: var(--sv-ink-secondary);
  font-size: var(--sv-text-caption);
  letter-spacing: var(--sv-tracking-caps);
  line-height: 1;
  text-transform: uppercase;
}

.workspace-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-1);
  opacity: 0.8;
  font-size: 10px;
  letter-spacing: var(--sv-tracking-caps);
}

.workspace-badge .icon {
  width: 13px;
  height: 13px;
}

.project-readonly .project-name {
  color: var(--sv-ink-secondary);
}

.row-lock {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--sv-space-2);
  color: var(--sv-ink-secondary);
}

.row-lock .icon {
  width: 14px;
  height: 14px;
}

.readonly-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-4);
  padding: var(--sv-space-4) var(--sv-gutter);
  background: var(--sv-surface-sunken);
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light);
}

.readonly-copy {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-1);
  font-size: var(--sv-text-small);
  line-height: 1.45;
}

.readonly-copy strong {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-1);
  font-size: var(--sv-text-caption);
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.readonly-copy strong .icon {
  width: 14px;
  height: 14px;
}

.readonly-copy span {
  color: var(--sv-ink-secondary);
}

.readonly-action {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-2);
  flex: none;
  height: 40px;
  padding: 0 var(--sv-space-4);
  color: var(--sv-white);
  background: var(--sv-black);
  border: var(--sv-hairline-w) solid var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 600;
  transition:
    color var(--sv-dur-fast) var(--sv-ease-out),
    background-color var(--sv-dur-fast) var(--sv-ease-out);
}

.readonly-action:hover {
  color: var(--sv-black);
  background: transparent;
}

.readonly-action .icon {
  width: 18px;
  height: 18px;
}

.fork-note {
  display: flex;
  align-items: center;
  gap: var(--sv-space-2);
  margin-bottom: var(--sv-space-4);
  padding: var(--sv-space-3) var(--sv-space-4);
  color: var(--sv-ink-secondary);
  background: var(--sv-surface-sunken);
  border-left: 2px solid var(--sv-green);
  font-size: var(--sv-text-small);
  line-height: 1.45;
}

.fork-note .icon {
  width: 16px;
  height: 16px;
  flex: none;
}

@media (max-width: 640px) {
  .readonly-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .readonly-action {
    justify-content: center;
  }
}

/* Persistent turn receipts — the WebUI equivalent of Discord reactions. */
.msg.user {
  flex-wrap: wrap;
}

.msg-receipt {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sv-space-2);
  width: min(72ch, 78%);
  margin-top: var(--sv-space-2);
  color: var(--sv-gray-dark);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}

.receipt-dot,
.turn-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.msg-receipt[data-tone="live"] .receipt-dot,
.turn-status[data-tone="live"] .turn-status-dot {
  color: var(--sv-green);
  background: var(--sv-green);
  animation: status-breathe 1800ms var(--sv-ease-inout) infinite;
}
.msg-receipt[data-tone="done"] .receipt-dot { color: var(--sv-green); background: var(--sv-green); }
.msg-receipt[data-tone="wait"] .receipt-dot,
.turn-status[data-tone="wait"] .turn-status-dot { color: var(--sv-gray-dark); background: var(--sv-gray-dark); }
.msg-receipt[data-tone="attention"] .receipt-dot,
.turn-status[data-tone="attention"] .turn-status-dot { color: #9a6700; background: #9a6700; }
.msg-receipt[data-tone="error"] .receipt-dot,
.turn-status[data-tone="error"] .turn-status-dot { color: #b42318; background: #b42318; }
.msg-receipt[data-phase="stalled"] .receipt-dot,
.turn-status[data-phase="stalled"] .turn-status-dot {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px #b42318;
}
.receipt-meta::before { content: "·"; margin-right: var(--sv-space-2); }

.turn-status {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sv-space-2);
  min-width: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 400;
  line-height: 1.25;
  white-space: nowrap;
}
.turn-status::before {
  content: "·";
  color: var(--sv-gray-mid);
}
.turn-status-label {
  overflow: hidden;
  color: var(--sv-black);
  text-overflow: ellipsis;
}
.turn-status-meta { color: var(--sv-gray-dark); }
.turn-status-meta::before { content: "·"; margin-right: var(--sv-space-2); }

.status-dot[data-phase="input"] { border-color: #9a6700; background: #9a6700; }
.status-dot[data-phase="error"] { border-color: #b42318; background: #b42318; }
/* Unanswered: the member is owed a reply nobody delivered. Hollow, not filled,
   so it reads as an outstanding debt rather than a finished state. */
.status-dot[data-phase="stalled"] { border-color: #b42318; background: transparent; }
.status-dot[data-phase="done"] { border-color: var(--sv-green); }

@media (max-width: 700px) {
  .msg-receipt { width: min(88%, 72ch); }
}

/* ---------- Shared links audit panel ---------- */
.shares-dialog-card {
  width: min(58rem, 100%);
  max-height: min(85vh, 60rem);
  overflow-y: auto;
}

.shares-list { display: grid; gap: var(--sv-space-4); margin-top: var(--sv-space-5); }

/* ---------- Hidden workspaces dialog ---------- */

.hidden-list {
  display: grid;
  gap: var(--sv-space-3);
  margin-top: var(--sv-space-5);
  max-height: min(60vh, 480px);
  overflow: auto;
}

.hidden-row {
  display: flex;
  align-items: center;
  gap: var(--sv-space-4);
  padding-bottom: var(--sv-space-3);
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
}

.hidden-row-copy { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.hidden-row-name { font-weight: 600; }
.hidden-row > button {
  flex: 0 0 auto;
  min-width: 0;
  height: 40px;
  padding: 0 var(--sv-space-4);
  font-size: 14px;
  white-space: nowrap;
}

.hidden-row-meta {
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden-sublist {
  display: grid;
  gap: var(--sv-space-2);
  margin: calc(var(--sv-space-2) * -1) 0 0;
  padding: 0 0 0 var(--sv-space-4);
  list-style: none;
}

.hidden-sublist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-3);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
}

.hidden-sublist-action {
  padding: 0;
  color: var(--sv-black);
  background: transparent;
  border-bottom: 1px solid currentColor;
  font-size: inherit;
}

@media (max-width: 560px) {
  .hidden-row { align-items: flex-start; flex-direction: column; gap: var(--sv-space-2); }
  .hidden-row-meta { white-space: normal; }
}

/* ---------- Project info dialog ---------- */

.project-info-dialog { width: min(calc(100% - (var(--sv-space-6) * 2)), 34rem); }
.project-info-card { gap: var(--sv-space-5); max-height: min(80vh, 640px); overflow: auto; }

.pi-section { display: grid; gap: var(--sv-space-3); }

.pi-section-title {
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-weight: 700;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.pi-member-list,
.pi-artifact-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: var(--sv-hairline-w) solid var(--sv-hairline);
}

.pi-member,
.pi-artifact {
  display: flex;
  align-items: center;
  gap: var(--sv-space-3);
  padding: var(--sv-space-3) 0;
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
}

.pi-empty {
  padding: var(--sv-space-3) 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
}

.pi-member-email {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--sv-text-small);
}

.pi-member-role {
  flex: 0 0 auto;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}

.pi-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--sv-gray-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.pi-remove-btn:hover { color: var(--sv-black); }
.pi-remove-btn .icon { width: 16px; height: 16px; }
.pi-remove-btn:disabled { opacity: 0.4; cursor: default; }

.pi-artifact-link {
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.pi-artifact-link:hover .pi-artifact-title { text-decoration: underline; }

.pi-artifact-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--sv-text-small);
  font-weight: 600;
}

.pi-artifact-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}

.pi-invite-form,
.pi-artifact-form { display: grid; gap: var(--sv-space-3); }

.pi-invite-row {
  display: flex;
  gap: var(--sv-space-2);
}

.pi-invite-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.pi-invite-row select { flex: 0 0 auto; width: auto; }

.pi-invite-form input,
.pi-invite-form select,
.pi-artifact-form input,
.pi-artifact-form select {
  height: 42px;
  padding: 0 var(--sv-space-3);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  font-size: 15px;
}
.pi-invite-form input:focus,
.pi-invite-form select:focus,
.pi-artifact-form input:focus,
.pi-artifact-form select:focus { border-color: var(--sv-black); outline: 0; }

.pi-invite-row .dialog-button { flex: 0 0 auto; height: 42px; padding: 0 var(--sv-space-4); }

.pi-welcome-opt {
  display: flex;
  align-items: center;
  gap: var(--sv-space-2);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}
.pi-welcome-opt input { width: 15px; height: 15px; accent-color: var(--sv-black); }

.pi-section-note {
  margin: calc(var(--sv-space-2) * -1) 0 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}

.pi-context-form { display: grid; gap: var(--sv-space-3); min-width: 0; }

.pi-context-form textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 96px;
  max-height: 40vh;
  padding: var(--sv-space-3);
  resize: vertical;
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  font-size: 15px;
  line-height: 1.5;
}
.pi-context-form textarea:focus { border-color: var(--sv-black); outline: 0; }
.pi-context-form textarea::placeholder { color: var(--sv-gray-dark); opacity: 1; }
.pi-context-form textarea[readonly] { background: var(--sv-off-white); resize: none; }

.pi-context-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-3);
}

.pi-context-count { color: var(--sv-gray-dark); font-size: var(--sv-text-caption); }
.pi-context-row .dialog-button { flex: 0 0 auto; height: 42px; padding: 0 var(--sv-space-4); }

@media (max-width: 600px) {
  .pi-invite-row { flex-wrap: wrap; }
  .pi-invite-row input { flex-basis: 100%; }
}

.shares-item {
  padding: var(--sv-space-4);
  border: var(--sv-hairline-w) solid var(--sv-gray-mid);
}

.shares-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sv-space-3);
}

.shares-item h3 {
  margin: 0 0 var(--sv-space-1);
  font-size: var(--sv-text-body);
  font-weight: 600;
  line-height: 1.25;
}

.shares-item-meta,
.shares-item-recipients,
.shares-item-summary,
.shares-item-empty {
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}

.shares-item-actions { display: flex; flex-wrap: wrap; gap: var(--sv-space-2); }
.shares-item-actions .dialog-button { height: 36px; padding: 0 var(--sv-space-3); font-size: var(--sv-text-caption); }

.shares-item-recipients { margin-top: var(--sv-space-2); overflow-wrap: anywhere; }
.shares-item-summary { margin-top: var(--sv-space-4); color: var(--sv-black); font-weight: 600; }
.shares-item-empty { margin-top: var(--sv-space-4); }

.share-access-list {
  display: grid;
  gap: var(--sv-space-1);
  margin: var(--sv-space-2) 0 0;
  padding: 0;
  list-style: none;
}

.share-access {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--sv-space-3);
  padding: var(--sv-space-2) 0;
  border-top: var(--sv-hairline-w) solid var(--sv-gray-light, #e4e7e8);
  font-size: var(--sv-text-caption);
}

.share-access-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.share-access-badge {
  padding: 2px var(--sv-space-2);
  color: var(--sv-black);
  background: var(--sv-green);
  font-weight: 700;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
  font-size: 10px;
}

.share-access.denied .share-access-badge { color: var(--sv-white); background: var(--sv-black); }
.share-access-when { color: var(--sv-gray-dark); white-space: nowrap; }

@media (max-width: 560px) {
  .share-access { grid-template-columns: minmax(0, 1fr) auto; }
  .share-access-when { grid-column: 1 / -1; }
  /* Keep the three actions on one row instead of a tall stack. */
  .shares-item-head { flex-direction: column; }
  .shares-item-actions { width: 100%; flex-wrap: nowrap; }
  .shares-item-actions .dialog-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 var(--sv-space-1);
    white-space: nowrap;
    font-size: 11px;
  }
}

/* Artifact gallery: real page captures, squared surfaces, tokens only. */
.artifacts-dialog { width: min(calc(100% - (var(--sv-space-6) * 2)), 68rem); }
.artifacts-dialog-card {
  gap: var(--sv-space-4);
  padding: var(--sv-space-6);
  max-height: min(86vh, 52rem);
}

.artifacts-filter {
  display: flex;
  gap: var(--sv-space-2);
  flex: 0 0 auto;
  overflow-x: auto;
  padding-bottom: var(--sv-space-1);
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
}

.artifact-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sv-space-2);
  flex: 0 0 auto;
  height: 32px;
  padding: 0 var(--sv-space-3);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  color: var(--sv-gray-dark);
  background: transparent;
  font: inherit;
  font-size: var(--sv-text-caption);
  white-space: nowrap;
  cursor: pointer;
}

.artifact-filter-btn span {
  color: var(--sv-gray-mid);
  font-variant-numeric: tabular-nums;
}

.artifact-filter-btn:hover { border-color: var(--sv-black); color: var(--sv-black); }

.artifact-filter-btn.is-active {
  border-color: var(--sv-black);
  color: var(--sv-white);
  background: var(--sv-black);
}

.artifact-filter-btn.is-active span { color: var(--sv-gray-light); }

.artifacts-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--sv-space-4);
  overflow: auto;
  padding-bottom: var(--sv-space-2);
}

.artifacts-empty {
  grid-column: 1 / -1;
  margin: var(--sv-space-8) 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
  text-align: center;
}

.artifact-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  background: var(--sv-white);
  transition: border-color var(--sv-dur-instant) var(--sv-ease-out);
}

.artifact-card:hover { border-color: var(--sv-black); }

/* 1280x800 capture, so the frame matches the shot's aspect ratio exactly. */
.artifact-preview {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
  background: var(--sv-off-white);
}

.artifact-preview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sv-space-4);
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  text-align: center;
  overflow-wrap: anywhere;
}

.artifact-shot {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0;
  transition: opacity var(--sv-dur-fast) var(--sv-ease-out);
}

.artifact-card.has-shot .artifact-shot { opacity: 1; }
.artifact-card.has-shot .artifact-preview-fallback { display: none; }

.artifact-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-2);
  flex: 1 1 auto;
  padding: var(--sv-space-3) var(--sv-space-4) var(--sv-space-4);
}

.artifact-card-title {
  color: var(--sv-black);
  font-size: var(--sv-text-small);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.artifact-card-title:hover { text-decoration: underline; }

.artifact-card-meta {
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-card-foot {
  display: flex;
  align-items: center;
  gap: var(--sv-space-2);
  margin-top: auto;
  padding-top: var(--sv-space-2);
  min-width: 0;
}

.artifact-card-kind {
  flex: 0 0 auto;
  color: var(--sv-gray-mid);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.artifact-card-source {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sv-gray-dark);
  font: inherit;
  font-size: var(--sv-text-caption);
  text-align: right;
  text-decoration: underline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.artifact-card-source:hover { color: var(--sv-black); }

.artifact-card-delete {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  margin-left: auto;
  padding: 0;
  color: var(--sv-gray-dark);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  cursor: pointer;
}
.artifact-card-delete:hover,
.artifact-card-delete:focus-visible { color: var(--sv-red, #b42318); border-color: currentColor; }
.artifact-card-delete:disabled { opacity: .45; cursor: wait; }
.artifact-card-delete .icon { width: 14px; height: 14px; }

@media (max-width: 600px) {
  .artifacts-dialog-card { padding: var(--sv-space-4); }
  .artifacts-gallery { grid-template-columns: 1fr; }
}

/* Artifact gallery search */
.artifacts-search {
  display: flex;
  align-items: center;
  gap: var(--sv-space-2);
  height: 40px;
  padding: 0 var(--sv-space-3);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  background: var(--sv-white);
}
.artifacts-search:focus-within { border-color: var(--sv-black); }
.artifacts-search-icon { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: var(--sv-gray-mid); stroke-width: 1.8; stroke-linecap: round; }
#artifacts-search-input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--sv-black); font: inherit; font-size: var(--sv-text-small); }
#artifacts-search-input::placeholder { color: var(--sv-gray-mid); }
#artifacts-search-clear { border: 0; padding: 0; background: transparent; color: var(--sv-gray-dark); font: inherit; font-size: var(--sv-text-caption); cursor: pointer; }
#artifacts-search-clear:hover { color: var(--sv-black); text-decoration: underline; }

/* Venture pipeline */

.venture-card {
  gap: var(--sv-space-4);
  width: min(100%, 44rem);
  max-height: min(90vh, 54rem);
  overflow-y: auto;
}

.venture-card textarea {
  width: 100%;
  padding: var(--sv-space-3) var(--sv-space-4);
  color: var(--sv-black);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: var(--sv-leading-body);
  resize: vertical;
}

.venture-card textarea:focus {
  border-color: var(--sv-black);
  outline: none;
}

.venture-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sv-space-4);
}

.venture-hint {
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}

.venture-error:empty { display: none; }

.venture-error {
  margin: 0;
  color: #a21b16;
  font-size: var(--sv-text-caption);
}

.venture-head-actions {
  display: flex;
  align-items: center;
  gap: var(--sv-space-3);
}

.venture-stage-filter {
  display: flex;
  gap: var(--sv-space-2);
  flex: 0 0 auto;
  overflow-x: auto;
  padding-bottom: var(--sv-space-1);
  border-bottom: var(--sv-hairline-w) solid var(--sv-hairline);
}

.venture-filter-chip {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 var(--sv-space-3);
  color: var(--sv-gray-dark);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  font: inherit;
  font-size: var(--sv-text-caption);
  white-space: nowrap;
  cursor: pointer;
}

.venture-filter-chip:hover { border-color: var(--sv-black); color: var(--sv-black); }

.venture-filter-chip[aria-pressed="true"] {
  color: var(--sv-white);
  background: var(--sv-black);
  border-color: var(--sv-black);
}

.venture-list {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-4);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.venture-empty {
  margin: 0;
  padding: var(--sv-space-8) 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-small);
}

.venture-row {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-3);
  padding: var(--sv-space-5);
  background: var(--sv-white);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
}

.venture-row-head {
  display: flex;
  align-items: center;
  gap: var(--sv-space-3);
  flex-wrap: wrap;
}

.venture-row-name {
  margin: 0;
  color: var(--sv-black);
  font-size: var(--sv-text-h4);
  font-weight: 500;
  line-height: var(--sv-leading-heading);
}

.venture-stage-chip {
  padding: 2px var(--sv-space-3);
  color: var(--sv-white);
  background: var(--sv-black);
  font-size: var(--sv-text-caption);
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.venture-score {
  margin-left: auto;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
  font-variant-numeric: tabular-nums;
}

.venture-row-meta {
  margin: 0;
  color: var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}

.venture-row-meta strong {
  color: var(--sv-black);
  font-weight: 500;
}

.venture-row-concept {
  margin: 0;
  color: var(--sv-gray-xdark);
  font-size: var(--sv-text-small);
  line-height: var(--sv-leading-body);
}

.venture-facts {
  display: grid;
  grid-template-columns: minmax(9rem, auto) minmax(0, 1fr);
  gap: var(--sv-space-2) var(--sv-space-4);
  margin: 0;
  font-size: var(--sv-text-caption);
}

.venture-facts dt {
  color: var(--sv-gray-mid);
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.venture-facts dd {
  margin: 0;
  color: var(--sv-gray-xdark);
  line-height: 1.5;
}

.venture-links {
  display: flex;
  align-items: center;
  gap: var(--sv-space-2);
  flex-wrap: wrap;
}

.venture-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--sv-space-3);
  color: var(--sv-black);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-gray-light);
  font-size: var(--sv-text-caption);
  text-decoration: none;
  cursor: pointer;
}

.venture-link:hover {
  color: var(--sv-white);
  background: var(--sv-black);
  border-color: var(--sv-black);
}

.venture-link-button { font: inherit; font-size: var(--sv-text-caption); }

.venture-pending {
  color: var(--sv-gray-mid);
  font-size: var(--sv-text-caption);
}

@media (max-width: 600px) {
  .venture-form-row { grid-template-columns: minmax(0, 1fr); }
  .venture-facts { grid-template-columns: minmax(0, 1fr); gap: var(--sv-space-1); }
  .venture-facts dd { margin-bottom: var(--sv-space-2); }
  .venture-head-actions { flex-wrap: wrap; }
  .venture-link { min-height: 44px; }
  .venture-filter-chip { min-height: 44px; }
}

/* ---------- ShareOS HUD ---------- */

.hud-nav-btn {
  position: relative;
}

.hud-nav-btn .messages-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  color: var(--sv-black);
  background: var(--sv-white);
  border: 1px solid var(--sv-black);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.hud-nav-btn.has-live {
  color: var(--sv-white);
  box-shadow: inset 0 -2px 0 var(--sv-green);
}

.hud-nav-btn.has-live .messages-badge {
  background: var(--sv-green);
}

.hud-dialog {
  width: min(calc(100% - 48px), 96rem);
  height: calc(100dvh - 48px);
  max-width: none;
  max-height: none;
  padding: 0;
  color: var(--sv-white);
  background: var(--sv-black);
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
  overflow: hidden;
}

.hud-dialog::backdrop {
  background: rgb(0 0 0 / 0.76);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.hud-shell {
  position: relative;
  display: grid;
  grid-template-rows: 72px auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background-color: var(--sv-black);
}

.hud-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sv-space-4);
  min-width: 0;
  padding: 0 var(--sv-space-6);
  background: rgb(0 0 0 / 0.9);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-xdark);
}

.hud-identity,
.hud-head-actions,
.hud-sync {
  display: flex;
  align-items: center;
}

.hud-identity {
  min-width: 0;
  gap: var(--sv-space-3);
}

.hud-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
}

.hud-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.hud-identity h2,
.hud-identity p {
  margin: 0;
}

.hud-identity h2 {
  color: var(--sv-white);
  font-size: var(--sv-text-body);
  font-weight: 700;
  line-height: 1.1;
}

.hud-identity p {
  margin-top: 2px;
  color: var(--sv-gray-mid);
  font-size: var(--sv-text-caption);
  font-weight: 300;
}

.hud-head-actions {
  flex: 0 0 auto;
  gap: var(--sv-space-3);
}

.hud-sync {
  gap: var(--sv-space-2);
  color: var(--sv-gray-mid);
  font-size: var(--sv-text-caption);
  font-variant-numeric: tabular-nums;
}

.hud-sync i {
  display: block;
  width: 7px;
  height: 7px;
  background: var(--sv-gray-dark);
  border-radius: 50%;
}

.hud-sync.is-live i {
  background: var(--sv-green);
}

.hud-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--sv-white);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
}

.hud-close:hover,
.hud-close:focus-visible {
  color: var(--sv-black);
  background: var(--sv-white);
}

.hud-search {
  position: relative;
  z-index: 3;
  padding: var(--sv-space-4) var(--sv-space-6);
  background: rgb(0 0 0 / 0.88);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-xdark);
}

.hud-search-field {
  display: flex;
  align-items: center;
  gap: var(--sv-space-3);
  height: 52px;
  padding: 0 var(--sv-space-4);
  color: var(--sv-white);
  background: var(--sv-gray-xdark);
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
}

.hud-search-field:focus-within {
  border-color: var(--sv-white);
}

.hud-search-field .icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  color: var(--sv-gray-light);
}

.hud-search-field input {
  width: 100%;
  min-width: 0;
  color: var(--sv-white);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
}

.hud-search-field input::placeholder {
  color: var(--sv-gray-mid);
}

.hud-search-field kbd {
  flex: 0 0 auto;
  color: var(--sv-gray-mid);
  font-size: 11px;
}

.hud-search-results {
  position: absolute;
  z-index: 5;
  top: calc(100% - var(--sv-space-4));
  right: var(--sv-space-6);
  left: var(--sv-space-6);
  max-height: min(52vh, 460px);
  padding: var(--sv-space-2);
  overflow-y: auto;
  background: var(--sv-black);
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
  box-shadow: 0 18px 48px rgb(0 0 0 / 0.55);
}

.hud-grid {
  display: grid;
  grid-template-columns: minmax(15rem, 0.85fr) minmax(21rem, 1.25fr) minmax(17rem, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.hud-zone {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: rgb(0 0 0 / 0.72);
  border-right: var(--sv-hairline-w) solid var(--sv-gray-xdark);
  overflow: hidden;
}

.hud-zone:last-child {
  border-right: 0;
}

.hud-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 var(--sv-space-4);
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-xdark);
}

.hud-zone-head h3,
.hud-zone-head span,
.hud-recent h4 {
  margin: 0;
  color: var(--sv-gray-light);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.hud-zone-head span {
  color: var(--sv-gray-mid);
  font-variant-numeric: tabular-nums;
}

.hud-list {
  min-width: 0;
  overflow-y: auto;
}

.hud-needs > .hud-list {
  flex: 1 1 auto;
}

.hud-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  gap: var(--sv-space-3);
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: var(--sv-space-3) var(--sv-space-4);
  color: var(--sv-white);
  background: transparent;
  border-bottom: var(--sv-hairline-w) solid var(--sv-gray-xdark);
  text-align: left;
}

.hud-row:hover,
.hud-row:focus-visible,
.hud-row.is-active {
  color: var(--sv-black);
  background: var(--sv-white);
  outline-offset: -3px;
}

.hud-row[data-tone="received"],
.hud-row[data-tone="working"],
.hud-row[data-tone="writing"] {
  box-shadow: inset 2px 0 0 var(--sv-green);
}

.hud-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--sv-gray-light);
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
}

.hud-row:hover .hud-row-icon,
.hud-row:focus-visible .hud-row-icon,
.hud-row.is-active .hud-row-icon {
  color: var(--sv-black);
  border-color: var(--sv-black);
}

.hud-row-icon .icon {
  width: 16px;
  height: 16px;
}

.hud-row-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.hud-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sv-space-3);
  min-width: 0;
}

.hud-row-top strong {
  min-width: 0;
  overflow: hidden;
  font-size: var(--sv-text-small);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-row-meta {
  flex: 0 0 auto;
  color: var(--sv-gray-mid);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.hud-row-context,
.hud-row-detail {
  overflow: hidden;
  color: var(--sv-gray-mid);
  font-size: var(--sv-text-caption);
  font-weight: 300;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-row:hover .hud-row-meta,
.hud-row:hover .hud-row-context,
.hud-row:hover .hud-row-detail,
.hud-row:focus-visible .hud-row-meta,
.hud-row:focus-visible .hud-row-context,
.hud-row:focus-visible .hud-row-detail,
.hud-row.is-active .hud-row-meta,
.hud-row.is-active .hud-row-context,
.hud-row.is-active .hud-row-detail {
  color: var(--sv-gray-dark);
}

.hud-row-arrow {
  color: var(--sv-gray-dark);
}

.hud-row-arrow .icon {
  width: 16px;
  height: 16px;
}

.hud-live-body {
  display: grid;
  grid-template-columns: minmax(132px, 0.42fr) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.hud-live-list {
  border-left: var(--sv-hairline-w) solid var(--sv-gray-xdark);
}

.hud-core {
  position: relative;
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(11vw, 148px);
  height: min(11vw, 148px);
  min-width: 112px;
  min-height: 112px;
  margin: var(--sv-space-8) auto;
  flex-direction: column;
  color: var(--sv-gray-light);
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
  border-radius: 50%;
}

.hud-core::before,
.hud-core::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.hud-core::before {
  inset: 8px;
  border: var(--sv-hairline-w) dashed var(--sv-gray-dark);
}

.hud-core::after {
  inset: 20px;
  border: var(--sv-hairline-w) solid var(--sv-gray-xdark);
}

.hud-core span,
.hud-core small {
  position: relative;
  z-index: 1;
}

.hud-core span {
  color: var(--sv-white);
  font-size: clamp(2.25rem, 4vw, 4rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
}

.hud-core small {
  margin-top: var(--sv-space-2);
  color: var(--sv-gray-mid);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hud-core.is-live {
  border-color: var(--sv-green);
}

.hud-core.is-live span {
  color: var(--sv-green);
}

.hud-empty {
  padding: var(--sv-space-6) var(--sv-space-4);
  margin: 0;
  color: var(--sv-gray-mid);
  font-size: var(--sv-text-caption);
  font-weight: 300;
}

.hud-recent-scroll {
  min-height: 0;
  overflow-y: auto;
}

.hud-recent h4 {
  padding: var(--sv-space-4) var(--sv-space-4) var(--sv-space-2);
  color: var(--sv-gray-mid);
}

.hud-artifact-list .hud-row {
  min-height: 64px;
}

.hud-tracking {
  color: var(--sv-gray-light);
  font-size: var(--sv-text-caption);
  font-variant-numeric: tabular-nums;
}

.hud-tracking[hidden] {
  display: none;
}

.hud-glasses {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sv-space-2);
  min-width: 94px;
  height: 44px;
  padding: 0 var(--sv-space-3);
  color: var(--sv-white);
  background: transparent;
  border: var(--sv-hairline-w) solid var(--sv-gray-dark);
  font-size: var(--sv-text-caption);
}

.hud-glasses .icon {
  width: 17px;
  height: 17px;
}

.hud-glasses:hover,
.hud-glasses:focus-visible,
.hud-glasses[aria-pressed="true"] {
  color: var(--sv-black);
  background: var(--sv-white);
  border-color: var(--sv-white);
}

.hud-depth-scene {
  position: relative;
  min-width: 0;
  min-height: 220px;
  overflow: hidden;
  contain: layout paint size;
  background: var(--sv-black);
}

.hud-depth-scene::before,
.hud-depth-scene::after {
  position: absolute;
  z-index: 3;
  width: 22px;
  height: 22px;
  border-color: var(--sv-gray-dark);
  content: "";
  pointer-events: none;
}

.hud-depth-scene::before {
  top: var(--sv-space-3);
  left: var(--sv-space-3);
  border-top: var(--sv-hairline-w) solid;
  border-left: var(--sv-hairline-w) solid;
}

.hud-depth-scene::after {
  right: var(--sv-space-3);
  bottom: var(--sv-space-3);
  border-right: var(--sv-hairline-w) solid;
  border-bottom: var(--sv-hairline-w) solid;
}

.hud-depth-scene canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hud-depth-poster {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 108px;
  aspect-ratio: 1;
  background: var(--sv-gray-dark);
  clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%);
  transform: translate(-50%, -50%);
}

.hud-depth-poster::after {
  position: absolute;
  inset: 1px;
  background: var(--sv-black);
  clip-path: inherit;
  content: "";
}

.hud-depth-scene.is-webgl .hud-depth-poster {
  display: none;
}

.hud-depth-scene .hud-core {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 84px;
  height: 84px;
  min-width: 84px;
  min-height: 84px;
  margin: 0;
  background: rgb(0 0 0 / 0.7);
  transform: translate(-50%, -50%);
}

.hud-depth-label {
  position: absolute;
  z-index: 3;
  right: var(--sv-space-3);
  bottom: var(--sv-space-3);
  color: var(--sv-gray-light);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: var(--sv-tracking-caps);
  text-transform: uppercase;
}

.hud-dialog.is-glasses,
.hud-dialog.is-glasses:fullscreen {
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
}

.hud-dialog.is-glasses .hud-shell {
  grid-template-rows: calc(72px + env(safe-area-inset-top)) auto minmax(0, 1fr);
}

.hud-dialog.is-glasses .hud-head {
  padding: env(safe-area-inset-top) max(4vw, env(safe-area-inset-left)) 0 max(4vw, env(safe-area-inset-right));
}

.hud-dialog.is-glasses .hud-search {
  padding: var(--sv-space-3) max(4vw, env(safe-area-inset-right)) var(--sv-space-3) max(4vw, env(safe-area-inset-left));
}

.hud-dialog.is-glasses .hud-grid {
  grid-template-columns: minmax(17rem, 0.8fr) minmax(30rem, 1.65fr) minmax(18rem, 0.9fr);
}

.hud-dialog.is-glasses .hud-zone {
  background: rgb(0 0 0 / 0.86);
}

.hud-dialog.is-glasses .hud-live-body {
  grid-template-columns: minmax(280px, 1.1fr) minmax(250px, 0.9fr);
}

.hud-dialog.is-glasses .hud-depth-scene {
  min-height: 0;
}

.hud-dialog.is-glasses .hud-zone-head {
  min-height: 52px;
}

.hud-dialog.is-glasses .hud-zone-head h3,
.hud-dialog.is-glasses .hud-zone-head span,
.hud-dialog.is-glasses .hud-recent h4 {
  font-size: var(--sv-text-caption);
}

.hud-dialog.is-glasses .hud-row {
  min-height: 80px;
}

.hud-dialog.is-glasses .hud-row-top strong {
  font-size: 1rem;
}

.hud-dialog.is-glasses .hud-live-list .hud-row-top {
  display: block;
}

.hud-dialog.is-glasses .hud-live-list .hud-row-meta {
  display: block;
  margin-top: 2px;
}

.hud-dialog.is-glasses .hud-row-context,
.hud-dialog.is-glasses .hud-row-detail {
  color: var(--sv-gray-light);
  font-size: 0.875rem;
}

.hud-dialog.is-glasses .hud-core {
  width: 104px;
  height: 104px;
  min-width: 104px;
  min-height: 104px;
}

@media (max-width: 1100px) {
  .hud-dialog.is-glasses .hud-grid {
    grid-template-columns: minmax(15rem, 0.8fr) minmax(24rem, 1.2fr);
    overflow-y: auto;
  }

  .hud-grid {
    grid-template-columns: minmax(15rem, 0.8fr) minmax(22rem, 1.2fr);
    overflow-y: auto;
  }

  .hud-zone {
    min-height: 22rem;
  }

  .hud-live {
    border-right: 0;
  }

  .hud-recent {
    grid-column: 1 / -1;
    min-height: 18rem;
    border-top: var(--sv-hairline-w) solid var(--sv-gray-xdark);
  }
}

@media (max-width: 700px) {
  .hud-dialog {
    width: 100%;
    height: 100dvh;
    border: 0;
  }

  .hud-shell {
    grid-template-rows: calc(64px + env(safe-area-inset-top)) auto minmax(0, 1fr);
  }

  .hud-head {
    padding: env(safe-area-inset-top) var(--sv-space-3) 0;
  }

  .hud-identity p {
    display: none;
  }

  .hud-search {
    padding: var(--sv-space-3);
  }

  .hud-search-results {
    top: calc(100% - var(--sv-space-3));
    right: var(--sv-space-3);
    left: var(--sv-space-3);
  }

  .hud-grid {
    display: block;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
  }

  .hud-zone,
  .hud-recent {
    min-height: 0;
    border-right: 0;
    border-bottom: var(--sv-hairline-w) solid var(--sv-gray-xdark);
  }

  .hud-dialog:not(.is-glasses) .hud-live.is-empty .hud-live-body {
    display: none;
  }

  .hud-live-body {
    grid-template-columns: 116px minmax(0, 1fr);
  }

  .hud-core {
    width: 92px;
    height: 92px;
    min-width: 92px;
    min-height: 92px;
    margin: var(--sv-space-4) auto;
  }

  .hud-row {
    min-height: 64px;
  }

  .hud-dialog.is-glasses .hud-live-body {
    display: block;
  }

  .hud-dialog.is-glasses .hud-depth-scene {
    min-height: 260px;
    border-bottom: var(--sv-hairline-w) solid var(--sv-gray-xdark);
  }

  .hud-dialog.is-glasses .hud-live-list {
    border-left: 0;
  }
}

@media (max-width: 560px) {
  .hud-identity h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hud-head-actions {
    gap: var(--sv-space-2);
  }

  .hud-search-field kbd,
  .hud-glasses span,
  .hud-tracking {
    display: none;
  }

  .hud-glasses {
    min-width: 44px;
    width: 44px;
    padding: 0;
  }

  .hud-live-body {
    display: block;
  }

  .hud-core {
    margin: var(--sv-space-4) auto;
  }

  .hud-live-list {
    border-top: var(--sv-hairline-w) solid var(--sv-gray-xdark);
    border-left: 0;
  }
}

@media (max-width: 380px) {
  .hud-sync span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud-core::before,
  .hud-sync.is-live i {
    animation: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .hud-dialog::backdrop,
  .hud-head,
  .hud-search,
  .hud-zone {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .hud-head,
  .hud-search,
  .hud-zone {
    background: var(--sv-black);
  }
}

@media (forced-colors: active) {
  .hud-dialog,
  .hud-row,
  .hud-zone,
  .hud-search-field,
  .hud-core {
    border-color: CanvasText;
  }

  .hud-row:hover,
  .hud-row:focus-visible,
  .hud-row.is-active {
    color: Canvas;
    background: CanvasText;
  }

  .hud-core.is-live,
  .hud-sync.is-live i {
    color: Highlight;
    border-color: Highlight;
    background: Highlight;
  }
}

/* ---------- ShareOS Home ---------- */

.shareos-home {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow-x: hidden;
}

.shareos-home-hero {
  position: relative;
  width: min(100%, 64rem);
  margin: 0 auto var(--sv-space-12);
}

/* Heading and live field share one row, so the field can never land on top of
 * the prompt at any width. */
.shareos-home-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(34%, 20rem);
  gap: var(--sv-space-6);
  align-items: center;
}

.shareos-home-head .shareos-home-heading {
  margin-bottom: 0;
}

/* The live agent field: decoration, so it is never a click target and a slow
 * first frame cannot delay typing. */
.shareos-home-scene {
  width: 100%;
  height: 11rem;
  min-height: 0; /* the HUD's 220px floor is for a dialog zone, not a page hero */
  background: transparent;
  pointer-events: none;
}

.shareos-home-scene::before,
.shareos-home-scene::after {
  border-color: var(--sv-gray-light);
}

.shareos-home-scene .hud-depth-poster {
  width: 84px;
  background: var(--sv-gray-light);
}

.shareos-home-scene .hud-depth-poster::after {
  background: var(--sv-home-bg);
}

.shareos-home-heading,
.shareos-home-form,
.shareos-home-status {
  position: relative;
  z-index: 1;
}

.shareos-home-heading {
  margin: 0 0 var(--sv-space-8);
  min-width: 0;
  font-size: var(--sv-text-h1);
  font-weight: 400;
  line-height: var(--sv-leading-heading);
  letter-spacing: var(--sv-tracking-heading);
  color: var(--sv-black);
}

.shareos-home-form {
  display: flex;
  flex-direction: column;
  gap: var(--sv-space-3);
  padding: var(--sv-space-4);
  background: var(--sv-surface-raised);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
}

.shareos-home-textarea {
  width: 100%;
  min-height: 3.5rem;
  resize: vertical;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--sv-text-body);
  line-height: var(--sv-leading-body);
  color: var(--sv-ink);
}

.shareos-home-textarea::placeholder {
  color: var(--sv-ink-tertiary);
}

.shareos-home-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.shareos-home-send {
  padding: var(--sv-space-2) var(--sv-space-6);
  min-height: 2.25rem;
  background: var(--sv-black);
  color: var(--sv-white);
  font-size: var(--sv-text-small);
  font-weight: 500;
  transition:
    background var(--sv-dur-fast) var(--sv-ease-out),
    color var(--sv-dur-fast) var(--sv-ease-out);
}

.shareos-home-send:hover:not(:disabled) {
  background: var(--sv-gray-xdark);
}

.shareos-home-send:disabled {
  background: var(--sv-gray-light);
  color: var(--sv-gray-mid);
  cursor: default;
}

.shareos-home-status {
  margin-top: var(--sv-space-4);
  padding: var(--sv-space-4) var(--sv-space-5);
  background: var(--sv-surface-raised);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  font-size: var(--sv-text-small);
  color: var(--sv-ink-secondary);
}

.shareos-home-decision-msg {
  margin: 0 0 var(--sv-space-4);
  font-size: var(--sv-text-small);
  font-weight: 500;
  color: var(--sv-ink);
}

.shareos-home-decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sv-space-2);
}

.shareos-home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sv-hairline-w);
  width: min(100%, 64rem);
  margin: 0 auto;
  background: var(--sv-hairline);
  border: var(--sv-hairline-w) solid var(--sv-hairline);
  flex: 1;
}

.shareos-home-zone {
  display: flex;
  flex-direction: column;
  padding: var(--sv-space-5) var(--sv-space-5) var(--sv-space-6);
  background: var(--sv-surface);
  min-width: 0;
  overflow-y: auto;
}

.shareos-home-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sv-space-3);
}

.shareos-home-zone-head h2 {
  margin: 0;
  font-size: var(--sv-text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--sv-tracking-caps);
  color: var(--sv-ink-tertiary);
}

.shareos-home-zone-count {
  color: var(--sv-ink-tertiary);
  font-size: var(--sv-text-caption);
  font-variant-numeric: tabular-nums;
}

.shareos-home-subhead {
  margin: var(--sv-space-6) 0 var(--sv-space-2);
  font-size: var(--sv-text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--sv-tracking-caps);
  color: var(--sv-ink-tertiary);
}

/* Rows on the light home surface */
.shareos-home .hud-row {
  color: var(--sv-black);
  border-bottom-color: var(--sv-hairline);
}

.shareos-home .hud-row:hover,
.shareos-home .hud-row:focus-visible {
  color: var(--sv-white);
  background: var(--sv-black);
}

.shareos-home .hud-row-icon {
  color: var(--sv-gray-dark);
  border-color: var(--sv-gray-light);
}

.shareos-home .hud-row:hover .hud-row-icon,
.shareos-home .hud-row:focus-visible .hud-row-icon {
  color: var(--sv-white);
  border-color: var(--sv-white);
}

.shareos-home .hud-row-meta,
.shareos-home .hud-row-context,
.shareos-home .hud-row-detail {
  color: var(--sv-ink-secondary);
}

.shareos-home .hud-row:hover .hud-row-meta,
.shareos-home .hud-row:hover .hud-row-context,
.shareos-home .hud-row:hover .hud-row-detail,
.shareos-home .hud-row:focus-visible .hud-row-meta,
.shareos-home .hud-row:focus-visible .hud-row-context,
.shareos-home .hud-row:focus-visible .hud-row-detail {
  color: var(--sv-gray-light);
}

.shareos-home .hud-empty {
  color: var(--sv-ink-tertiary);
}

@media (max-width: 1180px) {
  .shareos-home-head {
    grid-template-columns: minmax(0, 1fr) min(40%, 15rem);
    gap: var(--sv-space-4);
  }

  .shareos-home-scene {
    height: 9rem;
    min-height: 0;
  }

  .shareos-home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shareos-home-zone:last-child {
    grid-column: 1 / -1;
  }
}

/* Phone: single column, 44 px touch targets */
@media (max-width: 640px) {
  /* A phone has no room for a side-by-side field; it becomes a short band above
   * the heading. */
  .shareos-home-head {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sv-space-4);
  }

  .shareos-home-head .shareos-home-scene {
    order: -1;
    height: 6.5rem;
    min-height: 0;
  }

  .shareos-home-grid {
    grid-template-columns: 1fr;
  }

  .shareos-home-zone:last-child {
    grid-column: auto;
  }

  .shareos-home-send {
    min-height: 44px;
    width: 100%;
  }

  .shareos-home-bar {
    justify-content: stretch;
  }

  .shareos-home-decision-actions .dialog-button {
    min-height: 44px;
  }

  .shareos-home .hud-row {
    min-height: 44px;
  }
}

@media (forced-colors: active) {
  .shareos-home-form,
  .shareos-home-status {
    border-color: CanvasText;
  }

  .shareos-home-send {
    border: 1px solid ButtonText;
  }
}
