/* The bell, top right (assets/js/bell.js): what is waiting on you, in one box.
   The Work Hub's bell (runmai.app notification-center.js): a grey panel of
   white cards in stacks, in EMS US navy and red, plus EMS's own tabs. The
   button sits beside the avatar menu (topbar.css .acct-menu). */
.bell-wrap { position: relative; flex: none; }
.bell-wrap[hidden] { display: none; }

.bell-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--ems-navy, #2A3890);
  transition: background .18s var(--tb-ease-soft, ease), transform .18s ease;
}
.bell-btn:hover, .bell-btn[aria-expanded="true"] { background: var(--tb-wash, #f2f4fb); }
.bell-btn:focus-visible { outline: 3px solid var(--ems-red, #BE1E2D); outline-offset: 2px; }
.bell-btn.has-new svg { animation: bell-ring 1.1s var(--tb-ease-pop, ease) 1; transform-origin: 50% 12%; }
@keyframes bell-ring { 0%, 100% { transform: none; } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } }
.bell-count {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box;
  display: grid; place-items: center; border-radius: 99px; border: 2px solid #fff;
  background: var(--ems-red, #BE1E2D); color: #fff; font: 700 10px/1 Lato, sans-serif;
}
.bell-count[hidden] { display: none; }

/* The panel: grey, rounded 18px, opens with the Hub's spring. */
.bell-panel {
  position: absolute; right: -6px; top: calc(100% + 12px); width: 372px; max-width: calc(100vw - 24px);
  background: #f5f5f7; border: 0; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .07); z-index: 60; color: #1d1d1f; font-size: 13px;
  box-sizing: border-box; transform-origin: top right; display: flex; flex-direction: column; max-height: min(620px, calc(100vh - 90px)); overflow: hidden;
  opacity: 0; transform: translateY(-8px) scale(.98); visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, transform .24s cubic-bezier(.22, 1.2, .36, 1), visibility 0s linear .24s;
}
.bell-panel.is-open {
  opacity: 1; transform: none; visibility: visible; pointer-events: auto;
  transition: opacity .2s ease, transform .24s cubic-bezier(.22, 1.2, .36, 1), visibility 0s;
}
.bell-panel[hidden] { display: none; }

.bell-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 4px; }
.bell-head b { font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--ems-navy-deep, #162063); }
.bell-markall, .nf-txtbtn {
  border: 0; background: transparent; padding: 2px 5px; border-radius: 6px; cursor: pointer; user-select: none;
  font: 500 12px Lato, sans-serif; color: #86868b; transition: color .12s ease, background .12s ease;
}
.bell-markall { margin-left: auto; }
.bell-markall:hover, .nf-txtbtn:hover { color: #1d1d1f; background: rgba(0, 0, 0, .05); }
.bell-markall[hidden] { display: none; }

/* EMS's tabs: All / Needs attention / Messages. */
.bell-tabs { padding: 2px 12px 0; border-bottom: 1px solid rgba(0, 0, 0, .07); }
.bell-tabrow { display: flex; gap: 2px; }
.bell-tab {
  border: 0; background: none; cursor: pointer; padding: 7px 8px 8px; font: 700 12.5px Lato, sans-serif; color: #6e6e73;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .16s ease, border-color .16s ease;
}
.bell-tab:hover { color: #1d1d1f; }
.bell-tab.is-on { color: var(--ems-navy, #2A3890); border-bottom-color: var(--ems-red, #BE1E2D); }
.bell-tab:focus-visible { outline: 2px solid var(--ems-navy, #2A3890); outline-offset: -2px; border-radius: 6px; }
.bell-tabn { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 99px; background: #fdecee; color: var(--ems-red, #BE1E2D); font-size: 11px; margin-left: 3px; }

.bell-body { position: relative; overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px 12px; flex: 1 1 auto; min-height: 0; }

/* What each kind is, by colour: --bk ink, --bk-bg wash (tiles, badges). */
.bell-k--message { --bk: #2A3890; --bk-bg: #e6e9f8; }
.bell-k--waiting { --bk: #b45309; --bk-bg: #fdebd0; }
.bell-k--task { --bk: #0e7490; --bk-bg: #d7f1f5; }
.bell-k--match { --bk: #1a7f37; --bk-bg: #dcf1e2; }
.bell-k--program { --bk: #162063; --bk-bg: #e1e5f4; }
.bell-k--survey { --bk: #5b3cc4; --bk-bg: #ebe5fc; }
.bell-k--request { --bk: #BE1E2D; --bk-bg: #fbe3e6; }
.bell-k--plan { --bk: #0e7490; --bk-bg: #d7f1f5; }
.bell-k--goal { --bk: #a16207; --bk-bg: #fdf3d3; }

/* A stack: its header (face or kind, name, count, Clear), then its cards. */
.nf-group { margin-top: 10px; }
.nf-group:first-child { margin-top: 6px; }
.nf-ghead { display: flex; align-items: center; gap: 7px; padding: 2px 4px 6px 6px; }
.nf-ghead.is-foldable { cursor: pointer; user-select: none; }
.nf-gface { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.nf-gtile { width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center; background: var(--bk); color: #fff; }
.nf-gtile svg { width: 10px; height: 10px; }
.nf-gname { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: #1d1d1f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nf-gcount { font-size: 11.5px; color: #86868b; margin-right: 4px; }

.nf-card {
  position: relative; z-index: 1; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px 10px 10px; border-radius: 14px;
  background: #fff; border: 1px solid rgba(0, 0, 0, .05); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); cursor: pointer; touch-action: pan-y;
  transition: transform .18s ease, box-shadow .14s ease, opacity .18s ease;
}
.nf-card + .nf-card { margin-top: 6px; }
.nf-card:hover, .nf-stack:hover .nf-card { box-shadow: 0 3px 10px rgba(0, 0, 0, .07); }
.nf-card:focus-visible { outline: 2px solid var(--ems-navy, #2A3890); outline-offset: 1px; }
.nf-card.is-read .nf-title { font-weight: 500; }
.nf-card.is-dragging { transition: none; }
.nf-card.is-gone { opacity: 0; transform: translateX(110%) !important; }

.nf-ic { position: relative; flex: none; width: 32px; height: 32px; margin-top: 1px; }
.nf-tile { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--bk-bg); color: var(--bk); }
.nf-face { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; background: #e8e8ed; }
.nf-badge {
  position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 4px; display: grid; place-items: center;
  background: var(--bk); color: #fff; box-shadow: 0 0 0 1.5px #fff;
}
.nf-main { min-width: 0; flex: 1; }
.nf-top { display: flex; align-items: flex-start; gap: 8px; }
.nf-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: #1d1d1f; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nf-body { font-size: 12.5px; color: #6e6e73; line-height: 1.35; margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Time and clear share ONE corner: the time, and on hover a round X in its place. */
.nf-side { position: relative; flex: none; display: flex; align-items: center; gap: 5px; min-width: 22px; height: 17px; justify-content: flex-end; }
.nf-when { font-size: 11.5px; color: #86868b; white-space: nowrap; transition: opacity .12s ease; }
.nf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ems-red, #BE1E2D); transition: opacity .12s ease; }
.nf-x {
  position: absolute; right: -3px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #6e6e73; background: rgba(0, 0, 0, .06);
  opacity: 0; transform: scale(.8); pointer-events: none; transition: opacity .12s ease, transform .12s ease, background .12s ease;
}
.nf-x svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.nf-x:hover { background: rgba(0, 0, 0, .12); color: #1d1d1f; }
@media (hover: hover) {
  .nf-card:hover .nf-when, .nf-card:hover .nf-dot, .nf-card:focus-visible .nf-when, .nf-card:focus-visible .nf-dot { opacity: 0; }
  .nf-card:hover .nf-x, .nf-card:focus-visible .nf-x { opacity: 1; transform: scale(1); pointer-events: auto; }
}

/* A folded stack: the newest card, two plates peeking out below it. */
.nf-stack { position: relative; isolation: isolate; padding-bottom: 16px; cursor: pointer; }
.nf-stack.is-two { padding-bottom: 8px; }
.nf-plate { position: absolute; height: 30px; border-radius: 0 0 14px 14px; border: 1px solid rgba(0, 0, 0, .09); border-top: 0; box-shadow: 0 2px 4px rgba(0, 0, 0, .06); pointer-events: none; }
.nf-plate.p1 { left: 9px; right: 9px; bottom: 8px; z-index: 0; background: #fafafc; }
.nf-plate.p2 { left: 18px; right: 18px; bottom: 0; z-index: -1; background: #ededf0; }
.nf-stack.is-two .nf-plate.p1 { bottom: 0; }
.nf-group.is-open .nf-card.nf-in { animation: nfIn .26s cubic-bezier(.22, 1.2, .36, 1) both; }
@keyframes nfIn { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }

.nf-empty { text-align: center; padding: 40px 16px 34px; color: #86868b; font-size: 12.5px; }
.nf-empty b { display: block; font-size: 14px; font-weight: 600; color: #1d1d1f; margin-bottom: 3px; }
.bell-warn { margin: 8px 2px; padding: 8px 10px; border-radius: 10px; background: #fffbea; color: #8a6d00; font-size: 12.5px; }

@media (max-width: 760px) {
  .bell-panel { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bell-panel, .bell-panel.is-open, .nf-card, .bell-btn { transition: none; }
  .nf-group.is-open .nf-card.nf-in { animation: none; }
  .bell-btn.has-new svg { animation: none; }
}
