.toast-region {
  position: fixed;
  top: 84px;
  right: 20px;
  z-index: 3000;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  --toast-accent: #2563eb;
  --toast-soft: #eff6ff;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 30px;
  align-items: start;
  gap: 10px;
  padding: 13px 12px;
  overflow: hidden;
  color: #162033;
  background: #fff;
  border: 1px solid #dfe5ef;
  border-left: 4px solid var(--toast-accent);
  border-radius: 14px;
  box-shadow: 0 16px 42px rgba(22, 32, 51, .18);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: auto;
}

.toast.is-visible { opacity: 1; transform: translateX(0); }
.toast.is-leaving { opacity: 0; transform: translateX(18px); }
.toast-success { --toast-accent: #059669; --toast-soft: #e8f8f1; }
.toast-warning { --toast-accent: #d97706; --toast-soft: #fff5dc; }
.toast-info { --toast-accent: #2563eb; --toast-soft: #eaf2ff; }
.toast-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--toast-accent);
  background: var(--toast-soft);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 900;
}
.toast-copy { min-width: 0; padding-top: 1px; }
.toast-copy strong { display: block; margin-bottom: 2px; font-size: 14px; }
.toast-copy p { margin: 0; color: #566176; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.toast-close {
  width: 30px;
  height: 30px;
  padding: 0;
  color: #7b8494;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.toast-close:hover { color: #162033; background: #f1f4f8; }

/* Các trạng thái hệ thống dùng màu cảnh báo nhẹ, không hiển thị như lỗi code. */
.alert.danger, .mini-error {
  color: #855400 !important;
  background: #fff7e2 !important;
  border-color: #f3d99b !important;
}
.pill.bad, .status-icon.danger, .status-icon.warning {
  color: #855400 !important;
  background: #fff1cc !important;
}

@media (max-width: 620px) {
  .toast-region { top: 12px; right: 14px; left: 14px; width: auto; }
  .toast { grid-template-columns: 34px minmax(0, 1fr) 28px; padding: 11px 10px; border-radius: 12px; }
  .toast-icon { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
