/* Глобальный центр уведомлений CRM (сайдбар + модалка + toast). */

.app-notif-wrap {
  position: relative;
}
.app-sidebar-foot .app-notif-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--app-sidebar-text);
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.app-sidebar-foot .app-notif-btn:hover,
.app-sidebar-foot .app-notif-btn.is-open {
  background: var(--app-sidebar-hover);
}
.app-notif-btn .app-notif-icon {
  position: relative;
  width: 1.35rem;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
}
.app-notif-badge {
  position: absolute;
  top: -7px;
  right: -9px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #ea580c;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.05rem;
  text-align: center;
}
.app-notif-badge.is-empty {
  display: none;
}

.app-notif-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
.app-notif-overlay[hidden] { display: none !important; }
body.app-notif-open {
  overflow: hidden;
}

.app-notif-modal {
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  background: #fff;
  color: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: app-notif-in 0.22s ease-out;
}
@keyframes app-notif-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.app-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.9rem;
  border-bottom: 1px solid #e8eef5;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.app-notif-head-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.app-notif-head-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: #2563eb;
  flex-shrink: 0;
}
.app-notif-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.app-notif-head-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.app-notif-readall {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.28rem 0.45rem;
  border-radius: 8px;
}
.app-notif-readall:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.app-notif-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.15rem;
}
.app-notif-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.app-notif-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem 0.5rem;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  flex-wrap: wrap;
}
.app-notif-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.18rem;
  background: #f1f5f9;
  border-radius: 10px;
}
.app-notif-tab {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0.32rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.app-notif-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.app-notif-tab-count:empty { display: none; }
.app-notif-tab-count {
  min-width: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.15rem;
  text-align: center;
}
.app-notif-tab.is-active .app-notif-tab-count {
  background: #dbeafe;
  color: #1d4ed8;
}
.app-notif-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.app-notif-action {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
}
.app-notif-action:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.app-notif-action.is-danger:hover {
  color: #b91c1c;
  background: #fef2f2;
}
.app-notif-body {
  overflow: auto;
  padding: 0.45rem 0.55rem 0.85rem;
}
.app-notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.72rem 0.7rem;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}
.app-notif-item:hover {
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
}
.app-notif-item.is-unread {
  background: #f8fbff;
  border-color: #e8f0fe;
}
.app-notif-item.is-unread .app-notif-item-title {
  font-weight: 700;
}
.app-notif-item.is-broadcast {
  background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
  border-color: #fdba74;
  box-shadow: inset 3px 0 0 #ea580c;
}
.app-notif-item.is-overdue {
  background: #fef2f2;
  border-color: #fecaca;
  box-shadow: inset 3px 0 0 #dc2626;
}
.app-notif-item.is-important.tone-mention {
  background: #fff1f2;
  border-color: #fecdd3;
  box-shadow: inset 3px 0 0 #e11d48;
}
.app-notif-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.app-notif-avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}
.app-notif-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.app-notif-avatar.is-system {
  background: #e2e8f0;
  color: #475569;
}
.app-notif-avatar.is-broadcast {
  background: #ea580c;
  color: #fff;
}
.app-notif-avatar-mark {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #ea580c;
  color: #fff;
  font-size: 0.48rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.app-notif-item-main {
  min-width: 0;
  flex: 1;
}
.app-notif-chip {
  display: inline-block;
  margin-bottom: 0.22rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.app-notif-chip.chip-broadcast {
  background: #ea580c;
  color: #fff;
}
.app-notif-chip.chip-mention {
  background: #e11d48;
  color: #fff;
}
.app-notif-chip.chip-overdue {
  background: #dc2626;
  color: #fff;
}
.app-notif-item-title {
  display: block;
  font-size: 0.9rem;
  line-height: 1.35;
}
.app-notif-item-meta {
  display: block;
  margin-top: 0.16rem;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}
.app-notif-item-who {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.72rem;
  color: #94a3b8;
}
.app-notif-empty {
  padding: 2.4rem 1.2rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
}
.app-notif-empty i {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 0.65rem;
  color: #cbd5e1;
}

.toast-container .toast {
  pointer-events: auto;
}
.app-notif-toast {
  min-width: 280px;
  max-width: min(380px, calc(100vw - 1.5rem));
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}
.app-notif-toast .toast-body a {
  font-weight: 650;
}

html.app-sidebar-collapsed .app-sidebar-foot .app-notif-btn {
  justify-content: center;
  padding: 0.45rem 0;
}
html.app-sidebar-collapsed .app-sidebar-foot .app-notif-btn .app-nav-label {
  display: none;
}

@media (max-width: 991px) {
  .app-notif-overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }
  .app-notif-modal {
    width: 100%;
    max-height: min(88vh, 680px);
    border-radius: 16px 16px 12px 12px;
  }
}

.mobile-top-bar .app-notif-btn {
  color: #fff;
  width: auto;
  padding: 0.2rem 0.35rem;
  background: transparent;
  border: 0;
}
.mobile-top-bar .app-notif-btn .app-nav-label {
  display: none;
}
