:root {
  --bs-font-sans-serif: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  background-color: #f4f6f9;
  font-size: 0.9rem;
}

.navbar { box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.card   { border-radius: 12px; }
.badge-sm { font-size: 0.7rem; padding: 0.2em 0.5em; }

.fw-mono { font-family: 'Courier New', monospace; font-size: 0.85em; }

/* Таблицы */
.table > :not(caption) > * > * { padding: 0.6rem 0.75rem; }
.table tbody tr:hover { background-color: rgba(21, 101, 192, 0.04); }

/* Статус badge цвета */
.bg-orange { background-color: #fd7e14 !important; color: #fff; }

/* Карточки KPI */
.card .card-body .rounded-3 { min-width: 52px; min-height: 52px; }

/* Скроллбар в комментариях */
#commentsList::-webkit-scrollbar { width: 4px; }
#commentsList::-webkit-scrollbar-track { background: transparent; }
#commentsList::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Timeline история */
.timeline-item { position: relative; padding-left: 1.5rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 0.4rem;
  top: 0.5rem;
  bottom: -0.5rem;
  width: 2px;
  background: #dee2e6;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: #1565C0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #1565C0;
}

/* Toast */
.toast { min-width: 280px; }

/* Drag-drop upload */
.drop-zone {
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone.drag-over {
  border-color: #1565C0;
  background: rgba(21,101,192,.05);
}

/* Превью скриншота участка в таблицах */
.scheme-thumb { width: 48px; height: 34px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--bs-border-color); cursor: zoom-in; vertical-align: middle; }
.scheme-none { color: var(--bs-secondary-color); }
#hoverPreview {
  position: fixed; z-index: 3000; max-width: 340px; max-height: 340px;
  border: 2px solid #fff; border-radius: 6px; box-shadow: 0 10px 34px rgba(0,0,0,.5);
  display: none; pointer-events: none; background: #fff;
}

/* ===== Тёмная тема (Bootstrap 5.3 data-bs-theme) ===== */
[data-bs-theme="dark"] body { background-color: #0f141a; }
[data-bs-theme="dark"] .bg-white { background-color: #1b2330 !important; color: var(--bs-body-color); }
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-light > th,
[data-bs-theme="dark"] .table > thead.table-light th { background-color: #232c3a !important; color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .bg-light { background-color: #1b2330 !important; color: var(--bs-body-color); }
[data-bs-theme="dark"] .alert-light { background-color: #1b2330; color: var(--bs-body-color); border-color: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .badge.bg-light.text-dark { background-color: #2a3442 !important; color: #e7edf4 !important; }
[data-bs-theme="dark"] .text-dark { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .card { box-shadow: 0 2px 10px rgba(0,0,0,.45); }
[data-bs-theme="dark"] .table tbody tr:hover { background-color: rgba(255,255,255,.05); }
[data-bs-theme="dark"] #commentsList::-webkit-scrollbar-thumb { background: #444; }
[data-bs-theme="dark"] .timeline-item::before { background: #3a4452; }
[data-bs-theme="dark"] .drop-zone { border-color: #3a4452; }

/* Мобильная адаптация */
@media (max-width: 576px) {
  .container-fluid { padding: 0.5rem; }
  .card-body { padding: 0.75rem; }
  .table-responsive { font-size: 0.8rem; }
  h4 { font-size: 1.1rem; }
}
