.notification-menu {
  position: relative;
  z-index: 42;
}

.notification-menu[open] {
  z-index: var(--z-notification-popover);
}

.sticky-dashboard:has(.notification-menu[open]),
.mobile-command-bar:has(.notification-menu[open]),
.app-hero-corner-actions:has(.notification-menu[open]) {
  z-index: var(--z-notification-popover);
}

.notification-menu > summary {
  list-style: none;
  cursor: pointer;
}

.notification-menu > summary::-webkit-details-marker {
  display: none;
}

.notification-menu-trigger {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border: 2px solid rgba(24, 33, 47, 0.8);
  border-radius: 999px;
  background: var(--coral);
  color: white;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

.notification-panel {
  position: fixed;
  top: 58px;
  left: max(14px, calc((100vw - 1320px) / 2 + 14px));
  z-index: var(--z-notification-popover);
  width: min(360px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 78px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(192, 202, 214, 0.88);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  color: var(--ink);
}

.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(226, 231, 238, 0.9);
  padding: 12px;
}

.notification-panel-head strong {
  font-size: 0.94rem;
}

.notification-read-all {
  border: 1px solid rgba(47, 128, 98, 0.22);
  border-radius: 999px;
  background: rgba(228, 243, 237, 0.82);
  color: var(--green);
  padding: 5px 9px;
  font-size: 0.74rem;
  font-weight: 850;
}

.notification-read-all:disabled {
  opacity: 0.48;
}

.notification-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding: 10px;
}

.notification-item {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(215, 221, 231, 0.86);
  border-radius: 8px;
  background: rgba(250, 252, 255, 0.84);
  padding: 10px;
}

.notification-item.is-unread {
  border-color: rgba(47, 128, 98, 0.28);
  background: rgba(228, 243, 237, 0.64);
}

.notification-item-main {
  display: grid;
  gap: 4px;
}

.notification-item-main strong {
  font-size: 0.88rem;
  line-height: 1.25;
}

.notification-item-main p {
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.notification-item-main span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.notification-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.notification-action-btn {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(202, 210, 222, 0.9);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 850;
}

.notification-action-btn.strong {
  border-color: rgba(47, 128, 98, 0.28);
  background: rgba(47, 128, 98, 0.12);
  color: var(--green);
}

.notification-action-btn .icon {
  width: 14px;
  height: 14px;
}

.notification-empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.notification-empty .icon {
  width: 22px;
  height: 22px;
}

.follow-share-btn {
  gap: 6px;
}

.follow-share-btn.is-following {
  border-color: rgba(136, 230, 185, 0.52);
  background: rgba(47, 128, 98, 0.28);
}

:root[data-theme="dark"] .notification-panel {
  background: color-mix(in srgb, var(--surface) 92%, black);
  border-color: var(--border);
}

:root[data-theme="dark"] .notification-item,
:root[data-theme="dark"] .notification-action-btn {
  background: rgba(18, 24, 33, 0.94);
  border-color: var(--border);
  color: var(--ink);
}

:root[data-theme="dark"] .notification-panel-head {
  border-color: var(--border);
}

:root[data-theme="dark"] .notification-item.is-unread,
:root[data-theme="dark"] .notification-read-all {
  background: rgba(47, 128, 98, 0.18);
  border-color: rgba(100, 196, 154, 0.32);
}

@media (max-width: 760px) {
  .mobile-command-controls .notification-panel {
    top: calc(max(8px, env(safe-area-inset-top, 0px)) + 52px);
    right: max(12px, env(safe-area-inset-right, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    width: auto;
    max-height: calc(100svh - 76px);
    border-radius: 14px;
  }
}
