/* Notification bell in the topbar, next to Upload CSV (static/js/notifications.js).
   The button reuses the topbar's .rt-btn so it matches Upload CSV's height/border. */

.ntf-wrap { position: relative; flex-shrink: 0; }
/* Solid brand-blue so it reads as the topbar's one primary control. Doubled
   class to outrank .rt-btn's base/dark rules in index.html's later <style>. */
.rt-btn.ntf-btn {
  position: relative; width: 38px; justify-content: center; padding: 0;
  background: var(--brand-blue); border-color: var(--brand-blue); color: #fff;
  box-shadow: 0 2px 6px rgba(67, 105, 244, 0.35);
}
.rt-btn.ntf-btn:hover,
.rt-btn.ntf-btn[aria-expanded="true"] { background: #3355e0; border-color: #3355e0; }
.ntf-btn svg { width: 19px; height: 19px; transform-origin: 50% 2px; }
.ntf-btn:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.ntf-ring svg { animation: ntf-ring 0.9s ease-in-out 1; }
@keyframes ntf-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(16deg); }
  30% { transform: rotate(-14deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) { .ntf-ring svg { animation: none; } }
.ntf-badge {
  position: absolute; top: -5px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #b83232; color: #fff; font-size: 10.5px; font-weight: 800;
  line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--bg-page); font-variant-numeric: tabular-nums;
}
.ntf-badge[hidden] { display: none; }

