:root {
  --ink-900: #0f1115;
  --ink-800: #11141a;
  --ink-700: #171a21;
  --ink-600: #1c212b;
  --steel-700: #2a2f3a;
  --steel-600: #303745;
  --steel-500: #3c4557;
  --steel-400: #8c96aa;
  --steel-300: #aeb6c6;
  --steel-200: #b9c0cf;
  --steel-100: #d8deea;
  --cream-50: #fffbf3;
  --cream-100: #f7f3ea;
  --cream-200: #e8e1cf;
  --brass-500: #f4c95d;
  --brass-400: #ffd877;
  --brass-ink: #17130a;
  --sage-900: #172419;
  --sage-700: #315f3a;
  --sage-300: #8fe39e;
  --amber-900: #25230f;
  --amber-700: #5d4d1b;
  --rust-500: #f06464;
  --bg: var(--ink-900);
  --bg-panel: var(--ink-800);
  --bg-bar: var(--ink-700);
  --bg-elevated: var(--ink-600);
  --fg: var(--cream-100);
  --fg-muted: var(--steel-100);
  --fg-dim: var(--steel-200);
  --fg-faint: var(--steel-300);
  --fg-label: var(--steel-400);
  --border: var(--steel-600);
  --border-subtle: var(--steel-700);
  --border-strong: var(--steel-500);
  --accent: var(--brass-500);
  --accent-hover: var(--brass-400);
  --accent-ink: var(--brass-ink);
  --danger: var(--rust-500);
  --font-serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --font-sans: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 12px;
  --lh-xs: 1.35;
  --text-sm: 13px;
  --lh-sm: 1.4;
  --text-base: 14px;
  --lh-base: 1.45;
  --text-md: 16px;
  --lh-md: 1.5;
  --text-lg: 18px;
  --lh-lg: 1.45;
  --text-xl: 22px;
  --lh-xl: 1.3;
  --text-2xl: 28px;
  --lh-2xl: 1.25;
  --text-3xl: 36px;
  --lh-3xl: 1.18;
  --text-4xl: 48px;
  --lh-4xl: 1.1;
  --text-5xl: 64px;
  --lh-5xl: 1.05;
  --text-display: 92px;
  --lh-display: 1;
  --w-regular: 400;
  --w-medium: 500;
  --w-semi: 600;
  --w-bold: 700;
  --w-brand: 750;
  --track-tight: -0.01em;
  --track-normal: 0;
  --track-brand: 0.02em;
  --track-label: 0.08em;
  --track-caps: 0.12em;
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 10px;
  --space-6: 12px;
  --space-8: 16px;
  --space-10: 20px;
  --space-12: 24px;
  --space-16: 32px;
  --space-20: 40px;
  --space-24: 48px;
  --space-32: 64px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-pill: 999px;
  --hairline: 1px solid var(--border);
  --hairline-subtle: 1px solid var(--border-subtle);
  --shadow-tooltip: 0 16px 44px rgba(0, 0, 0, 0.35);
  --shadow-floating: 0 20px 70px rgba(0, 0, 0, 0.35);
  --bar-h: 56px;
  --bar-pad: var(--space-8);
  --panel-w: 360px;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 320ms;
  --annotate-outline: 2px solid var(--accent);
  --annotate-offset: 2px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.lavish {
  color-scheme: dark;
}
:focus-visible {
  outline: var(--annotate-outline);
  outline-offset: var(--annotate-offset);
}
.bar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 var(--bar-pad);
  background: var(--bg-bar);
  border-bottom: var(--hairline-subtle);
  box-sizing: border-box;
}
.brand {
  display: flex;
  align-items: flex-end;
  height: 22px;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-mark {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1;
  color: var(--fg);
}
.brand-support {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  position: relative;
  top: 1px;
}
.spacer {
  flex: 1;
}
.annotate-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-muted);
  font-family: inherit;
  font-size: var(--text-sm);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  background: none;
  border: 0;
  padding: 0;
  flex-shrink: 0;
}
.annotate-switch:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.switch-track {
  width: 34px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 150ms var(--ease);
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: var(--fg-faint);
  transition:
    left 150ms var(--ease),
    background 150ms var(--ease);
}
.annotate-switch[aria-pressed="true"] .switch-track {
  background: var(--accent);
}
.annotate-switch[aria-pressed="true"] .switch-knob {
  left: 16px;
  background: var(--accent-ink);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Passive layout-warning inbox. The button only exists while there is unresolved work, so it
   must never reserve bar space when the count is zero. */
.warnings-wrap {
  position: relative;
  flex-shrink: 0;
}
.warnings-wrap[hidden] {
  display: none;
}
.warnings-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(244, 201, 93, 0.35);
  border-radius: 9px;
  background: rgba(37, 35, 15, 0.72);
  color: var(--brass-400);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--w-bold);
  cursor: pointer;
  white-space: nowrap;
}
.warnings-button:hover:not(:disabled),
.warnings-button[aria-expanded="true"] {
  border-color: rgba(244, 201, 93, 0.6);
  background: rgba(93, 77, 27, 0.5);
  color: var(--accent-hover);
}
.warnings-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.warnings-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: var(--w-bold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.warnings-drawer {
  right: 0;
  top: 42px;
  width: min(400px, calc(100vw - 24px));
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 560px);
}
.warnings-head {
  padding: 12px var(--space-8) 8px;
}
.warnings-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: var(--w-regular);
  color: var(--fg);
}
.warnings-summary {
  margin: 4px 0 0;
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--fg-faint);
}
.warnings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: 0 var(--space-8) 8px;
  border-bottom: var(--hairline-subtle);
}
.warnings-selectall {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-xs);
  color: var(--fg-muted);
  cursor: pointer;
  user-select: none;
}
.warnings-selectall input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.warnings-selected {
  font-size: var(--text-xs);
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.warnings-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.warnings-empty {
  padding: 14px 10px;
  font-size: var(--text-xs);
  line-height: var(--lh-sm);
  color: var(--fg-faint);
}
.warning-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.warning-row:hover,
.warning-row:focus-within {
  border-color: var(--border-strong);
}
.warning-row.is-outstanding {
  background: var(--ink-700);
}
.warning-select {
  width: 14px;
  height: 14px;
  margin: 3px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.warning-select:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.warning-body {
  min-width: 0;
}
.warning-title {
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: var(--w-bold);
  color: var(--fg);
  overflow-wrap: anywhere;
}
.warning-explanation {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  line-height: var(--lh-sm);
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}
.warning-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.warning-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--ink-800);
  color: var(--fg-faint);
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}
.warning-chip.severity {
  border-color: rgba(240, 100, 100, 0.4);
  color: var(--danger);
}
.warning-chip.status-queued,
.warning-chip.status-unverified {
  border-color: rgba(244, 201, 93, 0.4);
  color: var(--accent);
}
.warning-chip.status-recurring,
.warning-chip.status-reopened {
  border-color: rgba(240, 100, 100, 0.4);
  color: var(--danger);
}
.warning-target {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.45;
  color: var(--fg-label);
  overflow-wrap: anywhere;
}
.warning-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.warning-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-faint);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.warning-action:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--fg);
}
.warning-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.warnings-foot {
  border-top: var(--hairline-subtle);
  /* The list scrolls under this footer, so lift it with a soft shadow - otherwise a row clipped
     mid-content at the boundary reads as broken rather than scrollable. */
  box-shadow: 0 -10px 14px -10px rgba(0, 0, 0, 0.55);
  padding: 10px var(--space-8) 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.warnings-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--fg-label);
}
.warnings-foot .button {
  width: 100%;
  justify-content: center;
}
.more-wrap {
  position: relative;
  flex-shrink: 0;
}
.more-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--fg-dim);
  border-radius: 9px;
  cursor: pointer;
  padding: 0;
}
.more-button:hover:not(:disabled),
.more-button[aria-expanded="true"] {
  border-color: var(--border-strong);
  background: var(--steel-700);
  color: var(--fg);
}
.more-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.menu {
  position: absolute;
  background: var(--bg-bar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-tooltip);
  padding: 6px;
  z-index: 70;
}
.menu[hidden] {
  display: none;
}
.more-menu {
  right: 0;
  top: 42px;
  width: min(300px, calc(100vw - 24px));
}
.menu-head {
  padding: 7px 10px 9px;
}
.menu-label {
  font-size: 9px;
  font-weight: var(--w-bold);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 5px;
}
.menu-file {
  display: flex;
  align-items: center;
  gap: 7px;
  width: calc(100% + 8px);
  text-align: left;
  border: 0;
  background: transparent;
  padding: 3px 4px;
  margin: 0 -4px;
  border-radius: 7px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}
