/* Центр уведомлений вошедшего (#1343, man/notices.md): колокольчик слева от
   аватара, кольцо и число идущих задач на аватаре, док уведомлений под ними
   -- как у Facebook. Свой файл: страницы сайта, кроме карты, общей таблицы
   не грузят. */

.notice-center-host {
  --nc-brand: #2b5f92;
  --nc-brand-strong: #224d78;
  --nc-brand-soft: #e7f0fa;
  --nc-red: #e41e3f;
  --nc-text: #050505;
  --nc-muted: #65676b;
  --nc-line: #e4e6eb;
  --nc-hover: #f2f2f2;
  --nc-progress-bg: #e7f0fa;
  --nc-progress-track: #cddcec;
  --nc-done: #1b7f3b;
  --nc-done-bg: #e3f3e8;
  --nc-fail: #d0241f;
  --nc-fail-bg: #fde8e7;
  --nc-info-bg: #eceef1;
  --nc-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice-center__live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Колокольчик ------------------------------------------------------- */
.notice-center__bellwrap {
  position: relative;
  display: inline-flex;
}

.notice-center__bell {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--nc-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.notice-center__bell:hover {
  background: #f0f2f5;
}

.notice-center__bell:active {
  transform: scale(0.96);
}

.notice-center-host--open .notice-center__bell {
  background: var(--nc-brand-soft);
  color: var(--nc-brand);
}

.notice-center__bell:focus-visible,
.notice-center__dot:focus-visible {
  outline: 2px solid var(--nc-brand);
  outline-offset: 2px;
}

/* Число новых -- красным в правом верхнем углу колокольчика. */
.notice-center__count {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 10px;
  background: var(--nc-red);
  color: #fff;
  font: 700 11px/15px var(--nc-font);
  font-variant-numeric: tabular-nums;
  text-align: center;
  pointer-events: none;
}

.notice-center__count[hidden] {
  display: none;
}

/* --- Аватар: кольцо хода и число идущих ------------------------------- */
.notice-center__overlay {
  position: absolute;
  right: 0;
  top: 50%;
  width: 40px;
  height: 40px;
  transform: translateY(-50%);
  pointer-events: none;
}

.notice-center__ring {
  position: absolute;
  inset: -5px;
}

.notice-center__ring[hidden] {
  display: none;
}

.notice-center__ring svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.notice-center__ring-track,
.notice-center__ring-bar {
  fill: none;
  stroke-width: 2.5;
}

.notice-center__ring-track {
  stroke: rgba(43, 95, 146, 0.22);
}

.notice-center__ring-bar {
  stroke: var(--nc-brand);
  stroke-linecap: round;
  stroke-dasharray: var(--notice-progress, 0) 100;
  transition: stroke-dasharray 0.4s ease;
}

.notice-center__ring--spin svg {
  animation: nc-turn 1.1s linear infinite;
}

.notice-center__dot {
  position: absolute;
  right: -7px;
  bottom: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 10px;
  background: var(--nc-brand);
  color: #fff;
  font: 700 11px/15px var(--nc-font);
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.notice-center__dot[hidden] {
  display: none;
}

.notice-center__pop {
  animation: nc-pop 0.34s ease-out;
}

/* --- Док ----------------------------------------------------------- */
.notice-center__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 400px;
  max-height: min(680px, calc(100vh - 76px));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
  color: var(--nc-text);
  font-family: var(--nc-font);
  text-align: left;
  z-index: 30;
  animation: nc-in 0.14s ease-out;
}

.notice-center__panel[hidden] {
  display: none;
}

.notice-center__panel:focus {
  outline: none;
}

.notice-center__head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 12px 4px 16px;
}

/* «Прочитать все» -- текстовой кнопкой в шапке, как пункт меню «…» у
   Facebook, только без лишнего нажатия. */
.notice-center__readall {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--nc-brand);
  font: 600 14px/1 var(--nc-font);
  white-space: nowrap;
  cursor: pointer;
}

.notice-center__readall[hidden] {
  display: none;
}

.notice-center__readall:hover {
  background: var(--nc-brand-soft);
}

.notice-center__readall:focus-visible,
.notice-center__tab:focus-visible,
.notice__mark:focus-visible {
  outline: 2px solid var(--nc-brand);
  outline-offset: 2px;
}

.notice-center__readall[hidden] + .notice-center__close {
  margin-left: auto;
}

/* Вкладки «Все» / «Непрочитанные» -- пилюлями. */
.notice-center__tabs {
  display: flex;
  gap: 8px;
  padding: 4px 16px 6px;
}

.notice-center__tab {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--nc-text);
  font: 600 15px/1 var(--nc-font);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.notice-center__tab:hover {
  background: var(--nc-hover);
}

