.cw-notifications {
  position: relative;
  flex: 0 0 auto;
}

.cw-notifications__toggle {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  background: var(--cw-panel);
  color: var(--cw-primary);
}

.cw-notifications__toggle:hover,
.cw-notifications__toggle:focus-visible,
.cw-notifications__toggle[aria-expanded="true"] {
  border-color: var(--cw-accent);
  background: var(--cw-accent-soft);
}

.cw-notifications__toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.cw-notifications__badge {
  position: absolute;
  top: -6px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--cw-panel);
  border-radius: 10px;
  background: #b42318;
  color: #fff;
  font-size: var(--cw-type-xs);
  font-weight: 900;
  line-height: 15px;
  text-align: center;
}

.cw-notifications__panel {
  position: absolute;
  z-index: 1100;
  top: calc(100% + 12px);
  right: 0;
  width: min(390px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--cw-border);
  border-radius: 14px;
  background: var(--cw-panel);
  box-shadow: 0 18px 50px rgb(22 32 28 / 18%);
}

.cw-notifications__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--cw-border);
}

.cw-notifications__header div {
  display: grid;
  gap: 2px;
}

.cw-notifications__header strong {
  color: var(--cw-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: var(--cw-type-md);
}

.cw-notifications__header span,
.cw-notifications__item span {
  color: var(--cw-muted);
  font-size: var(--cw-type-xs);
}

.cw-notifications__header button,
.cw-notifications__read {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cw-primary);
  font-size: var(--cw-type-sm);
  font-weight: 800;
}

.cw-notifications__header button:hover,
.cw-notifications__header button:focus-visible,
.cw-notifications__read:hover,
.cw-notifications__read:focus-visible {
  color: var(--cw-accent);
  text-decoration: underline;
}

.cw-notifications__status {
  padding: 24px 18px;
  color: var(--cw-muted);
  font-size: var(--cw-type-sm);
  text-align: center;
}

.cw-notifications__list {
  max-height: min(430px, 60vh);
  padding: 0;
  margin: 0;
  overflow-y: auto;
  list-style: none;
}

.cw-notifications__item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cw-border);
  background: var(--cw-panel);
}

.cw-notifications__item.is-unread {
  background: var(--cw-accent-soft);
}

.cw-notifications__item.is-unread::before {
  position: absolute;
  top: 20px;
  left: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cw-accent);
  content: "";
}

.cw-notifications__item.is-high-priority::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: #b42318;
  content: "";
}

.cw-notifications__item div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.cw-notifications__item strong {
  color: var(--cw-ink);
  font-size: var(--cw-type-sm);
  line-height: 1.35;
}

.cw-notifications__item p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--cw-muted);
  font-size: var(--cw-type-sm);
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cw-notifications__read {
  align-self: start;
  white-space: nowrap;
}

.cw-notifications__panel footer {
  padding: 11px 18px;
  background: var(--cw-surface, #f7f7f3);
  text-align: center;
}

.cw-notifications__panel footer a {
  color: var(--cw-primary);
  font-size: var(--cw-type-sm);
  font-weight: 800;
  text-decoration: none;
}

.cw-notifications__panel footer a:hover,
.cw-notifications__panel footer a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .cw-notifications__panel {
    position: fixed;
    top: 72px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cw-notifications__panel:not([hidden]) {
    animation: cw-notification-panel-in 140ms ease-out;
  }
}

@keyframes cw-notification-panel-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}