.menu-file:hover {
  background: var(--steel-700);
}
.menu-file > svg {
  opacity: 0.7;
  flex-shrink: 0;
}
.menu-file-text {
  display: flex;
  flex: 1;
  min-width: 0;
}
.path-head {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}
.path-tail {
  flex: 0 0 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-hint {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: var(--w-semi);
  color: var(--fg-faint);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.copy-hint .icon-copy,
.copy-hint .icon-check {
  display: flex;
}
.copy-hint .icon-check {
  display: none;
}
.copy-hint.copied {
  color: var(--accent-hover);
}
.copy-hint.copied .icon-copy {
  display: none;
}
.copy-hint.copied .icon-check {
  display: flex;
}
.menu-rule {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-sm);
  border: 0;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
}
.menu-item:hover:not(:disabled) {
  background: var(--steel-700);
}
.menu-item:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.menu-item > svg {
  opacity: 0.8;
  flex-shrink: 0;
}
.menu-item.danger {
  color: var(--danger);
}
.menu-item.danger > svg {
  opacity: 1;
}
.menu-item.danger:hover:not(:disabled) {
  background: rgba(240, 100, 100, 0.1);
}
.button {
  border: 0;
  border-radius: var(--radius-md);
  padding: 9px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--w-bold);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 120ms ease-out,
    color 120ms ease-out,
    opacity 120ms ease-out,
    border-color 120ms ease-out;
}
.button:hover:not(:disabled) {
  background: var(--accent-hover);
}
.button:active:not(:disabled) {
  opacity: 0.85;
}
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.button-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--danger);
}
.button-danger:hover:not(:disabled) {
  background: rgba(240, 100, 100, 0.1);
}
.button-danger > svg {
  flex-shrink: 0;
}
.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--space-16);
  background: rgba(15, 17, 21, 0.72);
}
.share-overlay[hidden] {
  display: none;
}
.share-card {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--bg-panel);
  color: var(--fg);
  box-shadow: var(--shadow-floating);
  padding: var(--space-12);
}
.share-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.share-kicker {
  color: var(--fg-label);
  font-size: var(--text-xs);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.share-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}
