:root {
  --notice-text: #162033;
  --notice-copy: #526079;
  --notice-muted: #7c879c;
  --notice-border: #dfe5ee;
  --notice-surface: #ffffff;
  --notice-blue: #1769e8;
  --notice-blue-soft: #eaf2ff;
  --notice-green: #159455;
  --notice-green-soft: #e9f8f0;
  --notice-amber: #d27b09;
  --notice-amber-soft: #fff6e8;
  --notice-red: #d92d20;
  --notice-red-soft: #fef0ee;
  --notice-shadow: 0 18px 44px rgba(16, 24, 40, 0.12);
}

.upkeep-notice-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 12000;
  width: min(420px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.upkeep-alert-toast {
  --notice-accent: var(--notice-blue);
  --notice-soft: var(--notice-blue-soft);
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 32px;
  align-items: start;
  gap: 11px;
  width: 100%;
  padding: 13px 12px 13px 15px;
  overflow: hidden;
  color: var(--notice-text);
  background: var(--notice-surface);
  border: 1px solid var(--notice-border);
  border-radius: 12px;
  box-shadow: var(--notice-shadow);
  animation: upkeep-notice-in 180ms cubic-bezier(.2, .8, .2, 1) both;
}

.upkeep-alert-toast::before,
body .notification-toast::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--notice-accent, var(--notification-accent));
}

.upkeep-alert-toast[data-type="success"] {
  --notice-accent: var(--notice-green);
  --notice-soft: var(--notice-green-soft);
}

.upkeep-alert-toast[data-type="warning"] {
  --notice-accent: var(--notice-amber);
  --notice-soft: var(--notice-amber-soft);
}

.upkeep-alert-toast[data-type="danger"],
.upkeep-alert-toast[data-type="error"] {
  --notice-accent: var(--notice-red);
  --notice-soft: var(--notice-red-soft);
}

.upkeep-alert-toast.is-leaving {
  animation: upkeep-notice-out 150ms ease-in both;
}

.upkeep-alert-toast__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--notice-accent);
  background: var(--notice-soft);
  font-size: 15px;
}

.upkeep-alert-toast__content {
  min-width: 0;
  padding-top: 1px;
}

.upkeep-alert-toast__title {
  margin: 0;
  color: var(--notice-text);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.upkeep-alert-toast__message {
  margin: 3px 0 0;
  color: var(--notice-copy);
  font-size: 13px;
  line-height: 1.42;
}

.upkeep-alert-toast__close,
.notification-toast-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #667085;
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.upkeep-alert-toast__close:hover,
.notification-toast-close:hover {
  color: var(--notice-text);
  background: #f1f4f8;
}

.upkeep-alert-toast__close:focus-visible,
.notification-toast-close:focus-visible,
.notification-toast-btn:focus-visible {
  outline: 3px solid rgba(23, 105, 232, 0.14);
  outline-offset: 2px;
}

/* Actionable WebSocket notices: new order, invoice paid, and related events. */
body .notification-toast {
  --notification-accent: var(--notice-blue);
  --notification-soft: var(--notice-blue-soft);
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 11990;
  width: min(420px, calc(100vw - 36px));
  min-width: 0;
  max-width: none;
  overflow: hidden;
  color: var(--notice-text);
  background: var(--notice-surface);
  border: 1px solid var(--notice-border);
  border-radius: 12px;
  box-shadow: var(--notice-shadow);
  animation: upkeep-notice-in 180ms cubic-bezier(.2, .8, .2, 1) both;
}

body .notification-toast.new_order,
body .notification-toast.new_chat_message {
  --notification-accent: var(--notice-blue);
  --notification-soft: var(--notice-blue-soft);
}

body .notification-toast.order_paid,
body .notification-toast.payment_update {
  --notification-accent: var(--notice-green);
  --notification-soft: var(--notice-green-soft);
}

body .notification-toast.approved_but_not_paid {
  --notification-accent: var(--notice-amber);
  --notification-soft: var(--notice-amber-soft);
}

body .notification-toast.invoice_declined {
  --notification-accent: var(--notice-red);
  --notification-soft: var(--notice-red-soft);
}

body .notification-toast.hiding {
  animation: upkeep-notice-out 150ms ease-in both;
}

body .notification-toast-header {
  padding: 15px 48px 14px 15px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

body .notification-toast-icon,
body .notification-toast.new_order .notification-toast-icon,
body .notification-toast.new_chat_message .notification-toast-icon,
body .notification-toast.order_paid .notification-toast-icon,
body .notification-toast.payment_update .notification-toast-icon,
body .notification-toast.approved_but_not_paid .notification-toast-icon,
body .notification-toast.invoice_declined .notification-toast-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--notification-accent);
  background: var(--notification-soft);
  font-size: 16px;
}

body .notification-toast-content {
  min-width: 0;
}

body .notification-toast-title {
  margin: 1px 0 0;
  color: var(--notice-text);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.012em;
}

/* Who sent a chat message and on which order. */
body .notification-toast-context {
  margin: 3px 0 0;
  color: var(--notice-text);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  overflow-wrap: anywhere;
}

body .notification-toast-message {
  margin: 4px 0 0;
  color: var(--notice-copy);
  font-size: 13px;
  line-height: 1.42;
}

body .notification-toast-time {
  margin: 4px 0 0;
  color: var(--notice-muted);
  font-size: 11px;
  line-height: 1.3;
}

body .notification-toast-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  line-height: 1;
}

body .notification-toast-actions {
  padding: 11px 14px 14px;
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
  gap: 8px;
  border-top: 1px solid #edf1f6;
}

body .notification-toast-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--notice-border);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #263247;
  background: #fff;
  box-shadow: none;
  font-size: 13px;
  line-height: 1;
  font-weight: 620;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 90ms ease;
}

body .notification-toast-btn.primary,
body .notification-toast-btn.success {
  color: #fff;
  background: #1769e8;
  border-color: #1769e8;
}

body .notification-toast-btn.secondary {
  color: #344054;
  background: #fff;
  border-color: var(--notice-border);
}

body .notification-toast-btn:hover {
  transform: none;
  box-shadow: none;
  text-decoration: none;
}

body .notification-toast-btn.primary:hover,
body .notification-toast-btn.success:hover {
  color: #fff;
  background: #0f56c9;
  border-color: #0f56c9;
}

body .notification-toast-btn.secondary:hover {
  color: var(--notice-text);
  background: #f8fafc;
  border-color: #cbd5e1;
}

@keyframes upkeep-notice-in {
  from { opacity: 0; transform: translateY(-8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes upkeep-notice-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-6px) scale(.985); }
}

@media (max-width: 600px) {
  .upkeep-notice-stack,
  body .notification-toast {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
  }

  .notification-toast-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-toast-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .upkeep-alert-toast,
  .upkeep-alert-toast.is-leaving,
  .notification-toast,
  .notification-toast.hiding {
    animation-duration: 1ms;
  }
}
