.notification-shell {
  position: relative;
  z-index: 50;
  isolation: isolate;
  min-width: 0;
  flex: 0 0 auto;
  overflow: visible;
}

.notification-trigger {
  position: relative;
  gap: 0;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    color 180ms ease;
  transform-origin: top center;
}

.notification-trigger-has-unread {
  background: linear-gradient(180deg, rgba(109, 75, 242, 0.14), rgba(77, 130, 255, 0.08));
  color: var(--accent-deep);
  box-shadow: 0 12px 24px rgba(109, 75, 242, 0.18);
}

.notification-trigger-alert {
  animation: notification-bell-ring 900ms ease;
}

.notification-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-label {
  display: none;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--sky));
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(86, 58, 216, 0.25);
  transform-origin: center;
}

.notification-trigger-has-unread .notification-badge {
  animation: notification-badge-pop 420ms ease;
}

.notification-badge-hidden {
  display: none;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 0.7rem);
  right: 0;
  z-index: 51;
  width: min(420px, calc(100vw - 2rem));
  max-height: 70vh;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(208, 217, 235, 0.94);
  background:
    radial-gradient(circle at top right, rgba(109, 75, 242, 0.06), transparent 28%),
    rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 48px rgba(96, 112, 142, 0.16);
  backdrop-filter: blur(18px);
}

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

.notification-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(217, 225, 239, 0.92);
}

.notification-panel-header strong {
  display: block;
  color: #1d3154;
  margin-bottom: 0.18rem;
}

.notification-panel-header small {
  color: var(--muted);
}

.notification-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notification-sound-toggle,
.notification-clear {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.notification-sound-toggle {
  border: 1px solid rgba(124, 144, 181, 0.24);
  background: rgba(240, 244, 251, 0.92);
  color: #274267;
  cursor: pointer;
}

.notification-sound-toggle:hover:not(:disabled),
.notification-clear:hover {
  transform: translateY(-1px);
}

.notification-sound-toggle[data-enabled='true'] {
  border-color: rgba(109, 75, 242, 0.24);
  background: linear-gradient(180deg, rgba(109, 75, 242, 0.14), rgba(77, 130, 255, 0.08));
  color: var(--accent-deep);
  box-shadow: 0 8px 18px rgba(109, 75, 242, 0.14);
}

.notification-sound-toggle[data-enabled='false'] {
  color: #5d6f89;
}

.notification-sound-toggle:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  box-shadow: none;
}

.notification-clear {
  border: 1px solid transparent;
  background: transparent;
  color: var(--accent-deep);
  cursor: pointer;
}

.notification-clear:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  transform: none;
}

.notification-clear:disabled:hover {
  background: transparent;
  border-color: transparent;
}

.notification-clear:hover {
  background: rgba(109, 75, 242, 0.08);
  border-color: rgba(109, 75, 242, 0.12);
}

.notification-main:focus-visible,
.notification-mark:focus-visible,
.notification-clear:focus-visible,
.notification-sound-toggle:focus-visible {
  border-radius: 14px;
}

.notification-list {
  display: grid;
  gap: 0;
  max-height: 56vh;
  overflow-y: auto;
}

.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(217, 225, 239, 0.92);
}

.notification-item-unread {
  background: linear-gradient(90deg, rgba(109, 75, 242, 0.05), rgba(255, 255, 255, 0.98));
}

.notification-main {
  min-width: 0;
}

.notification-copy {
  display: grid;
  gap: 0.35rem;
}

.notification-copy strong {
  color: #223654;
  line-height: 1.3;
}

.notification-copy p {
  margin: 0;
  color: #62748d;
  line-height: 1.55;
}