.share-link:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}
.share-head h2 {
  margin: var(--space-2) 0 0;
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-style: italic;
  font-weight: var(--w-regular);
  line-height: var(--lh-2xl);
}
.share-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.share-close svg {
  display: block;
}
.share-close:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}
.share-copy,
.share-note {
  margin: 0 0 var(--space-8);
  color: var(--fg-muted);
}
.share-note {
  color: var(--fg-faint);
  font-size: var(--text-sm);
}
.share-grid {
  display: grid;
  gap: var(--space-8);
  margin-top: var(--space-10);
}
.share-grid label,
.share-result label {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.share-grid input,
.share-result input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--w-regular);
  letter-spacing: 0;
  padding: 10px;
  text-transform: none;
}
.share-grid input::placeholder {
  color: var(--fg-label);
}
.share-grid .share-check {
  grid-template-columns: auto 1fr;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--space-6);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: var(--w-regular);
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.share-grid .share-check input {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
}
.share-status {
  min-height: 20px;
  margin-top: var(--space-8);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}
.share-status.error {
  color: var(--danger);
}
.share-result {
  display: grid;
  gap: var(--space-8);
  margin-top: var(--space-8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  padding: var(--space-8);
}
.share-result[hidden] {
  display: none;
}
.share-result label[hidden] {
  display: none;
}
.share-copy-row {
  display: flex;
  gap: var(--space-6);
  min-width: 0;
}
.share-copy-row input {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.share-copy-btn {
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--w-bold);
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
}
.share-copy-btn:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}
.share-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-12);
}
.share-cancel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-muted);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--w-bold);
  padding: 9px 14px;
  cursor: pointer;
}
.share-cancel:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}
.layout {
  height: calc(100vh - var(--bar-h));
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
}
.frame {
  min-width: 0;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}
