.notification-trigger {
  position: relative;
}

.notification-trigger-label {
  position: relative;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.notification-badge {
  position: absolute;
  top: 50%;
  left: calc(100% + 4px);
  min-width: 17px;
  height: 17px;
  margin: 0;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: #f05a5a;
  box-shadow: 0 4px 10px rgba(224, 69, 69, 0.26);
  font-size: 9px;
  line-height: 1;
  font-weight: 800;
  transform: translateY(-50%);
}

.notification-popover {
  bottom: -54px;
  width: min(390px, calc(100vw - 230px));
  max-height: min(620px, calc(100vh - 48px));
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.notification-heading {
  min-height: 66px;
  padding: 13px 16px;
  align-items: center;
}

.notification-heading > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.notification-heading small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-heading button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  flex: 0 0 auto;
  color: #2862b8;
  background: #f3f7ff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.notification-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#homeNotificationSoundToggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#homeNotificationSoundToggle[aria-pressed="true"] {
  color: #087e68;
  border-color: #a9dfd1;
  background: #eaf9f4;
}

.notification-heading button:hover,
.notification-heading button:focus-visible {
  border-color: #9fc0ee;
  background: #eaf2ff;
  outline: 0;
}

.notification-heading button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.notification-list {
  max-height: min(536px, calc(100vh - 132px));
  padding: 7px;
  display: grid;
  gap: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notification-item {
  position: relative;
  min-width: 0;
  padding: 12px 12px 12px 10px;
  border-radius: 13px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 7px;
  align-items: start;
  gap: 10px;
  color: #294c79;
  background: #f4f8ff;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.notification-item:hover,
.notification-item:focus-visible {
  color: #174f9d;
  background: #eaf2ff;
  outline: 0;
  transform: translateY(-1px);
}

.notification-item.is-read {
  grid-template-columns: 38px minmax(0, 1fr);
  color: #667e9c;
  background: transparent;
}

.notification-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #3976f3;
  background: #e5efff;
  font-size: 20px;
}

.notification-item.tone-violet .notification-icon {
  color: #6d5be7;
  background: #eeeaff;
}

.notification-item.tone-orange .notification-icon {
  color: #d36c21;
  background: #fff0e3;
}

.notification-item.tone-green .notification-icon {
  color: #168866;
  background: #e2f7ee;
}

.notification-item.tone-teal .notification-icon {
  color: #087e86;
  background: #def7f6;
}

.notification-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.notification-copy strong {
  color: #17375f;
  font-size: 13px;
  line-height: 18px;
  font-weight: 750;
}

.notification-copy > span {
  color: #587292;
  font-size: 12px;
  line-height: 18px;
}

.notification-copy small {
  color: #8ba0ba;
  font-size: 10px;
}

.notification-item.is-read .notification-copy strong {
  color: #526985;
}

.notification-unread-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: #3976f3;
  box-shadow: 0 0 0 3px rgba(57, 118, 243, 0.1);
}

.notification-empty {
  min-height: 150px;
  margin: 0;
  padding: 28px 20px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: #7f94af;
  text-align: center;
  font-size: 12px;
}

.notification-empty i {
  color: #7aa2df;
  font-size: 30px;
}

.notification-empty strong {
  color: #436386;
  font-size: 14px;
}

.notification-realtime-toast {
  position: absolute;
  z-index: 60;
  left: calc(100% + 16px);
  bottom: 0;
  width: min(340px, calc(100vw - 230px));
  min-height: 78px;
  padding: 8px 40px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.98);
  border-radius: 17px;
  color: #294c79;
  background: rgba(250, 253, 255, 0.98);
  box-shadow: 0 18px 44px rgba(40, 82, 132, 0.22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: notification-toast-in 0.28s ease-out both;
}

.notification-realtime-toast[hidden] {
  display: none;
}

.notification-toast-open {
  width: 100%;
  min-width: 0;
  padding: 3px;
  border: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.notification-toast-open:focus-visible {
  border-radius: 10px;
  outline: 2px solid #8fb8f4;
  outline-offset: 2px;
}

.notification-toast-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #3976f3;
  background: #e5efff;
  font-size: 21px;
}

.notification-toast-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.notification-toast-copy strong,
.notification-toast-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-toast-copy strong {
  color: #17375f;
  font-size: 13px;
}

.notification-toast-copy span {
  color: #587292;
  font-size: 12px;
}

.notification-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #7790ad;
  background: transparent;
  font-size: 17px;
  cursor: pointer;
}

.notification-toast-close:hover,
.notification-toast-close:focus-visible {
  color: #245da8;
  background: #edf4ff;
  outline: 0;
}

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

html[data-theme="dark"] .notification-badge {
  border-color: #111316;
}

html[data-theme="dark"] .notification-heading button {
  color: #d5b7ff;
  border-color: #50415f;
  background: #2b2034;
}

html[data-theme="dark"] #homeNotificationSoundToggle[aria-pressed="true"] {
  color: #9fe5d3;
  border-color: #365f55;
  background: #17352e;
}

html[data-theme="dark"] .notification-realtime-toast {
  color: #d3d4d8;
  border-color: rgba(74, 77, 82, 0.92);
  background: rgba(12, 14, 16, 0.98);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.56);
}

html[data-theme="dark"] .notification-toast-copy strong {
  color: #eeeef1;
}

html[data-theme="dark"] .notification-toast-copy span {
  color: #adafb5;
}

html[data-theme="dark"] .notification-item {
  color: #d3d4d8;
  background: #17191d;
}

html[data-theme="dark"] .notification-item:hover,
html[data-theme="dark"] .notification-item:focus-visible {
  color: #f1e8ff;
  background: #251c2d;
}

html[data-theme="dark"] .notification-item.is-read {
  color: #9a9ca2;
  background: transparent;
}

html[data-theme="dark"] .notification-copy strong,
html[data-theme="dark"] .notification-item.is-read .notification-copy strong {
  color: #eeeef1;
}

html[data-theme="dark"] .notification-copy > span {
  color: #adafb5;
}

html[data-theme="dark"] .notification-copy small,
html[data-theme="dark"] .notification-empty {
  color: #85878e;
}

html[data-theme="dark"] .notification-empty strong {
  color: #d4d4d8;
}

@media (max-width: 1050px) {
  .notification-trigger > .notification-trigger-label,
  body.system-page .notification-trigger > .notification-trigger-label {
    position: static;
    width: 0;
    display: block;
  }

  .notification-badge {
    top: 4px;
    right: 3px;
    left: auto;
    margin: 0;
    transform: none;
  }
}

@media (max-width: 760px) {
  .home-sidebar,
  body.system-page .home-sidebar {
    grid-template-columns: 44px minmax(0, 1fr) 96px;
  }

  .side-footer,
  body.system-page .side-footer {
    display: flex;
    gap: 4px;
  }

  .sidebar-menu.notification-menu,
  body.system-page .sidebar-menu.notification-menu {
    display: block;
  }

  .notification-trigger,
  body.system-page .notification-trigger {
    width: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .notification-popover,
  body.system-page .notification-popover {
    position: fixed;
    top: 70px;
    right: 12px;
    bottom: auto;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 84px);
  }

  .notification-realtime-toast,
  body.system-page .notification-realtime-toast {
    position: fixed;
    z-index: 150;
    top: 70px;
    right: 12px;
    bottom: auto;
    left: 12px;
    width: auto;
  }
}
