@layer components {
  /* A message's actions in a bottom sheet; nothing of it shows until a long press or a ⋯ opens it. */
  .message-sheet { display: contents; }
  /* The message the sheet acts on: marked in the thread, and set apart at the sheet's top. */
  .message.is-lifted { background: var(--jx-accent-soft); }
  .message-sheet-preview {
    display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; padding: 10px 12px;
    border-radius: var(--radius-lg); background: var(--jx-accent-soft); font-size: var(--text-body);
  }
  /* Focused only as the sheet opens, never by the Tab key: not a control, no focus ring. */
  .message-sheet-preview:focus { outline: none; }
  .message-sheet-author { font-weight: 600; }
  .message-sheet-excerpt {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
    overflow-wrap: anywhere; color: var(--muted-foreground);
  }
  .message-sheet-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; padding: 0 0 12px; }
  .message-sheet-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 68px;
    border: 0; border-radius: var(--radius-lg); background: var(--muted); color: var(--foreground);
    font: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer;
  }
  .message-sheet-rows { display: flex; flex-direction: column; padding: 4px 0; border-top: 1px solid var(--border); }
  .message-sheet-rows:not(:has(> :not([hidden]))) { display: none; }
  .message-sheet-row {
    display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 8px; border: 0;
    border-radius: var(--radius-md); background: none; color: var(--foreground); font: inherit; font-size: 1rem;
    text-align: left; cursor: pointer;
  }
  :is(.message-sheet-tile, .message-sheet-row)[hidden] { display: none; }
  /* The conversation's current level, on the right of its row, before the chevron. */
  .message-sheet-row-value { margin-left: auto; font-size: 0.875rem; color: var(--muted-foreground); }
  :is(.message-sheet-tile, .message-sheet-row):is(:hover, :active) { background: var(--accent); }
  :is(.message-sheet-tile, .message-sheet-row):focus-visible {
    outline: 2px solid var(--jx-accent); outline-offset: -2px;
  }
  :is(.message-sheet-tile, .message-sheet-row) svg { flex: none; color: var(--muted-foreground); }
  .message-sheet-row--danger, .message-sheet-row--danger svg { color: var(--jx-no); }
  /* What copying did, above the composer for a moment; empty, it takes no room but stays a live region. */
  .message-sheet-toast {
    position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); z-index: 20; translate: -50% 0; margin: 0;
    padding: 8px 14px; border-radius: 999px; background: var(--foreground); color: var(--background);
    font-size: 0.875rem; box-shadow: var(--shadow-sm); pointer-events: none;
  }
  .message-sheet-toast:empty { padding: 0; box-shadow: none; }
}