.panel {
  width: var(--panel-w);
  border-left: var(--hairline-subtle);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
/* Desktop keeps the panel's original flex children: the head wrappers exist only so the phone
   layout can turn the heading into a dock, and they are transparent to layout everywhere else. */
.panel-head,
.panel-head-row {
  display: contents;
}
.panel-handle,
.panel-summary,
.panel-toggle,
.panel-scrim {
  display: none;
}
.panel h2 {
  font-size: 15px;
  line-height: 1.3;
  margin: 16px 16px 8px;
  font-weight: var(--w-semi);
  letter-spacing: 0;
  flex: 0 0 auto;
}
.panel-scroll {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.chat {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat:empty::before {
  content: "Agent hasn't sent a message yet. Click an element in the artifact to annotate, or type below to start.";
  margin-top: 2px;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.45;
}
.bubble {
  max-width: 85%;
  border-radius: var(--radius-xl);
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: var(--hairline);
  color: var(--fg);
}
.bubble.user {
  align-self: flex-end;
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}
.bubble.agent {
  align-self: flex-start;
  background: transparent;
  border-color: var(--border-subtle);
}
.bubble.note {
  align-self: stretch;
  max-width: 100%;
  background: transparent;
  border-color: var(--border-strong);
  border-style: dashed;
}
.bubble.note .note-draft {
  margin-top: 6px;
  white-space: pre-wrap;
  user-select: text;
}
.bubble.note .note-warning {
  margin-top: 6px;
  color: var(--danger);
}
.bubble.agent-working {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-muted);
}
.spinner {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}
.bubble small {
  display: block;
  color: var(--fg-faint);
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: var(--w-bold);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.bubble.user small {
  text-align: right;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.composer {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  border-top: var(--hairline-subtle);
  background: var(--bg-panel);
  min-width: 0;
  flex-shrink: 0;
  box-sizing: border-box;
  position: sticky;
  bottom: 0;
  z-index: 4;
}
.presence-banner {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: var(--w-medium);
  line-height: 1.4;
  padding: 8px 10px;
}
.presence-banner[hidden] {
  display: none;
}
.handoff-banner {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.handoff-takeover {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: var(--w-semibold);
  padding: 0;
  white-space: nowrap;
}
.handoff-takeover:hover {
  color: var(--fg);
}
.outdated-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}
.annotation-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  padding: 0 16px 12px;
  flex: 0 0 auto;
}
.annotation-pills:empty {
  display: none;
}
.pill-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(320px, 100%);
  max-width: 100%;
}
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--fg-muted);
  padding: 5px 7px 5px 11px;
  font-size: 12px;
  font-weight: var(--w-bold);
}
.pill-preview {
  display: block;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pill-attachments {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.pill-attachment {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--border);
  border: 1px solid var(--border-strong);
}
.pill-attachment-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--border);
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.pill-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0;
  background: var(--border);
  color: var(--fg-muted);
  cursor: pointer;
}
.pill-close svg {
  display: block;
}
.pill-tooltip {
  display: none;
  position: static;
  z-index: 5;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-bar);
  color: var(--fg-muted);
  padding: 10px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-tooltip);
}
.tooltip-label {
  color: var(--fg-label);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  margin: 0 0 4px;
}
.pill-tooltip-target {
  font-family: var(--font-mono);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.pill-tooltip-prompt {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pill-wrap:hover .pill-tooltip,
.pill-wrap:focus-within .pill-tooltip {
  display: block;
}
.composer textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 82px;
  resize: vertical;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 10px;
  font: inherit;
  font-family: var(--font-sans);
  box-sizing: border-box;
}
.composer textarea::placeholder {
  color: var(--fg-label);
}
.composer.is-dropping {
  background: var(--bg-elevated);
}
.chat-attachments {
  display: grid;
  gap: 6px;
  /* W3 backstop, like the annotation card's chip list: unbounded chips must
     scroll here, never push Send/Send & End or their own Remove off-frame. */
  max-height: 176px;
  overflow-y: auto;
}
.chat-attachments:empty {
  display: none;
}
.chat-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 6px;
  font-size: 11px;
}
.chat-attachment-thumb {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 5px;
  object-fit: cover;
}
.chat-attachment-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}
.chat-attachment-copy strong,
.chat-attachment-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-attachment-status {
  color: var(--fg-faint);
}
.chat-attachment-error,
.chat-attachment-error .chat-attachment-status {
  color: var(--danger);
}
.chat-attachment-chip button,
.chat-attach {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 2px 4px;
}
.chat-attachment-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.chat-attachment-notice {
  min-width: 0;
  color: var(--fg-faint);
  font-size: 11px;
  line-height: 1.35;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
  position: relative;
}
.send-hint {
  color: var(--fg-faint);
  font-size: 11px;
  line-height: 1.35;
}
.send-hint[hidden] {
  display: none;
}
@media (max-width: 320px) {
  .composer {
    padding-left: 12px;
    padding-right: 12px;
  }
}
.ended-overlay {
  position: fixed;
  inset: var(--bar-h) 0 0 0;
  background: rgba(15, 17, 21, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.ended-overlay[hidden] {
  display: none;
}
.ended-card {
  width: min(360px, calc(100vw - 48px));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-panel);
  padding: 20px 24px;
  text-align: center;
}
.ended-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1.3;
  color: var(--fg);
  margin-bottom: 8px;
}
.ended-copy {
  margin: 0;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.ended-action {
  margin-top: var(--space-8);
}
.layout-gate-bypass {
  margin-left: var(--space-4);
}
iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
  opacity: 1;
  transition: opacity var(--dur-fast) var(--ease);
}
body.layout-gate-active iframe#artifact {
  opacity: 0;
}
/* Narrow chrome: the drawer stops hanging off the button and spans the viewport instead, so the
   list never overflows horizontally on a phone-width window. */