.ntf-panel {
  position: absolute; top: 42px; right: 0; z-index: 1000; width: min(400px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 70px)); display: flex; flex-direction: column;
  background: #fff; border: 1px solid #e8e4de; border-radius: 10px; box-shadow: 0 10px 30px rgba(1, 1, 44, 0.16);
  overflow: hidden;
}
.ntf-panel[hidden] { display: none; }
.ntf-hdr { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 10px; border-bottom: 1px solid #f0eee9; }
.ntf-hleft { display: flex; align-items: center; gap: 8px; }
.ntf-htitle { font-size: 14px; font-weight: 800; color: #1a1a2e; }
.ntf-link { font: inherit; font-size: 12.5px; font-weight: 700; color: var(--brand-blue); background: none; border: 0; padding: 0; cursor: pointer; }
.ntf-link:hover:not(:disabled) { text-decoration: underline; }
.ntf-link:disabled { color: var(--text-secondary); opacity: 0.6; cursor: default; }

.ntf-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.ntf-list li + li { border-top: 1px solid #f0eee9; }
.ntf-item {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; align-items: start;
  width: 100%; padding: 11px 14px; background: none; border: 0; text-align: left; cursor: pointer; font: inherit;
}
.ntf-item:hover { background: #f7f8fb; }
.ntf-item:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: -2px; }
/* Logo tile: the app's .co-logo at 32px, with the severity dot on its corner. */
.ntf-logo { position: relative; width: 32px; height: 32px; margin-top: 1px; }
.ntf-logo .co-logo { width: 32px; height: 32px; border-radius: 7px; vertical-align: 0; }
.ntf-logo .co-logo img { padding: 3px; box-sizing: border-box; }
.ntf-logo .co-logo span { font-size: 11px; }
.ntf-icon {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 7px;
  background: rgba(67, 105, 244, 0.1); color: var(--brand-blue);
}
.ntf-icon svg { width: 18px; height: 18px; }
.ntf-logo .ntf-lvl { position: absolute; right: -3px; bottom: -3px; box-shadow: 0 0 0 2px #fff; }
.ntf-item:hover .ntf-lvl { box-shadow: 0 0 0 2px #f7f8fb; }
.ntf-lvl { width: 10px; height: 10px; border-radius: 50%; }
.ntf-lvl-critical { background: #b83232; }
.ntf-lvl-warning { background: #c47a1e; }
.ntf-lvl-info { background: #4369f4; }
.ntf-lvl-good { background: #1a7a4a; }
.ntf-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ntf-title { font-size: 13px; font-weight: 600; color: #1a1a2e; line-height: 1.35; }
.ntf-unread .ntf-title { font-weight: 800; }
.ntf-detail { font-size: 12.5px; color: #4a4a5e; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ntf-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ntf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ntf-new { font-size: 11.5px; font-weight: 800; color: var(--brand-blue); background: rgba(67, 105, 244, 0.1); border-radius: 999px; padding: 2px 8px; }
.ntf-detail-1 { -webkit-line-clamp: 1; }

/* Popup: grows out of the bell (transform-origin at the bell), stays a few
   seconds, then shrinks back into it. A caret points at the bell. */
.ntf-toast-live { position: absolute; top: 46px; right: 0; z-index: 1001; }
.ntf-toast {
  position: relative; width: min(340px, calc(100vw - 32px));
  background: #fff; border: 1px solid #e8e4de; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(1, 1, 44, 0.18);
  transform-origin: calc(100% - 19px) -10px; opacity: 0;
}
.ntf-toast[hidden] { display: none; }
.ntf-toast::before {
  content: ""; position: absolute; top: -6px; right: 14px; width: 10px; height: 10px;
  background: inherit; border-left: 1px solid #e8e4de; border-top: 1px solid #e8e4de; transform: rotate(45deg);
}
.ntf-toast-in { animation: ntf-pop-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.25) forwards; }
.ntf-toast-out { animation: ntf-pop-out 0.22s ease-in forwards; }
@keyframes ntf-pop-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.35); }
  to { opacity: 1; transform: none; }
}
@keyframes ntf-pop-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-12px) scale(0.35); }
}
@keyframes ntf-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ntf-fade-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ntf-toast-in { animation-name: ntf-fade-in; }
  .ntf-toast-out { animation-name: ntf-fade-out; }
}
.ntf-toast-btn {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; align-items: start;
  width: 100%; padding: 12px 14px; background: none; border: 0; border-radius: 10px;
  text-align: left; cursor: pointer; font: inherit;
}
.ntf-toast-btn:hover { background: #f7f8fb; }
.ntf-toast-btn:hover .ntf-lvl { box-shadow: 0 0 0 2px #f7f8fb; }
.ntf-toast-btn:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: -2px; }

.ntf-empty { padding: 28px 20px; text-align: center; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.ntf-empty b { display: block; font-size: 13.5px; color: #1a1a2e; margin-bottom: 4px; }
.ntf-foot { padding: 8px 14px; font-size: 11.5px; color: var(--text-secondary); border-top: 1px solid #f0eee9; }

html[data-theme="dark"] .ntf-panel { background: #131c2e; border-color: #273348; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
html[data-theme="dark"] .ntf-hdr,
html[data-theme="dark"] .ntf-list li + li,
html[data-theme="dark"] .ntf-foot { border-color: #273348; }
html[data-theme="dark"] .ntf-htitle,
html[data-theme="dark"] .ntf-title,
html[data-theme="dark"] .ntf-empty b { color: #e6edf3; }
html[data-theme="dark"] .ntf-detail { color: #b9c3d6; }
html[data-theme="dark"] .ntf-meta,
html[data-theme="dark"] .ntf-empty,
html[data-theme="dark"] .ntf-foot { color: #8a9bb8; }
html[data-theme="dark"] .ntf-item:hover { background: #1a2744; }
html[data-theme="dark"] .rt-btn.ntf-btn { background: #4f74ff; border-color: #4f74ff; color: #fff; box-shadow: 0 2px 8px rgba(79, 116, 255, 0.35); }
html[data-theme="dark"] .rt-btn.ntf-btn:hover,
html[data-theme="dark"] .rt-btn.ntf-btn[aria-expanded="true"] { background: #6a8aff; border-color: #6a8aff; }
html[data-theme="dark"] .ntf-icon { background: rgba(123, 158, 255, 0.16); color: #7b9eff; }
html[data-theme="dark"] .ntf-logo .ntf-lvl { box-shadow: 0 0 0 2px #131c2e; }
html[data-theme="dark"] .ntf-toast { background: #131c2e; border-color: #273348; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] .ntf-toast::before { border-color: #273348; }
html[data-theme="dark"] .ntf-toast-btn:hover { background: #1a2744; }
html[data-theme="dark"] .ntf-toast-btn:hover .ntf-lvl { box-shadow: 0 0 0 2px #1a2744; }
html[data-theme="dark"] .ntf-new { color: #7b9eff; background: rgba(123, 158, 255, 0.16); }
html[data-theme="dark"] .ntf-item:hover .ntf-lvl { box-shadow: 0 0 0 2px #1a2744; }
html[data-theme="dark"] .ntf-badge { box-shadow: 0 0 0 2px #0f172a; }
html[data-theme="dark"] .ntf-lvl-info { background: #7b9eff; }
