/* Header notification bell and its panel (issue #855).
   Graphite #2B2F33 line icon, sage #486141 unread badge with a white count, muted #6E7378 times.
   Errors, if this surface ever shows one, are clay #8E6244. Never red. */

.header-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #2B2F33;
  cursor: pointer;
}
.header-bell-btn:hover { background: #ECE8E0; }
.header-bell-btn[aria-expanded="true"] { background: #ECE8E0; }
.header-bell-btn:focus-visible { outline: 3px solid #486141; outline-offset: 2px; }
.header-bell-icon { display: block; width: 20px; height: 20px; }

/* Unread count. Hidden at zero (updateNotificationBadge sets the inline display). */
.header-bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #486141;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

/* ---- Panel: 360px, right-aligned under the bell, at 769px and wider ---- */
.notif-panel-root { position: fixed; inset: 0; z-index: 1400; }
.notif-panel-root[hidden] { display: none; }
.notif-panel-scrim { position: absolute; inset: 0; background: transparent; }
.notif-panel {
  position: absolute;
  box-sizing: border-box;
  width: 360px;
  max-width: calc(100vw - 16px);
  max-height: min(520px, calc(100vh - 96px));
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #ECE8E0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(31, 30, 26, 0.12);
  color: #2B2F33;
}
.notif-panel:focus { outline: none; }
.notif-panel-handle { display: none; }
.notif-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #ECE8E0;
}
.notif-panel-title {
  margin: 0;
  font-family: var(--font-serif, 'Source Serif 4', 'Source Serif Pro', Georgia, serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  color: #2B2F33;
}
.notif-panel-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: #6E7378;
  text-decoration: underline;
  cursor: pointer;
}
.notif-panel-link:hover { color: #2B2F33; }
.notif-panel-link:focus-visible { outline: 3px solid #486141; outline-offset: 2px; border-radius: 2px; }
.notif-panel-link[disabled] { opacity: 0.5; cursor: default; text-decoration: none; }

.notif-panel-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; }
.notif-row {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  min-height: 52px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid #ECE8E0;
  background: transparent;
  font: inherit;
  text-align: left;
  color: #2B2F33;
  cursor: pointer;
}
.notif-panel-list > li:last-child .notif-row { border-bottom: 0; }
.notif-row:hover { background: #F7F3EC; }
.notif-row:focus-visible { outline: 3px solid #486141; outline-offset: -3px; background: #F7F3EC; }
.notif-row-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
}
.notif-row.unread .notif-row-dot { background: #486141; }
.notif-row-main { flex: 1 1 auto; min-width: 0; }
.notif-row-title {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.notif-row.unread .notif-row-title { font-weight: 600; }
.notif-row-time { flex: 0 0 auto; font-size: 12px; color: #6E7378; white-space: nowrap; }

.notif-panel-empty {
  margin: 0;
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  color: #6E7378;
}
.notif-panel-foot { padding: 12px 16px; border-top: 1px solid #ECE8E0; }

/* ---- Bottom sheet under 769px ---- */
@media (max-width: 768px) {
  .header-bell-btn { width: 44px; height: 44px; }
  .header-bell-badge { top: 4px; right: 4px; }
  .notif-panel-scrim { background: rgba(43, 47, 51, 0.35); }
  .notif-panel {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100%;
    max-width: none;
    max-height: calc(100% - 48px);
    border: 0;
    border-radius: 20px 20px 0 0;
    background: #F7F3EC;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -8px 24px rgba(31, 30, 26, 0.18);
  }
  .notif-panel-handle {
    display: block;
    width: 40px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 999px;
    background: #D9D3C7;
  }
  .notif-panel-head { padding-top: 10px; }
  .notif-row { min-height: 56px; }
  .notif-row:hover { background: #ECE8E0; }
  .notif-panel-link { min-height: 44px; display: inline-flex; align-items: center; }
}

@keyframes notifSheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
  .notif-panel { animation: notifSheetUp 0.2s ease-out; }
}

.notif-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The dialog that holds the moved email preferences. Same card, no second frame. */
#notificationPrefsModal .notif-prefs-modal-content {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 12px;
  background: #FFFFFF;
}
#notificationPrefsModal .notif-prefs-modal-content > .close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #2B2F33;
  cursor: pointer;
}
#notificationPrefsModal .card {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
#notificationPrefsModal .card > h3 {
  margin: 0 40px 12px 0;
  font-family: var(--font-serif, 'Source Serif 4', 'Source Serif Pro', Georgia, serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: #2B2F33;
}
@media (max-width: 480px) {
  #notificationPrefsModal .notif-prefs-modal-content { padding: 20px 16px; max-height: calc(100vh - 24px); }
}
