/* The pill is placed by script in viewport coordinates, which are physical, so it anchors at the top left and moves by translate. */
.selection-actions {
  position: fixed; left: 0; top: 0; z-index: var(--z-menu);
  display: flex; gap: var(--space-1); padding: var(--space-1);
  max-inline-size: calc(100vw - 2 * var(--space-3));
  border-radius: var(--radius-full);
  transform-origin: 50% 100%;
  transition: opacity var(--motion-base) var(--ease-out), scale var(--motion-base) var(--ease-out);
}
.selection-actions[hidden] { display: none; }
@starting-style { .selection-actions { opacity: 0; scale: .94; } }
.selection-actions button {
  min-block-size: 32px; padding-inline: var(--space-3); border: 0; border-radius: var(--radius-full);
  background: transparent; color: var(--color-ink); cursor: pointer; white-space: nowrap;
  font: inherit; font-size: var(--text-subhead); font-weight: var(--weight-medium);
  transition: background-color var(--motion-fast) var(--ease-out), transform 80ms var(--ease-out);
}
.selection-actions button:active { transform: scale(.96); }

/* The list opens upward from the composer and redraws on every keystroke, so it does not animate. */
.template-menu {
  position: absolute; inset-inline: 0; inset-block-end: calc(100% + var(--space-2)); z-index: var(--z-menu);
  max-block-size: 280px; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-1); border-radius: var(--radius-lg);
}
.template-menu[hidden] { display: none; }
.template-row {
  display: grid; gap: var(--space-1); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); cursor: pointer; line-height: var(--leading-tight);
}
.template-title { font-size: var(--text-subhead); font-weight: var(--weight-medium); color: var(--color-ink); }
.template-hint { font-size: var(--text-caption); color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (hover: hover) and (pointer: fine) {
  .selection-actions button:hover { background: var(--color-fill); }
  .template-row:hover { background: var(--color-fill); }
}
.template-row[aria-selected="true"] { background: var(--color-accent-soft); }

@media (pointer: coarse) {
  .selection-actions button { min-block-size: 44px; min-inline-size: 44px; }
  .template-row { min-block-size: 44px; align-content: center; }
}

/* Quiet follow-ups sharing the latest reply's own row of actions, so they add no height of their own. */
.reply-refine { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-inline-start: auto; }
.reply-refine button {
  position: relative; min-block-size: 32px; padding-inline: var(--space-3); border: 0; border-radius: var(--radius-full);
  background: var(--color-surface); color: var(--color-muted); box-shadow: inset 0 0 0 1px var(--color-separator); cursor: pointer;
  font: inherit; font-size: var(--text-caption); font-weight: var(--weight-medium);
  transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out), transform 80ms var(--ease-out);
}
.reply-refine button:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { .reply-refine button:hover { background: var(--color-accent-soft); color: var(--color-accent); box-shadow: none; } }
@media (pointer: coarse) {
  .reply-refine { gap: var(--space-2); }
  .reply-refine button { min-block-size: 36px; }
  .reply-refine button::after { content: ""; position: absolute; inset: -4px 0; }
}