.notice-center__tab[aria-pressed="true"] {
  background: var(--nc-brand-soft);
  color: var(--nc-brand);
}

.notice-center__heading {
  margin: 0;
  font-size: 24px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--nc-text);
}

.notice-center__close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--nc-muted);
  cursor: pointer;
}

.notice-center__close:hover {
  background: var(--nc-hover);
  color: var(--nc-text);
}

.notice-center__close:focus-visible {
  outline: 2px solid var(--nc-brand);
  outline-offset: 1px;
}

.notice-center__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 8px 8px;
  scrollbar-width: thin;
}

.notice-center__section-title {
  margin: 0;
  padding: 8px 8px 4px;
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  color: var(--nc-text);
}

.notice-center__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* --- Уведомление ----------------------------------------------------- */
.notice {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 12px;
  column-gap: 12px;
  align-items: start;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.12s ease;
}

.notice:hover {
  background: var(--nc-hover);
}

.notice__icon {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--nc-info-bg);
  color: var(--nc-muted);
}

.notice[data-tone="progress"] .notice__icon {
  background: var(--nc-progress-bg);
  color: var(--nc-brand);
}

.notice[data-tone="done"] .notice__icon {
  background: var(--nc-done-bg);
  color: var(--nc-done);
}

.notice[data-tone="failed"] .notice__icon {
  background: var(--nc-fail-bg);
  color: var(--nc-fail);
}

/* Кольцо хода вокруг значка идущей задачи: процент -- заливкой, неизвестный
   -- бегом. */
.notice[data-tone="progress"] .notice__icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--nc-brand) calc(var(--notice-progress, 0) * 1%), var(--nc-progress-track) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}

.notice[data-tone="progress"] .notice__icon--spin::before {
  background: conic-gradient(var(--nc-brand) 0 28%, var(--nc-progress-track) 0);
  animation: nc-turn 1.1s linear infinite;
}

/* Значок состояния -- в правом нижнем углу, как значок вида у Facebook. */
.notice__state {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
}

.notice[data-tone="done"] .notice__state {
  background: #2e9b4f;
}

.notice[data-tone="failed"] .notice__state {
  background: var(--nc-fail);
}

.notice__body {
  min-width: 0;
  padding-top: 2px;
}

.notice__line {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
  color: var(--nc-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.notice__title {
  font-weight: 600;
}

.notice__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 4px;
  margin-top: 2px;
  font-size: 13px;
  line-height: 18px;
  color: var(--nc-muted);
}

.notice[data-unread] .notice__time {
  color: var(--nc-brand);
  font-weight: 600;
}

/* Прочитанное -- тише: суть серым, заголовок остаётся читаемым. */
.notice-center__panel .notice:not([data-unread]):not([data-tone="progress"]) .notice__line {
  color: var(--nc-muted);
}

.notice__reason {
  margin-top: 4px;
  font-size: 13px;
  line-height: 18px;
  color: var(--nc-fail);
}

.notice__note {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff4dc;
  color: #5c3c00;
  font-size: 13px;
  line-height: 18px;
}

.notice__progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.notice__bar {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--nc-line);
  overflow: hidden;
}

.notice__bar > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--nc-brand);
  transition: width 0.35s ease;
}

.notice__bar--indeterminate > span {
  position: absolute;
  animation: nc-slide 1.4s ease-in-out infinite;
}

.notice__percent {
  flex: none;
  min-width: 34px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--nc-brand);
}

.notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.notice__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--nc-line);
  color: var(--nc-text);
  font: 600 14px/1 var(--nc-font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.notice__btn:hover {
  background: #d8dadf;
}

.notice__btn--primary {
  background: var(--nc-brand);
  color: #fff;
}

.notice__btn--primary:hover {
  background: var(--nc-brand-strong);
}

.notice__btn:focus-visible,
.notice__dismiss:focus-visible {
  outline: 2px solid var(--nc-brand);
  outline-offset: 2px;
}

.notice__btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* Точка непрочитанного -- она же кнопка «Отметить как прочитанное»; у
   прочитанного на наведении -- пустой круг «Отметить как непрочитанное». */
.notice__mark {
  position: relative;
  grid-column: 3;
  align-self: center;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 2px #bcc0c4;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, box-shadow 0.12s ease;
}

/* Попасть пальцем: поле нажатия шире точки. */
.notice__mark::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}

.notice[data-unread] .notice__mark {
  background: var(--nc-brand);
  box-shadow: none;
  opacity: 1;
}

.notice:hover .notice__mark,
.notice:focus-within .notice__mark {
  opacity: 1;
}

