/* ==========================================================================
   Notifications — the bell, its dropdown, the Notifications page, the in-app
   toast and the desktop-permission banner. Ported from the approved mock-up
   (devsoftuk-ERP-Notifications.html) onto the app.css design tokens.

   Every class is prefixed nt- : the mock-up's .badge, .toast, .tabs and .chip
   are all Bootstrap classes already, and would pick up Bootstrap's styling.
   ========================================================================== */

.nt-bellwrap { position: relative; }

.nt-bell {
  width: 38px; height: 38px;
  border: 1px solid var(--dsu-line); border-radius: 8px;
  background: #fff; color: var(--dsu-ink);
  display: grid; place-items: center; position: relative;
  font-size: 1.05rem; line-height: 1;
}
.nt-bell:hover, .nt-bell[aria-expanded="true"] { border-color: var(--dsu-ink); }
.nt-bell:focus-visible { outline: 2px solid var(--dsu-blue); outline-offset: 2px; }

.nt-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--dsu-red); color: #fff; border: 2px solid #fff;
  font-size: 11px; font-weight: 600; line-height: 14px;
  display: grid; place-items: center;
}
.nt-badge[hidden] { display: none !important; }
.nt-badge.pulse { animation: nt-pulse 1s ease-out 1; }
@keyframes nt-pulse { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* ---- dropdown ---- */
.nt-dd {
  position: absolute; right: 0; top: 46px; z-index: 1050;
  width: 420px; max-width: calc(100vw - 24px);
  background: #fff; border: 1px solid var(--dsu-line); border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .14); overflow: hidden;
  text-align: left; color: var(--dsu-ink); font-size: 13.5px;
}
.nt-hd { padding: 12px 16px; border-bottom: 1px solid var(--dsu-line); display: flex; align-items: center; gap: 10px; }
.nt-hd h2 { font-size: 14px; font-weight: 600; margin: 0; }
.nt-cnt { background: var(--dsu-red-light); color: var(--dsu-red); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; }
.nt-link { margin-left: auto; border: 0; background: none; color: var(--dsu-blue); font-size: 12px; padding: 0; }
.nt-link:hover { text-decoration: underline; }

.nt-tabs { display: flex; padding: 0 12px; border-bottom: 1px solid var(--dsu-line); }
.nt-tabs button {
  border: 0; background: none; padding: 8px 10px; font-size: 12.5px; font-weight: 500;
  color: var(--dsu-ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nt-tabs button.on { color: var(--dsu-blue); border-color: var(--dsu-blue); }

.nt-list { max-height: 420px; overflow: auto; }
.nt-list-page { max-height: none; }

.nt-grp {
  font-size: 11px; font-weight: 600; color: var(--dsu-ink-3); text-transform: uppercase;
  letter-spacing: .4px; padding: 8px 16px 4px; background: #fafbfc;
}

.nt-item {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #f0f1f3; cursor: pointer; position: relative;
  outline: none;
}
.nt-item:hover, .nt-item:focus-visible { background: #f7faff; }
.nt-item:focus-visible { box-shadow: inset 0 0 0 2px var(--dsu-blue); }
.nt-item.unread { background: #f3f8ff; }
.nt-item.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--dsu-blue); }

.nt-ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; }
.nt-ic.b { background: var(--dsu-blue-light); }
.nt-ic.g { background: var(--dsu-green-light); }
.nt-ic.a { background: var(--dsu-amber-light); }
.nt-ic.r { background: var(--dsu-red-light); }
.nt-ic.k { background: #eee; }

.nt-t { font-weight: 600; font-size: 13px; }
.nt-item.unread .nt-t { color: #000; }
.nt-m { color: var(--dsu-ink-2); font-size: 12.5px; margin-top: 2px; line-height: 1.35; overflow-wrap: anywhere; }
.nt-m b { font-weight: 500; color: var(--dsu-ink); }
.nt-mention { background: var(--dsu-blue-light); color: var(--dsu-blue-active); padding: 0 3px; border-radius: 3px; font-weight: 500; }

.nt-ctx { font-size: 11.5px; color: var(--dsu-ink-3); margin-top: 5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nt-chip { background: #f0f1f3; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 500; color: var(--dsu-ink-2); }
.nt-chip.p { background: var(--dsu-blue-light); color: var(--dsu-blue-active); }

.nt-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.nt-when { font-size: 11px; color: var(--dsu-ink-3); white-space: nowrap; }
.nt-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dsu-blue); opacity: 0; transition: opacity .15s; }
.nt-item.unread .nt-dot { opacity: 1; }
.nt-mark { opacity: 0; font-size: 11px; color: var(--dsu-ink-3); border: 0; background: none; padding: 0; }
.nt-item:hover .nt-mark, .nt-item:focus-within .nt-mark { opacity: 1; }
.nt-item:not(.unread) .nt-mark { display: none; }

.nt-ft { padding: 10px 16px; border-top: 1px solid var(--dsu-line); display: flex; justify-content: space-between; font-size: 12.5px; }
.nt-empty { padding: 40px; text-align: center; color: var(--dsu-ink-3); }

/* ---- page ---- */
.nt-page { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.nt-card { overflow: hidden; }
.nt-toolbar { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--dsu-line); align-items: center; flex-wrap: wrap; }
.nt-toolbar select, .nt-toolbar input {
  border: 1px solid var(--dsu-line); border-radius: 7px; padding: 7px 10px; font-size: 13px; background: #fff; color: var(--dsu-ink);
}
.nt-toolbar input { flex: 1; min-width: 140px; }
.nt-foot { padding: 10px 16px; border-top: 1px solid var(--dsu-line); font-size: 12.5px; color: var(--dsu-ink-3); display: flex; gap: 8px; }
.nt-prefs { padding: 16px; }
.nt-prefs th { font-size: 11.5px; color: var(--dsu-ink-3); text-transform: uppercase; letter-spacing: .3px; font-weight: 600; }
.nt-sec { font-size: 12px; font-weight: 600; color: var(--dsu-ink-3); text-transform: uppercase; letter-spacing: .4px; margin: 22px 0 10px; }

/* ---- toast ---- */
.nt-toasts { position: fixed; right: 24px; bottom: 24px; z-index: 1080; display: grid; gap: 10px; }
.nt-toast {
  background: #fff; border: 1px solid var(--dsu-line); border-left: 4px solid var(--dsu-blue); border-radius: 8px;
  padding: 12px 14px; width: 340px; max-width: calc(100vw - 32px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
  display: grid; grid-template-columns: 1fr auto; gap: 10px; color: var(--dsu-ink);
}
.nt-toast b { display: block; font-size: 13px; }
.nt-toast p { font-size: 12.5px; color: var(--dsu-ink-2); margin: 2px 0 0; overflow-wrap: anywhere; }
.nt-toast a { font-size: 12px; }
.nt-toast .x { border: 0; background: none; color: var(--dsu-ink-3); font-size: 14px; align-self: start; }

/* ---- desktop permission banner ---- */
.nt-banner {
  background: var(--dsu-amber-light); border-left: 3px solid var(--dsu-amber);
  padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: 12.5px; color: var(--dsu-amber);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.nt-banner span { display: flex; gap: 6px; }

@media (max-width: 991.98px) {
  .nt-page { grid-template-columns: 1fr; }
}

/* A full-width sheet on phones. */
@media (max-width: 600px) {
  .nt-dd { position: fixed; left: 0; right: 0; top: 58px; width: auto; max-width: none; border-radius: 0 0 10px 10px; }
  .nt-list { max-height: calc(100vh - 200px); }
  .nt-toasts { right: 12px; left: 12px; bottom: 12px; }
  .nt-toast { width: auto; }
}
