/* =========================
   ПЕРЕМЕННЫЕ
   ========================= */
:root{
  --sidebar-w: 240px;       /* базовая ширина вместо 260px */
  --mobile-navbar-h: 56px;
  --bg-page: #dfdfdf;
  --bg-sidebar: #f8f9fa;
  --border: #e9ecef;
  --accent: #008080;
}


*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-size: 0.9rem;
  background: var(--bg-page);
  color: #111;
}

/* =========================
   МОБИЛЬНАЯ ШАПКА + OFFCANVAS
   ========================= */
@media (max-width: 767.98px){
  body { padding-top: var(--mobile-navbar-h); }
  .mobile-navbar { height: var(--mobile-navbar-h); }
}

/* Чтобы offcanvas не занимал весь экран */
.offcanvas {
  width: 85vw;            /* комфортная ширина на мобилках */
  max-width: 320px;       /* не шире 320px */
  -webkit-overflow-scrolling: touch;
}

/* =========================
   САЙДБАР (≥ md)
   ========================= */
.sidebar {
  background-color: var(--bg-sidebar);
  padding-top: 1rem;
}

@media (min-width: 768px){
  .sidebar-fixed {
    position: fixed;
    inset: 0 auto 0 0;          /* top right bottom left */
    width: var(--sidebar-w);
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    z-index: 1020;
  }
  .with-sidebar {
    margin-left: var(--sidebar-w);
  }
}

/* =========================
   НАВИГАЦИЯ / ВИД
   ========================= */
.nav .nav-item a.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: inherit;
  padding: .5rem .75rem;
  border-radius: .5rem;
}
nav ul li { border-radius: .5rem; }
nav ul li.active { background-color: #e9ecef; }
nav ul li a span,
nav ul li a i{
  color: var(--accent);
  font-weight: 500;
}
nav ul li:hover { background-color: #e9ecef; }

.nav .nav-item.active,
.nav .nav-item .nav-link.active {
  background-color: #e9ecef;
  border-radius: .5rem;
}

.sidebar-logo-bottom { margin-top: auto; padding: 1rem; }

/* =========================
   КОНТЕНТ / КАРТОЧКИ / ЛОГИ
   ========================= */
main { padding: 1rem; }

.sm-container {
  background: #fff;
  border-radius: 6px;
  margin: 1rem;
}

.logs-container {
  height: 1000px;      /* десктопная высота */
  overflow-y: auto;
}
.logs { color: #000; font-size: 20px; }

.canvas-container {
  background-color: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.05);
  height: 100%;
}
.canvas { width: 100% !important; height: 300px; }

#chart { display: block; width: 100%; height: 500px; }
#active-users-table { width: 100%; }

#active-users-map {
  width: 100% !important;
  height: 60vh !important;
}

/* ТАБЛЕТЫ/НОУТЫ */
@media (max-width: 991.98px){
  #active-users-card .col-3 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* СРЕДНИЕ ЭКРАНЫ */
@media (min-width: 768px) and (max-width: 1199.98px){
  .logs-container { height: 60vh; }
}

/* Утилиты */
.device-tr.selected {
  background-color: #3570ab !important;
  border: 1px solid #007bff;
}
/* ---- Профиль: обложка + аватар + метрики ---- */
.profile-cover{
  height: 120px;
  background: radial-gradient(1200px 200px at -10% 120%, #ddf4ff 0, transparent 60%),
              radial-gradient(1000px 200px at 110% -10%, #e9f7ef 0, transparent 55%),
              linear-gradient(135deg, #f8fafc, #eef2f7);
  border-bottom: 1px solid var(--border);
}

.avatar-xxl{
  width: 104px; height: 104px; border-radius: 50%;
  margin-top: -52px; background: #fff; overflow: hidden;
  border: 4px solid #fff;
}
.avatar-xxl img{ width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback{
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 36px; color: #556;
  background: #eef2f7;
  border-radius: 50%;
}

.chip{
  display: inline-block; padding: .25rem .5rem; border-radius: 999px;
  font-size: .75rem; line-height: 1; border: 1px dashed #c9d3e0; color: #445;
}
.chip-soft{ background: #f6f9fc; }

.kpi{ min-width: 90px; text-align: center; }
.kpi-num{ font-size: 1.25rem; font-weight: 700; }
.kpi-label{ font-size: .75rem; color: #6c757d; }

/* Современная таблица */
.table-modern thead th{
  background: #f8f9fb;
  border-top: 0;
  border-bottom: 1px solid var(--border);
}
.table-modern tbody tr:hover{
  background: #f7fbff;
}

/* Аккуратные “мягкие” бейджи (если у тебя нет Bootstrap 5.3 utility colors) */
.bg-success-subtle{ background: #e8f6ef !important; }
.text-success{ color: #198754 !important; }
.border-success-subtle{ border-color: #cfe9df !important; }
.bg-secondary-subtle{ background: #f0f1f3 !important; }
.text-secondary{ color: #6c757d !important; }
.border-secondary-subtle{ border-color: #dfe2e6 !important; }

/* На узких экранах — больше воздуха */
@media (max-width: 575.98px){
  .avatar-xxl{ width: 84px; height: 84px; margin-top: -42px; }
  .kpi{ min-width: 72px; }
}
/* Общая зона под канвасы: управляем высотой через CSS-переменную */
.chart-area {
  position: relative;
  height: var(--chart-h, 280px);
}
.chart-area > canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Большой элемент по умолчанию — «M», отдельно класс для XL */
.chart-area-xl { --chart-h: 520px; }

/* Переключатели размеров для матрицы */
.btn-group [data-chart-size].active { pointer-events: none; }