.notification-meta-top,
.notification-meta-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.notification-type {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.58rem;
  border-radius: 999px;
  background: rgba(109, 75, 242, 0.1);
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.notification-mark {
  padding: 0.35rem 0;
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-weight: 700;
  cursor: pointer;
}

.notification-empty {
  padding: 1.35rem 1.1rem 1.5rem;
  text-align: center;
}

.notification-empty strong {
  display: block;
  color: #243854;
  margin-bottom: 0.35rem;
}

.notification-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.notification-popup-region {
  position: fixed;
  right: 1.35rem;
  bottom: 1.35rem;
  z-index: 70;
  display: grid;
  gap: 0.85rem;
  width: min(380px, calc(100vw - 1.5rem));
  pointer-events: none;
}

.notification-popup {
  pointer-events: auto;
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1.05rem 1rem 1.1rem;
  border-radius: 24px;
  border: 1px solid rgba(206, 216, 235, 0.94);
  background:
    radial-gradient(circle at top right, rgba(109, 75, 242, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.98));
  box-shadow: 0 24px 46px rgba(63, 84, 121, 0.2);
  backdrop-filter: blur(18px);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

.notification-popup.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.notification-popup.is-leaving {
  opacity: 0;
  transform: translateY(10px) scale(0.97);
}

.notification-popup-header,
.notification-popup-meta,
.notification-popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.notification-popup-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(226, 233, 246, 0.9);
  color: #3b4f73;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.notification-popup-close:hover {
  background: rgba(109, 75, 242, 0.14);
  color: var(--accent-deep);
  transform: scale(1.04);
}

.notification-popup-title {
  color: #20324f;
  font-size: 1rem;
  line-height: 1.35;
}

.notification-popup-message {
  margin: 0;
  color: #62748d;
  line-height: 1.55;
}

.notification-popup-meta small,
.notification-popup-footer small {
  color: var(--muted);
}

.notification-popup-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-deep);
  font-weight: 700;
  text-decoration: none;
}

.notification-popup-link:hover {
  text-decoration: underline;
}

.notification-trigger-has-unread {
  background: linear-gradient(180deg, rgba(37, 87, 214, 0.14), rgba(75, 137, 239, 0.08));
  box-shadow: 0 8px 18px rgba(37, 87, 214, 0.14);
}

.notification-badge {
  box-shadow: 0 8px 14px rgba(37, 87, 214, 0.18);
}

.notification-panel {
  border-radius: 20px;
  border-color: rgba(214, 221, 233, 0.94);
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 16px 34px rgba(64, 82, 110, 0.12);
  backdrop-filter: blur(14px);
}

.notification-panel-header {
  padding: 1rem 1.1rem 0.95rem;
}

.notification-sound-toggle,
.notification-clear {
  font-size: 0.76rem;
}

.notification-sound-toggle {
  background: rgba(245, 248, 252, 0.96);
  color: #334a64;
}

.notification-sound-toggle[data-enabled='true'] {
  border-color: rgba(37, 87, 214, 0.18);
  background: rgba(237, 243, 255, 0.98);
  box-shadow: none;
}

.notification-clear:hover {
  background: rgba(37, 87, 214, 0.06);
  border-color: rgba(37, 87, 214, 0.1);
}

.notification-item {
  padding: 0.95rem 1.05rem;
}

.notification-item-unread {
  background: linear-gradient(90deg, rgba(237, 243, 255, 0.88), rgba(255, 255, 255, 0.98));
}

.notification-type {
  background: rgba(237, 243, 255, 0.98);
  color: var(--accent-deep);
}

.notification-popup {
  border-radius: 18px;
  border-color: rgba(214, 221, 233, 0.94);
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 18px 34px rgba(64, 82, 110, 0.14);
}

.notification-popup-close {
  background: rgba(237, 243, 255, 0.98);
}

@keyframes notification-bell-ring {
  0% {
    transform: rotate(0deg);
  }
  14% {
    transform: rotate(16deg) scale(1.03);
  }
  28% {
    transform: rotate(-14deg) scale(1.03);
  }
  42% {
    transform: rotate(10deg);
  }
  56% {
    transform: rotate(-7deg);
  }
  70% {
    transform: rotate(4deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes notification-badge-pop {
  0% {
    transform: scale(0.82);
  }
  55% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 640px) {
  .notification-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .notification-panel-actions {
    justify-content: flex-start;
  }

  .notification-popup-region {
    right: 0.75rem;
    left: 0.75rem;
    bottom: 0.85rem;
    width: auto;
  }

  .notification-popup {
    border-radius: 20px;
  }
}

@media (max-width: 520px) {
  .notification-item {
    grid-template-columns: 1fr;
  }

  .notification-meta-top,
  .notification-meta-bottom {
    align-items: flex-start;
  }

  .notification-mark {
    padding-top: 0;
  }
}

