.notification-trigger {
  position: relative;
}

.notification-trigger.has-unread {
  color: var(--ink-deep);
  border-color: var(--border-strong);
  background: var(--surface-signal-soft);
}

.notification-trigger__count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  color: var(--ink-deep);
  border: 1px solid var(--ink-deep);
  border-radius: var(--radius-pill);
  background: var(--surface-signal);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(43, 41, 37, 0.16);
}

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

.notification-centre[hidden],
.notification-scrim[hidden] {
  display: none;
}

.notification-scrim {
  position: fixed;
  inset: 0;
  z-index: 88;
  background: rgba(43, 41, 37, 0.16);
  animation: notification-scrim-in 160ms ease-out both;
}

.notification-centre {
  position: fixed;
  top: 86px;
  right: 22px;
  z-index: 89;
  display: grid;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 108px);
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface-raised);
  box-shadow: 0 18px 48px rgba(43, 41, 37, 0.2);
  animation: notification-centre-in 190ms var(--ease) both;
}

.notification-centre__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.notification-centre__header h2 {
  margin: 0 0 3px;
  color: var(--ink-deep);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.notification-centre__header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

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

.notification-read-all,
.notification-close,
.notification-filters button,
.notification-row__actions button,
.notification-row__dismiss,
.notification-state button {
  color: var(--text-primary);
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.notification-read-all {
  padding: 7px 8px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.notification-read-all:hover:not(:disabled) {
  background: var(--surface-signal-soft);
}

.notification-read-all:disabled {
  color: var(--text-secondary);
  cursor: default;
  opacity: 0.58;
}

.notification-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}

.notification-close:hover {
  border-color: var(--border-strong);
  background: var(--surface-recessed);
}

.notification-close svg,
.notification-row__dismiss svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.notification-filters {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-canvas);
}

.notification-filters button {
  min-height: 34px;
  padding: 5px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
}

.notification-filters button:hover {
  color: var(--ink-deep);
  background: var(--surface-raised);
}

.notification-filters button.is-active {
  color: var(--ink-deep);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.notification-content {
  min-height: 210px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notification-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 30px;
  gap: 12px;
  padding: 17px 14px 17px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-raised);
  transition: background var(--motion-control) ease;
}

.notification-row:last-child {
  border-bottom: 0;
}

.notification-row.is-unread {
  background: #fffdf0;
}

.notification-row:hover {
  background: var(--surface-signal-soft);
}

.notification-row__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #3f3a31;
  border-radius: 12px;
  background: var(--surface-recessed);
}

.notification-row--warning .notification-row__mark {
  color: #664a00;
  background: #ffe9a8;
}

.notification-row--urgent .notification-row__mark {
  color: #8b2d24;
  background: #fbe2dd;
}

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

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

.notification-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.notification-row__meta span + span::before {
  margin-right: 5px;
  content: "·";
}

.notification-row__unread {
  color: #725400;
}

.notification-row__body h3 {
  margin: 0;
  color: var(--ink-deep);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

.notification-row__body p {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
}

.notification-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
}

.notification-row__actions button,
.notification-state button {
  padding: 0;
  color: #5e4700;
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.notification-row__actions button:hover,
.notification-state button:hover {
  color: var(--ink-deep);
}

.notification-row__dismiss {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
}

.notification-row__dismiss:hover {
  color: var(--ink-deep);
  background: rgba(255, 255, 255, 0.8);
}

.notification-row.is-read .notification-row__body h3,
.notification-row.is-read .notification-row__body p {
  color: var(--text-secondary);
}

.notification-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 32px;
  color: var(--text-secondary);
  text-align: center;
}

.notification-state > svg,
.notification-state__pulse {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: 4px;
  padding: 10px;
  color: var(--ink-deep);
  border-radius: 13px;
  background: var(--surface-signal-soft);
}

.notification-state > svg,
.notification-state__pulse svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.notification-state__pulse {
  animation: notification-pulse 1.4s ease-in-out infinite;
}

.notification-state strong {
  color: var(--ink-deep);
  font-size: 16px;
}

.notification-state p {
  max-width: 32ch;
  margin: 0;
  font-size: 14px;
}

.notification-state--error > svg {
  color: #8b2d24;
  background: #fbe2dd;
}

body.notification-centre-open {
  overflow: hidden;
}

@keyframes notification-centre-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
    box-shadow: 0 8px 24px rgba(43, 41, 37, 0.1);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 48px rgba(43, 41, 37, 0.2);
  }
}

@keyframes notification-scrim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes notification-pulse {
  0%,
  100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@media (max-width: 690px) {
  .notification-centre {
    inset: 8px;
    width: auto;
    max-height: none;
    border-radius: 14px;
  }

  .notification-centre__header {
    padding: 17px 14px 14px;
  }

  .notification-centre__header h2 {
    font-size: 22px;
  }

  .notification-read-all {
    padding-inline: 5px;
  }

  .notification-filters {
    padding-inline: 14px;
  }

  .notification-row {
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    gap: 10px;
    padding: 15px 10px 15px 14px;
  }

  .notification-row__mark {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notification-centre,
  .notification-scrim,
  .notification-state__pulse {
    animation: none;
  }
}
