/* ===================================================================
   Пагинация архива READY (дашборд врача)
   =================================================================== */
.ready-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  margin: 1.5rem auto;
  padding: 1rem;
  border-top: 1px solid var(--border, #e5e7eb);
}
.ready-pagination__info {
  font-size: .85rem;
  color: var(--text-muted, #6b7280);
}
.ready-pagination__controls {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  justify-content: center;
}
.ready-pagination .page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 .55rem;
  border: 1px solid var(--border, #e5e7eb);
  background: #fff;
  color: var(--text, #111827);
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  transition: background .12s, border-color .12s;
}
.ready-pagination .page-btn:hover:not(:disabled) {
  background: #f5f5f7;
  border-color: #c7c7cc;
}
.ready-pagination .page-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.ready-pagination .page-btn--current {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  color: #fff;
  font-weight: 600;
}
.ready-pagination .page-btn--current:hover {
  background: var(--primary, #3b82f6);
}
.ready-pagination .page-ellipsis {
  padding: 0 .25rem;
  color: var(--text-muted, #6b7280);
  user-select: none;
}

/* ===================================================================
   Карточка READY, обработанная другим врачом — мягкая визуальная пометка
   =================================================================== */
.request-card--colleague {
  position: relative;
  background: #fafafa;
  border-color: #e5e7eb;
}
.request-card--colleague::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #9ca3af;
  border-radius: var(--radius, 6px) 0 0 var(--radius, 6px);
}
.request-card--colleague .request-id {
  color: #4b5563;
}
.colleague-ribbon {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .5px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 1;
  pointer-events: none;
}

/* =============================================================
 * Колокольчик уведомлений в navbar
 * ============================================================= */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.notif-bell__trigger {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.notif-bell__trigger:hover,
.notif-bell__trigger.is-open {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color, rgba(255, 255, 255, 0.15));
}
.notif-bell__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-navbar, #1f2937);
  pointer-events: none;
}
.notif-bell__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 1500;
  display: flex;
  flex-direction: column;
}
.notif-bell__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  color: var(--text, #1e293b);
}
.notif-bell__title { font-weight: 700; font-size: 0.95rem; }
.notif-bell__mark-all {
  background: none;
  border: none;
  color: var(--primary, #3b82f6);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.notif-bell__mark-all:hover { background: rgba(59, 130, 246, 0.08); }
.notif-bell__push-panel {
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.07);
  border-bottom: 1px solid var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif-bell__push-text {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text, #1e293b);
  line-height: 1.35;
}
.notif-bell__empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
}
.notif-bell__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notif-bell__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: var(--bg-card, #fff);
  transition: background 0.15s, opacity 0.18s ease, transform 0.18s ease, max-height 0.18s ease;
}
.notif-bell__item:hover { background: rgba(59, 130, 246, 0.06); }
.notif-bell__item:last-child { border-bottom: none; }
.notif-bell__item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.notif-bell__item-dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin: -4px -6px 0 0;  /* компактнее, чтобы не раздвигало */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted, #94a3b8);
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.notif-bell__item-dismiss:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}
.notif-bell__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}
.notif-bell__item--unread .notif-bell__item-text {
  font-weight: 600;
  color: var(--text, #1e293b);
}
.notif-bell__item:not(.notif-bell__item--unread) {
  /* Уже прочитанные (после клика, перед удалением) — выглядят приглушённо */
  background: rgba(148, 163, 184, 0.06);
}
.notif-bell__item:not(.notif-bell__item--unread) .notif-bell__item-text {
  font-weight: 400;
  color: var(--text-muted, #6b7280);
}
.notif-bell__item--dismissing {
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
}
.notif-bell__item-text {
  font-size: 0.85rem;
  color: var(--text, #1e293b);
  line-height: 1.35;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.notif-bell__item-code {
  display: inline-block;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--primary, #3b82f6);
  margin-right: 4px;
}
.notif-bell__item-time {
  font-size: 0.7rem;
  color: var(--text-muted, #6b7280);
}

.notif-bell__push-panel--ok {
  background: rgba(34, 197, 94, 0.06);
  border-bottom: 1px solid rgba(34, 197, 94, 0.15);
}
.notif-bell__push-actions {
  display: flex;
  gap: 6px;
}
.notif-bell__push-actions .notif-bell__reconnect {
  flex: 1;
}
.notif-bell__reconnect {
  display: block;
  width: 100%;
  padding: 6px 10px;
  font-size: 0.78rem;
  background: transparent;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.notif-bell__reconnect:hover:not(:disabled) {
  background: var(--surface-hover, #f3f4f6);
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
}
.notif-bell__reconnect:disabled { opacity: 0.6; cursor: wait; }
/* «Отключить push» — отделяем от «Тест/Переподключить» приглушённо-красным на hover. */
.notif-bell__reconnect--off:hover:not(:disabled) {
  background: var(--danger-soft, #fef2f2);
  border-color: var(--danger, #dc2626);
  color: var(--danger, #dc2626);
}

/* Mobile-первоочередные правки колокольчика:
   - tap-target 40px (вместо 36) — ближе к Apple/Google-рекомендации
   - panel шире и max-height ниже, чтобы вписался под navbar 52px
   - кнопки push-actions переносятся в столбик при узком экране
   - position: fixed чтобы панель всегда была на весь экран независимо
     от того где именно расположен колокольчик в navbar. Раньше при
     `position: absolute; right: 0` от родителя-колокольчика панель
     уходила за пределы экрана влево, если колокольчик слева (баг
     2026-05-22: на админ-дашборде колокольчик был слева, видны были
     только крестики справа). */
@media (max-width: 640px) {
  .notif-bell__trigger {
    width: 40px;
    height: 40px;
  }
  .notif-bell__panel {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 80px);
  }
  .notif-bell__item { padding: 12px 14px; }
  .notif-bell__item-text { font-size: 0.9rem; }
  .notif-bell__push-actions { flex-wrap: wrap; }
  .notif-bell__push-actions .notif-bell__reconnect { min-width: 0; }
}

/* Подсветка карточки по клику в уведомлении (колокольчик / ?open_request=ID). */
@keyframes highlight-flash {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); }
  30%  { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.0); }
}
.request-card.highlight-flash {
  animation: highlight-flash 2.2s ease-out;
}

/* === Галерея: лайтбокс просмотра файлов (mobile-first) === */
.lb-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lb-stage {
  flex: 1 1 auto; width: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 8px; box-sizing: border-box;
}
.lb-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  -webkit-user-select: none; user-select: none;
  touch-action: none;   /* жесты (pinch/pan) обрабатываем сами, не отдаём браузеру */
  will-change: transform;
}
.lb-bar-hint { opacity: 0.55; font-size: 0.76rem; }
@media (max-width: 600px) { .lb-bar-hint { display: none; } }
.lb-empty { color: #ddd; font-size: 0.95rem; }
.lb-close {
  position: absolute; top: 10px; right: 14px; z-index: 2;
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  font-size: 1.8rem; line-height: 1; cursor: pointer;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 64px; border: none; border-radius: 8px;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  font-size: 2.2rem; line-height: 1; cursor: pointer;
}
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, 0.24); }
.lb-bar {
  flex: 0 0 auto; width: 100%; box-sizing: border-box;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: rgba(0, 0, 0, 0.5);
  color: #eee; font-size: 0.85rem;
}
.lb-bar-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar-count { opacity: 0.8; }
.lb-bar-dl { color: #7fb3ff; text-decoration: none; white-space: nowrap; }
.lb-bar-dl:hover { text-decoration: underline; }

/* Кнопки управления изображением в лайтбоксе: поворот, зеркало.
   Сброс на 0°/false происходит при переключении файла. */
.lb-bar-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #eee;
  font-size: 1.15rem;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.lb-bar-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.36); }
.lb-bar-btn:active { background: rgba(255, 255, 255, 0.28); }
.lb-bar-btn.is-active {
  background: rgba(37, 99, 235, 0.55);
  border-color: rgba(37, 99, 235, 0.85);
  color: #fff;
}
