.region {
  position: fixed;
  /* Bottom-right, not top-right: the header's action cluster (Publish/Revert,
     theme/datasets controls) lives top-right, and a toast there lands on top of
     the control the user just used. Bottom-anchored, the stack grows upward and
     the newest toast sits nearest the corner (docs/architecture/10 → Toasts). */
  bottom: var(--space-5);
  right: var(--space-5);
  /* Above the confirm backdrop (z 1000) so a failure stays visible and
     dismissible even with a confirmation open; the corner clears the centered
     dialog. */
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(24rem, calc(100vw - 2 * var(--space-5)));
  /* The region is only a positioner; individual toasts re-enable pointer events. */
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--layer-02);
  /* Design language → Toasts: 1px border in the support colour, square. The
     accent (per-kind) is set by the modifier classes below. */
  border: var(--border-width) solid var(--toast-accent);
  border-left-width: 3px;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.3);
  animation: toast-in var(--dur-moderate) var(--ease);
}

.error {
  --toast-accent: var(--support-error);
}
.warning {
  --toast-accent: var(--support-warning);
}
.success {
  --toast-accent: var(--support-success);
}
.info {
  --toast-accent: var(--support-info);
}

/* Leading status glyph (arch 09 §5.2): coloured by kind, top-aligned with the
   title. The accent IS the icon colour, except warning, whose raw yellow fails
   contrast on the light surface — it uses the darkened fg token. */
.statusIcon {
  flex: none;
  margin-top: 1px;
  color: var(--toast-accent);
}
.warning .statusIcon {
  color: var(--support-warning-fg);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(8px);
  }
}

/* Applied for the exit phase: plays toast-out, then the JS timeout removes the
   toast from the store. Under prefers-reduced-motion, base.css forces
   animation-duration to 0.01ms so the toast vanishes immediately; the matching
   JS timeout (TOAST_EXIT_MS) is set to the same 150ms value — 0.01ms rounds
   to the next rAF in practice, which is imperceptibly fast. */
.exiting {
  animation: toast-out var(--dur-moderate) var(--ease) forwards;
}

.body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.message {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.detail {
  margin-top: var(--space-1);
}

.detailSummary {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.detailText {
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  font-family: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
  background: var(--layer-01);
  border: var(--border-width) solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.detailMeta {
  margin: var(--space-2) 0 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.actions {
  margin-top: var(--space-3);
}

/* Deliberately NOT the Button primitive: the action is coloured by the toast's
   kind (--toast-accent border/label) and sits below the control scale —
   content-sized inside an already-compact toast, like the inline link-style
   actions (arch 09 §4). */
.action {
  padding: var(--space-1) var(--space-3);
  font: inherit;
  font-size: 13px;
  color: var(--toast-accent);
  background: transparent;
  border: var(--border-width) solid var(--toast-accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.action:hover {
  background: var(--layer-01);
}

.action:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Dismiss is the shared IconButton (sm); the class is a layout marker only. */
.close {
  flex: none;
}