.notice__mark:hover {
  box-shadow: inset 0 0 0 2px var(--nc-brand), 0 0 0 4px var(--nc-brand-soft);
}

.notice[data-unread] .notice__mark:hover {
  box-shadow: 0 0 0 4px var(--nc-brand-soft);
}

.notice-center__panel .notice[data-unread] {
  cursor: pointer;
}

@media (hover: none) {
  .notice__mark {
    opacity: 0.7;
  }
}

/* «Убрать» -- кругом поверх строки при наведении, как меню «…» у Facebook. */
.notice__dismiss {
  position: absolute;
  top: 50%;
  right: 28px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--nc-line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--nc-muted);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.12s ease;
}

.notice__dismiss:hover {
  color: var(--nc-text);
  background: var(--nc-hover);
}

.notice:hover .notice__dismiss,
.notice:focus-within .notice__dismiss {
  opacity: 1;
}

@media (hover: none) {
  .notice__dismiss {
    top: 8px;
    right: 6px;
    width: 28px;
    height: 28px;
    opacity: 1;
    border: 0;
    box-shadow: none;
    background: transparent;
    transform: none;
  }
}

/* --- Виджет файла: карточка -------------------------------------------- */
.notice-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--nc-line);
  border-radius: 8px;
  background: #f7f8fa;
}

.notice-file__type {
  position: relative;
  flex: none;
  width: 34px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--nc-brand);
}

.notice-file__type > svg {
  width: 34px;
  height: 40px;
  stroke-width: 1.4;
}

.notice-file__ext {
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
  padding: 1px 3px;
  border-radius: 3px;
  background: var(--nc-brand);
  color: #fff;
  font: 700 8px/10px var(--nc-font);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.notice-file__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.notice-file__name {
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: var(--nc-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-file__facts {
  font-size: 12px;
  line-height: 16px;
  color: var(--nc-muted);
}

/* --- Тосты: суть нового события под колокольчиком -------------------- */
.notice-toasts {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 31;
  font-family: var(--nc-font);
  text-align: left;
}

.notice--toast {
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  padding: 12px 8px 12px 12px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
  pointer-events: auto;
  animation: nc-toast-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.notice--toast:hover {
  background: #fff;
}

.notice--toast .notice__icon {
  width: 48px;
  height: 48px;
}

.notice--toast .notice__line {
  -webkit-line-clamp: 2;
}

.notice--leaving {
  animation: nc-toast-out 0.22s ease-in forwards;
}

.notice-toast__close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--nc-muted);
  cursor: pointer;
}

.notice-toast__close:hover {
  background: var(--nc-hover);
  color: var(--nc-text);
}

.notice-toast__close:focus-visible {
  outline: 2px solid var(--nc-brand);
  outline-offset: 1px;
}

/* --- Пусто и подвал ---------------------------------------------------- */
.notice-center__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 32px;
  text-align: center;
  color: var(--nc-muted);
}

.notice-center__empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--nc-info-bg);
  color: var(--nc-muted);
}

.notice-center__empty-title {
  margin: 14px 0 4px;
  font-size: 17px;
  font-weight: 600;
  color: var(--nc-text);
}

.notice-center__empty-text {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
}

.notice-center__foot {
  border-top: 1px solid var(--nc-line);
  padding: 10px 16px 12px;
}

.notice-center__foot[hidden] {
  display: none;
}

.notice-center__system {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 18px;
  color: var(--nc-muted);
  cursor: pointer;
}

.notice-center__system input {
  margin: 2px 0 0;
  accent-color: var(--nc-brand);
}

/* --- Телефон: док -- листом во всю ширину (место ставит `place()`) ------ */
@media (max-width: 768px) {
  .notice-center__panel {
    max-height: calc(100dvh - 72px);
    border-radius: 12px;
  }

  .notice {
    grid-template-columns: 48px minmax(0, 1fr) 12px;
  }

  .notice__icon {
    width: 48px;
    height: 48px;
  }
}

/* --- Движение ---------------------------------------------------------- */
@keyframes nc-turn {
  to {
    transform: rotate(360deg);
  }
}

.notice-center__ring--spin svg {
  animation-name: nc-turn-ring;
}

@keyframes nc-turn-ring {
  from {
    transform: rotate(-90deg);
  }
  to {
    transform: rotate(270deg);
  }
}

@keyframes nc-pop {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes nc-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes nc-toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes nc-toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

@keyframes nc-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .notice-center-host *,
  .notice-center-host *::before,
  .notice-center-host *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .notice-center__bellwrap,
  .notice-center__overlay,
  .notice-center__panel,
  .notice-toasts {
    display: none !important;
  }
}
