.notification-toasts {
  position: fixed;
  z-index: 1600;
  right: 18px;
  bottom: 18px;
  display: flex;
  width: 360px;
  max-width: calc(100vw - 36px);
  flex-direction: column;
  pointer-events: none;
}
.notification-toasts[hidden] { display: none; }

.notification-toast {
  --notification-tone: var(--ui-border);
  --ui-panel-bg: var(--ui-surface-dark);
  --ui-panel-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
  display: flex;
  min-width: 0;
  margin-top: 8px;
  align-items: flex-start;
  border-left: 3px solid var(--notification-tone);
  color: var(--ui-text);
  pointer-events: auto;
  animation: notification-enter 160ms ease-out;
}

.notification-toast.is-leaving {
  min-height: 0;
  overflow: hidden;
  border-top-width: 0;
  border-bottom-width: 0;
  box-shadow:
    var(--ui-panel-shadow),
    inset 0 1px 0 var(--ui-panel-border, var(--ui-border)),
    inset 0 -1px 0 var(--ui-panel-border, var(--ui-border));
  pointer-events: none;
  animation: notification-exit 220ms ease-in-out forwards;
}

[data-tone="success"] { --notification-tone: #75bd91; }
[data-tone="warning"] { --notification-tone: #d9a157; }
[data-tone="error"] { --notification-tone: #e28e89; }

.notification-toast-open {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: 13px 10px 13px 14px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font: 12px/1.45 var(--ui-font);
  text-align: left;
  cursor: pointer;
}

.notification-toast-open strong { font-size: 13px; font-weight: 750; }
.notification-toast-open > span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  color: var(--ui-text-soft);
}
.notification-toast-open:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -2px; }

.notification-toast-close {
  --ui-icon-size: 26px;
  margin: 7px 7px 0 0;
}
.notification-toast-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.notification-toast.is-pending .notification-toast-open strong::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border: 1px solid var(--ui-border);
  border-top-color: var(--ui-text);
  border-radius: 50%;
  content: "";
  animation: notification-spin 900ms linear infinite;
}

.notification-announcer { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.notification-dialog { width: min(960px, calc(100vw - 48px)); height: min(680px, calc(100vh - 64px)); }
.notification-history-item {
  margin: 0 0 var(--ui-control-gap);
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  overflow: hidden;
}
.notification-history-item.is-unread strong { position: relative; padding-right: 12px; }
.notification-history-item.is-unread strong::after { position: absolute; top: 0.5em; right: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--ui-accent); content: ""; }
.notification-history-item > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.notification-item-meta { color: var(--notification-tone, var(--ui-text-muted)); font-size: 10px; }
.notification-detail { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; flex-direction: column; }
.notification-detail[hidden] { display: none; }
.notification-detail [hidden] { display: none !important; }
.notification-detail h4 { margin: 0 0 7px; color: var(--ui-text); font: 750 17px/1.3 var(--ui-font); }
.notification-detail-meta { margin: 0 0 17px; color: var(--notification-tone, var(--ui-text-muted)); font: 11px/1.5 var(--ui-font); }
.notification-detail-summary { margin: 0 0 15px; color: var(--ui-text-soft); font: 13px/1.5 var(--ui-font); overflow-wrap: anywhere; }
.notification-detail-body { flex: 1; padding: 2px; }
.notification-detail pre { --ui-panel-radius: var(--ui-radius-small); min-height: 0; max-height: 320px; margin: 0; padding: 14px; color: var(--ui-text-soft); font: 12px/1.55 var(--ui-font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.notification-detail-output:not([hidden]) { margin-bottom: 16px; }

.notifications-button { position: relative; display: grid; width: 36px !important; min-width: 36px; height: 36px; padding: 8px; place-items: center; }
.notifications-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.notifications-count { position: absolute; top: -5px; right: -6px; min-width: 17px; padding: 2px 4px; border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface-dark); color: var(--ui-text); font: 700 9px/1.1 var(--ui-font); }
.notifications-count[hidden] { display: none; }
@keyframes notification-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes notification-exit {
  from {
    height: var(--toast-dismiss-height);
    opacity: var(--toast-dismiss-opacity);
    transform: var(--toast-dismiss-transform);
    margin-top: var(--toast-dismiss-gap);
    padding-top: 1px;
    padding-bottom: 1px;
  }
  to {
    height: 0;
    opacity: 0;
    transform: translateX(18px);
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}
@keyframes notification-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .notification-toast, .notification-toast.is-pending .notification-toast-open strong::before { animation: none; } }
