/* ===================================================================
   Пагинация архива 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;
}
/* Багрепорт Врач №8: «КОЛЛЕГА» теперь в потоке (в стопке статуса под «ВЫПОЛНЕН»),
   а не absolute поверх — наслоение физически невозможно. */
.colleague-badge {
  display: inline-block;
  margin-top: 2px;  /* зазор от бейджа выше — на случай старого Safari без flex gap */
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .5px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* =============================================================
 * Колокольчик уведомлений в 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;
}
/* Бейдж «снимок размечен» для тех, кому редактор недоступен (видят, но не правят) */
.lb-bar-anno-badge {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(37, 99, 235, 0.5);
  color: #cfe0ff; font-size: 0.8rem; white-space: nowrap;
}
/* Уголок-метка «размечен» на миниатюре вложения к бланку */
.doctor-thumb-tile-anno-badge {
  position: absolute; left: 4px; top: 4px; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: #2563eb; color: #fff; font-size: 12px; line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ── Разметка снимков (рисование поверх) ──────────────────────────────── */
/* Обёртка img + canvas: трансформ (зум/поворот) живёт здесь, чтобы разметка
   двигалась вместе со снимком. flex — чтобы обёртка ужалась точно к картинке. */
.lb-canvas-wrap {
  position: relative;
  display: flex;
  max-width: 100%;
  max-height: 100%;
  will-change: transform;
}
.lb-canvas-wrap .lb-img { will-change: auto; }
.lb-anno-canvas {
  position: absolute;
  left: 0;
  top: 0;
  /* Точные позиция/размер выставляются из JS (_lbSyncCanvas) ПО BOX КАРТИНКИ.
     Раньше было inset:0 + 100%/100% = по обёртке; при height-constrained картинке
     обёртка шире картинки → canvas свисал за края, и разметка «съезжала». */
  -webkit-user-select: none; user-select: none;
}
.lb-canvas-wrap.is-drawing { cursor: crosshair; }
.lb-canvas-wrap.is-drawing .lb-anno-canvas { cursor: crosshair; }

/* Панель инструментов разметки (вторая строка под основным баром) */
.lb-draw-toolbar {
  flex: 0 0 auto; width: 100%; box-sizing: border-box;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; background: rgba(0, 0, 0, 0.62);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.lb-draw-group { display: inline-flex; align-items: center; gap: 6px; }
/* Группа цветов может переноситься на 2 ряда (13 образцов не влезают в узкий экран) */
.lb-draw-group--colors { flex-wrap: wrap; max-width: 100%; justify-content: center; }
.lb-draw-sep { width: 1px; align-self: stretch; background: rgba(255,255,255,.14); margin: 2px 4px; }
.lb-draw-label { color: #bcc4d0; font-size: .72rem; white-space: nowrap; }
.lb-tool-btn {
  flex: 0 0 auto; min-width: 36px; height: 34px; padding: 0 8px;
  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.05rem; line-height: 1;
  border-radius: 6px; cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s;
}
.lb-tool-btn:hover { background: rgba(255, 255, 255, 0.18); }
.lb-tool-btn.is-active { background: rgba(37,99,235,.6); border-color: rgba(37,99,235,.9); color: #fff; }
.lb-tool-btn.is-danger:hover { background: rgba(220,38,38,.55); border-color: rgba(220,38,38,.8); }
.lb-tool-btn.is-primary { background: rgba(16,185,129,.55); border-color: rgba(16,185,129,.85); color:#fff; }
.lb-tool-btn.is-primary:hover { background: rgba(16,185,129,.75); }
.lb-tool-btn:disabled { opacity: .4; cursor: default; }
.lb-swatch {
  width: 24px; height: 24px; border-radius: 50%; padding: 0;
  border: 2px solid rgba(255,255,255,.25); cursor: pointer; flex: 0 0 auto;
  transition: transform .1s, border-color .1s;
}
.lb-swatch:hover { transform: scale(1.12); }
.lb-swatch.is-active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); transform: scale(1.12); }
.lb-draw-range { width: 92px; vertical-align: middle; accent-color: #2563eb; }
.lb-draw-val { color: #eee; font-size: .74rem; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .lb-draw-toolbar { gap: 7px; padding: 7px 10px; }
  .lb-draw-label { display: none; }
  .lb-draw-range { width: 70px; }
}