@media (max-width: 640px) {
  .bar {
    gap: 10px;
    --bar-pad: var(--space-6);
  }
  .brand-support {
    display: none;
  }
  .warnings-drawer {
    position: fixed;
    top: calc(var(--bar-h) + 6px);
    right: 10px;
    left: 10px;
    width: auto;
    max-height: min(70vh, 460px);
  }
}
/* Phone-width chrome: the artifact takes the whole viewport above a persistent conversation dock,
   and the conversation itself is a bottom sheet the dock raises over a scrim. A side-by-side or
   stacked split leaves neither half usable on a phone - the composer alone is taller than the
   strip a split gives the panel - so the two surfaces take turns owning the height instead.
   The sheet is sized from the visual viewport (`--vv-top`/`--vv-height`, kept current by
   chrome-client.js) rather than the layout viewport, so an on-screen keyboard shrinks it instead
   of covering the composer, and every edge that can meet a notch or home indicator pads by the
   matching safe-area inset. */
@media (max-width: 860px) {
  :root {
    --bar-h: calc(56px + env(safe-area-inset-top, 0px));
    --dock-h: 60px;
    --sheet-peek: 16px;
    --composer-reserve: calc(1px + var(--space-4) + 34px + var(--space-6) + env(safe-area-inset-bottom, 0px));
    --sheet-top: max(var(--bar-h) + var(--sheet-peek) - var(--vv-top, 0px), var(--sheet-peek));
  }
  .bar {
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: calc(var(--bar-pad) + env(safe-area-inset-right, 0px));
    padding-left: calc(var(--bar-pad) + env(safe-area-inset-left, 0px));
  }
  .layout {
    height: calc(100vh - var(--bar-h));
    height: calc(100dvh - var(--bar-h));
    grid-template-columns: minmax(0, 1fr);
    /* The second row only reserves the dock's footprint so the artifact is never underneath it;
       the panel itself is fixed. */
    grid-template-rows: minmax(0, 1fr) calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
  }
  .frame {
    padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    background: var(--bg-bar);
  }
  .panel {
    position: fixed;
    z-index: 30;
    top: calc(var(--vv-top, 0px) + var(--sheet-top));
    right: 0;
    left: 0;
    width: auto;
    height: calc(var(--vv-height, 100dvh) - var(--sheet-top));
    padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    border-left: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    /* The hairline is a shadow, not a border: a border would add to the sheet's box and push
       the docked head one pixel past the viewport edge. */
    box-shadow:
      0 -1px 0 var(--border-subtle),
      var(--shadow-floating);
    /* Collapsed: slide everything but the dock below the viewport. The sheet keeps its full
       height, so opening it is one transform and the chat never reflows mid-gesture. */
    transform: translateY(calc(100% - var(--dock-h) - env(safe-area-inset-bottom, 0px)));
    transition: transform var(--dur-slow) var(--ease);
    will-change: transform;
  }
  body.sheet-open .panel {
    transform: none;
  }
  .panel.is-dragging {
    transition: none;
  }
  .panel-head {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    height: var(--dock-h);
    padding: 6px 16px 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
  }
  body:not(.sheet-open) .panel-head {
    height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .panel-handle {
    display: block;
    width: 36px;
    height: 4px;
    margin: 0 auto 6px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
  }
  .panel-head-row {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .panel h2 {
    flex: 0 0 auto;
    margin: 0;
  }
  .panel-summary {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    color: var(--fg-faint);
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .panel-summary:empty {
    display: none;
  }
  .panel-summary.is-accent {
    color: var(--accent);
    font-weight: var(--w-semi);
  }
  .panel-summary.is-unread::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    vertical-align: 1px;
  }
  .panel-toggle {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    color: var(--fg-muted);
    cursor: pointer;
  }
  .panel-toggle svg {
    display: block;
    transition: transform var(--dur) var(--ease);
  }
  body.sheet-open .panel-toggle svg {
    transform: rotate(180deg);
  }
  .panel-head.is-fresh .panel-toggle {
    animation: dock-pulse 700ms var(--ease);
  }
  .panel-scroll {
    flex: 1 1 56px;
    min-height: clamp(
      0px,
      calc(var(--vv-height, 100dvh) - var(--sheet-top) - var(--dock-h) - var(--composer-reserve)),
      56px
    );
    overscroll-behavior: contain;
  }
  .chat {
    padding-bottom: 10px;
  }
  .composer {
    position: static;
    min-height: min(
      var(--composer-reserve),
      max(0px, calc(var(--vv-height, 100dvh) - var(--sheet-top) - var(--dock-h)))
    );
    flex: 0 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .chat-attachments {
    max-height: min(176px, 25dvh);
  }
  .composer .actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding-top: 8px;
    background: var(--bg-panel);
    box-shadow: 0 -1px 0 var(--border-subtle);
  }
  .panel-scrim {
    display: block;
    position: fixed;
    inset: var(--bar-h) 0 0 0;
    z-index: 29;
    background: rgba(15, 17, 21, 0.72);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-slow) var(--ease);
  }
  body.sheet-open .panel-scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .pill-preview {
    max-width: min(220px, 70vw);
  }
  .share-overlay {
    align-items: start;
    padding: var(--space-8);
  }
  .share-copy-row {
    flex-direction: column;
  }
}
/* A phone on its side has no height to share: the raised sheet covers the bar as well (the sheet
   carries its own close control) and the composer gives up its tall default. */
@media (max-width: 860px) and (max-height: 520px) {
  :root {
    --sheet-top: var(--sheet-peek);
  }
  .panel-scrim {
    inset: 0;
  }
  .composer textarea {
    min-height: 48px;
  }
  .chat-attachments {
    max-height: 44px;
  }
}
@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  .panel,
  .panel-scrim,
  .panel-toggle svg {
    transition: none;
  }
  .panel-head.is-fresh .panel-toggle {
    animation: none;
  }
}
@keyframes dock-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 201, 93, 0.55);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(244, 201, 93, 0);
  }
}

/* Whiteboard overlay: a full-viewport layer above the chrome hosting the
   sandboxed Excalidraw frame. The frame owns all whiteboard UI; this layer
   only provides the backdrop, a fallback close control, and an error card
   for when the frame cannot boot. */
.whiteboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.92);
  z-index: 80;
  display: flex;
}
.whiteboard-overlay[hidden] {
  display: none;
}
.whiteboard-shell {
  position: relative;
  flex: 1;
  margin: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-panel);
  display: flex;
}
.whiteboard-shell iframe {
  flex: 1;
  border: 0;
  width: 100%;
  height: 100%;
}
.whiteboard-close {
  position: absolute;
  top: 9px;
  right: 12px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--fg-faint);
  cursor: pointer;
}
.whiteboard-close:hover {
  color: var(--fg);
}
.whiteboard-error {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  color: var(--fg);
  background: var(--bg-panel);
  font-size: 14px;
  line-height: 1.5;
}
.whiteboard-error[hidden] {
  display: none;
}
