/* Стиль ЛК Benmollis Monitor: светлый фон, белые карточки, янтарный акцент (как логотип) */
:root {
  --bm-bg: #fafafa;
  --bm-card: #ffffff;
  --bm-line: #e3e3e3;
  --bm-side: #f0f0f0;
  --bm-side-line: #dddddd;
  --bm-ink: #111827;
  --bm-accent: #f59e0b;
  --bm-accent-hover: #fbbf24;
  --bm-accent-dark: #d97706;
  --bm-ok: #22c55e;
  --bm-ok-halo: #dcfce7;
  --bm-warn: #f59e0b;
  --bm-warn-halo: #fef3c7;
  --bm-err: #c62828;
  --bm-err-halo: #fee2e2;
  --bm-muted: #6b7280;

  --bs-body-bg: var(--bm-bg);
  --bs-body-color: #222222;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Ubuntu, Roboto, sans-serif;
  --bs-primary: #f59e0b;
  --bs-primary-rgb: 245, 158, 11;
  --bs-border-radius-lg: 12px;
  --bs-border-color: var(--bm-line);
  --bs-link-color: #1d4ed8;
  --bs-link-color-rgb: 29, 78, 216;
  --bs-link-hover-color: #1e3a8a;
  --bs-link-hover-color-rgb: 30, 58, 138;
}

body { background: var(--bm-bg); font-size: 14px; }

/* Кнопки */
.btn-primary {
  --bs-btn-color: #111111;
  --bs-btn-bg: var(--bm-accent);
  --bs-btn-border-color: var(--bm-accent-dark);
  --bs-btn-hover-color: #111111;
  --bs-btn-hover-bg: var(--bm-accent-hover);
  --bs-btn-hover-border-color: var(--bm-accent-dark);
  --bs-btn-active-color: #111111;
  --bs-btn-active-bg: var(--bm-accent-dark);
  --bs-btn-active-border-color: var(--bm-accent-dark);
  --bs-btn-focus-shadow-rgb: 245, 158, 11;
  --bs-btn-disabled-color: #111111;
  --bs-btn-disabled-bg: var(--bm-accent);
  --bs-btn-disabled-border-color: var(--bm-accent-dark);
  font-weight: 600;
}
.btn-outline-secondary { --bs-btn-border-color: #d0d0d0; --bs-btn-color: #333333; }

/* Карточки и таблицы */
.card {
  --bs-card-bg: var(--bm-card);
  --bs-card-border-color: var(--bm-line);
  --bs-card-border-radius: 12px;
  --bs-card-inner-border-radius: 11px;
  background: var(--bm-card);
  border: 1px solid var(--bm-line);
  border-radius: 12px;
}
.table { --bs-table-bg: transparent; }
.table > thead th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--bm-muted);
  font-weight: 700;
  letter-spacing: .02em;
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--bm-accent-dark);
  box-shadow: 0 0 0 .2rem rgba(245, 158, 11, .25);
}
.form-check-input:checked, .form-check-input[type="checkbox"]:indeterminate { background-color: var(--bm-accent); border-color: var(--bm-accent-dark); }

/* Общие классы */
.bm-page-title { font-size: 22px; font-weight: 700; margin: 0 0 14px; color: var(--bm-ink); }
.bm-muted { color: var(--bm-muted); font-size: 12px; }
.bm-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle; background: #9ca3af;
}
.bm-dot-ok { background: var(--bm-ok); box-shadow: 0 0 0 4px var(--bm-ok-halo); }
.bm-dot-warn { background: var(--bm-warn); box-shadow: 0 0 0 4px var(--bm-warn-halo); }
.bm-dot-err { background: var(--bm-err); box-shadow: 0 0 0 4px var(--bm-err-halo); }
.bm-dot-off, .bm-dot-none { background: #9ca3af; box-shadow: none; }
.bm-chip {
  display: inline-flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--bm-line); border-radius: 10px; padding: 8px 14px;
  color: inherit; text-decoration: none; cursor: pointer;
}
.bm-chip b { font-size: 18px; }
.bm-chip.active { border-color: var(--bm-accent); box-shadow: 0 0 0 3px var(--bm-warn-halo); }
.bm-chip:hover { color: inherit; }

/* Каркас */
.bm-app { display: flex; min-height: 100vh; }
.bm-side {
  width: 220px; flex-shrink: 0; background: var(--bm-side);
  border-right: 1px solid var(--bm-side-line); padding: 14px 8px;
  display: flex; flex-direction: column; overflow-y: auto;
}
.bm-brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px;
  font-weight: 700; color: var(--bm-ink); text-decoration: none;
}
.bm-brand:hover { color: var(--bm-ink); }
.bm-brand img { width: 34px; height: 34px; }
.bm-brand small { display: block; font-weight: 400; color: var(--bm-muted); font-size: 12px; }
.bm-sec { font-size: 11px; font-weight: 700; color: var(--bm-muted); text-transform: uppercase; padding: 12px 10px 4px; }
.bm-nav-item {
  display: flex; gap: 10px; align-items: center; padding: 7px 10px; margin: 1px 0;
  border-radius: 8px; color: #222222; text-decoration: none;
}
.bm-nav-item:hover { background: #e8e8e8; color: #222222; }
.bm-nav-item.active { background: #e0e0e0; font-weight: 600; }
.bm-nav-item i { font-size: 16px; width: 18px; text-align: center; }
.bm-version { margin-top: auto; padding: 14px 10px 0; font-size: 11px; }
.bm-version a { color: var(--bm-muted); text-decoration: none; }
.bm-version a:hover { text-decoration: underline; }

.bm-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bm-top { display: flex; align-items: center; gap: 12px; padding: 12px 28px 0; justify-content: flex-end; }
.bm-top .bm-menu-btn { display: none; margin-right: auto; }
.bm-icon-btn {
  border: 1px solid #d0d0d0; background: #fff; border-radius: 8px; padding: 6px 10px; color: #333333;
}
.bm-icon-btn:hover { background: #f5f5f5; }
.bm-user { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 2px 4px; text-align: left; }
.bm-ava {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bm-ink); color: var(--bm-accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.bm-user-name { font-weight: 600; line-height: 1.2; display: block; }
.bm-user-groups { display: block; color: var(--bm-muted); font-size: 12px; line-height: 1.2; }
.bm-bell-btn { position: relative; }
.bm-bell-count {
  position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bm-accent); color: var(--bm-ink);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.bm-bell-count.is-critical { background: var(--bm-err); color: #fff; }
.bm-bell-count[hidden] { display: none; }
.bm-bell-menu { width: 340px; max-width: calc(100vw - 32px); padding: 0; }
.bm-bell-head { font-weight: 700; padding: 12px 14px 8px; }
.bm-bell-list { max-height: 60vh; overflow-y: auto; }
.bm-bell-empty { padding: 4px 14px 12px; }
.bm-bell-item { padding: 8px 14px; border-top: 1px solid var(--bm-line); border-left: 3px solid var(--bm-line); }
.bm-bell-item.is-acked { opacity: .65; }
.bm-bell-item-title { font-weight: 600; overflow-wrap: anywhere; }
.bm-bell-item-text { font-size: 13px; overflow-wrap: anywhere; }
.bm-bell-item-meta { font-size: 12px; color: var(--bm-muted); }
.bm-bell-item-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.bm-bell-all { display: block; padding: 10px 14px; border-top: 1px solid var(--bm-line); text-align: center; }
.bm-level-critical { border-left-color: var(--bm-err); }
.bm-level-warning { border-left-color: var(--bm-warn); }
.bm-level-info { border-left-color: var(--bm-muted); }
.bm-level-label-critical { color: var(--bm-err); font-weight: 700; }
.bm-level-label-warning { color: var(--bm-accent-dark); font-weight: 700; }
.bm-level-label-info { color: var(--bm-muted); font-weight: 700; }
.bm-main { padding: 14px 28px 28px; max-width: 1920px; width: 100%; }
.bm-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.bm-anon { width: 100%; max-width: 400px; }
.alert { border-radius: 10px; }
.alert-danger { --bs-alert-color: var(--bm-err); --bs-alert-bg: var(--bm-err-halo); --bs-alert-border-color: var(--bm-err); }
.alert-warning { --bs-alert-color: #92400e; --bs-alert-bg: var(--bm-warn-halo); --bs-alert-border-color: var(--bm-accent); }
.alert-success { --bs-alert-color: #166534; --bs-alert-bg: var(--bm-ok-halo); --bs-alert-border-color: var(--bm-ok); }
.alert-info { --bs-alert-color: #374151; --bs-alert-bg: #f3f4f6; --bs-alert-border-color: var(--bm-line); }
.bm-login { width: 100%; max-width: 400px; }
.bm-login-logo { width: 56px; height: 56px; }
.no-preview { color: var(--bm-muted); font-size: 12px; }
.btn-gap { margin-right: 3px; }
.btn-gap:last-child { margin-right: 0; }

@media (max-width: 768px) {
  .bm-side { position: fixed; top: 0; bottom: 0; left: -240px; z-index: 1040; width: 220px; transition: left .25s; }
  .bm-side.mobile-show { left: 0; box-shadow: 0 0 20px rgba(0, 0, 0, .2); }
  .bm-top { padding: 10px 16px 0; }
  .bm-top .bm-menu-btn { display: inline-block; }
  .bm-main { padding: 12px 16px 24px; }
  .bm-user-text { display: none; }
}

/* Контент: медиатека, группы, расписание */
.bm-empty-icon { font-size: 3rem; color: var(--bm-muted); }
.bm-form-card { max-width: 640px; }
.bm-badge { background: #f3f4f6; color: #374151; border: 1px solid var(--bm-line); font-weight: 500; }
.bm-status { white-space: nowrap; }
.bm-pre { background: #f3f4f6; max-height: 60vh; overflow: auto; }
.card > .table-responsive { border-radius: 12px; }
.card .table td { vertical-align: middle; }
.card .table tbody tr:last-child td { border-bottom: 0; }

.preview-container {
  width: 100px; height: 100px; display: flex; align-items: center; justify-content: center;
  background: #f3f4f6; border: 1px solid var(--bm-line); border-radius: 12px; overflow: hidden; cursor: pointer;
}
.preview-image { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.preview-cell .preview-container { width: 120px; height: 90px; margin: 0 auto; }
.preview-cell { text-align: center; }
.action-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
.card .table .btn-sm { display: inline-flex; align-items: center; gap: .3rem; }

/* Загрузка файла */
.upload-btn {
  border: 2px dashed #d0d0d0; border-radius: 12px; background: #fafafa; padding: 1rem; text-align: center;
  cursor: pointer; min-height: 100px; display: flex; flex-direction: column; justify-content: center;
  align-items: center; transition: border-color .2s, background .2s;
}
.upload-btn:hover, .upload-btn.drag { border-color: var(--bm-accent); background: var(--bm-warn-halo); }
.upload-btn i { font-size: 1.8rem; color: var(--bm-ink); }
.upload-spinner {
  display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center;
  background: #fff; border: 1px solid var(--bm-line); padding: 2rem; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15); z-index: 1060; max-width: calc(100vw - 32px);
}
.upload-progress { width: 250px; max-width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 1rem auto; }
.upload-progress .progress-fill { height: 100%; width: 0; background: var(--bm-accent); transition: width .3s ease; }

/* Просмотр превью: светлая подложка и белая карточка */
.modal-image-overlay {
  display: none; position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 1070;
  justify-content: center; align-items: center; cursor: zoom-out; padding: 16px;
}
.modal-image-container {
  position: relative; max-width: 95vw; max-height: 95vh; display: flex; justify-content: center; align-items: center;
  background: #fff; border: 1px solid var(--bm-line); border-radius: 12px; padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
#modalImage { max-width: 100%; max-height: calc(95vh - 24px); object-fit: contain; border-radius: 8px; cursor: default; }
.modal-close-btn {
  position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--bm-line); background: #fff; color: var(--bm-ink); font-size: 20px; line-height: 1;
  display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 1;
}
.modal-close-btn:hover { background: #f3f4f6; }

@media (max-width: 768px) {
  .card .table .btn-text { display: none; }
  .card .table .action-buttons { flex-direction: column; }
}
/* Таблица-список «в карточки»: у каждой <td> — data-label (подпись). bm-stack-head — ячейка в шапке карточки
   без подписи (имя), bm-stack-aside — узкая ячейка рядом с ней (превью, галочка), bm-stack-actions — действия
   внизу без подписи; кнопки — с подписями в ряд. Ячейки без data-label (строка «пусто») — как есть.
   Значение ячейки — один элемент (обёртка <span>), иначе части разъедутся по краям.
   <table class="bm-stack"> — карточки на телефоне (< 768px);
   <table class="bm-stack bm-stack-tablet"> — ещё и на узком планшете (768–899px, рядом боковое меню),
   полная таблица — с 900px. Правила одни и те же, различаются только диапазон и класс. */
@media (max-width: 767.98px) {
  table:is(.bm-stack, .bm-stack-tablet), table:is(.bm-stack, .bm-stack-tablet) > tbody { display: block; width: 100%; }
  table:is(.bm-stack, .bm-stack-tablet) > thead { display: none; }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr {
    display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; padding: 10px 14px;
    border-bottom: 1px solid var(--bm-line);
  }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr:last-child { border-bottom: 0; }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td { display: block; width: auto; max-width: none; border: 0; padding: 0; min-width: 0; box-shadow: none; }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td[data-label] {
    display: flex; flex: 1 1 100%; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 4px 0; text-align: right; overflow-wrap: anywhere;
  }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td[data-label]::before {
    content: attr(data-label); flex-shrink: 0; max-width: 45%; color: var(--bm-muted); font-size: 12px; text-align: left;
  }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td[colspan] { flex: 1 1 100%; }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td.bm-stack-head { display: block; flex: 1 1 0; order: -1; padding: 0 0 6px; text-align: left; }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td.bm-stack-aside { display: block; flex: 0 0 auto; order: -2; padding: 0 0 6px; }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td.bm-stack-actions {
    order: 99; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding-top: 6px;
  }
  table:is(.bm-stack, .bm-stack-tablet) > tbody > tr > td:is(.bm-stack-head, .bm-stack-aside, .bm-stack-actions)::before { content: none; }
  .card .table:is(.bm-stack, .bm-stack-tablet) .btn-text { display: inline; }
  .card .table:is(.bm-stack, .bm-stack-tablet) .action-buttons { flex-direction: row; }
}
@media (min-width: 768px) and (max-width: 899.98px) {
  table.bm-stack-tablet, table.bm-stack-tablet > tbody { display: block; width: 100%; }
  table.bm-stack-tablet > thead { display: none; }
  table.bm-stack-tablet > tbody > tr {
    display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; padding: 10px 14px;
    border-bottom: 1px solid var(--bm-line);
  }
  table.bm-stack-tablet > tbody > tr:last-child { border-bottom: 0; }
  table.bm-stack-tablet > tbody > tr > td { display: block; width: auto; max-width: none; border: 0; padding: 0; min-width: 0; box-shadow: none; }
  table.bm-stack-tablet > tbody > tr > td[data-label] {
    display: flex; flex: 1 1 100%; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 4px 0; text-align: right; overflow-wrap: anywhere;
  }
  table.bm-stack-tablet > tbody > tr > td[data-label]::before {
    content: attr(data-label); flex-shrink: 0; max-width: 45%; color: var(--bm-muted); font-size: 12px; text-align: left;
  }
  table.bm-stack-tablet > tbody > tr > td[colspan] { flex: 1 1 100%; }
  table.bm-stack-tablet > tbody > tr > td.bm-stack-head { display: block; flex: 1 1 0; order: -1; padding: 0 0 6px; text-align: left; }
  table.bm-stack-tablet > tbody > tr > td.bm-stack-aside { display: block; flex: 0 0 auto; order: -2; padding: 0 0 6px; }
  table.bm-stack-tablet > tbody > tr > td.bm-stack-actions {
    order: 99; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding-top: 6px;
  }
  table.bm-stack-tablet > tbody > tr > td:is(.bm-stack-head, .bm-stack-aside, .bm-stack-actions)::before { content: none; }
  .card .table.bm-stack-tablet .btn-text { display: inline; }
  .card .table.bm-stack-tablet .action-buttons { flex-direction: row; }
}

/* «Медиатека» */
.bm-upload-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px;
  background: var(--bm-card); border: 1px dashed #d0d0d0; border-radius: 12px;
}
.bm-upload-title { max-width: 320px; overflow-wrap: anywhere; }
.bm-drop-overlay {
  position: fixed; inset: 0; z-index: 1065; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(250, 250, 250, .85); pointer-events: none;
}
.bm-drop-overlay[hidden] { display: none; }
.bm-drop-box {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(480px, 100%); padding: 40px 24px;
  background: var(--bm-warn-halo); border: 2px dashed var(--bm-accent); border-radius: 16px; text-align: center;
}
.bm-drop-box i { font-size: 2.4rem; color: var(--bm-ink); }
@media (min-width: 900px) { /* ширины колонок — только у таблицы; уже 900px строки — карточки (.bm-stack-tablet) */
  .bm-media-table .bm-col-preview { width: 1%; padding-right: 0; }
  .bm-media-table .bm-col-file { width: 100%; min-width: 0; }
  .bm-media-table .bm-col-partner { min-width: 150px; max-width: 240px; overflow-wrap: break-word; }
  .bm-media-table .bm-col-date, .bm-media-table .bm-col-menu { white-space: nowrap; }
  .bm-media-table .bm-col-menu { width: 1%; text-align: right; }
}
.bm-media-table th { font-size: 12px; font-weight: 600; color: var(--bm-muted); white-space: nowrap; }
.preview-container.bm-thumb { width: 64px; height: 48px; border-radius: 8px; }
.preview-container.bm-thumb.is-empty { cursor: default; }
.bm-thumb > i { font-size: 1.3rem; color: var(--bm-muted); }
.bm-thumb .no-preview { padding: 2px; font-size: 10px; line-height: 1.15; text-align: center; }
.bm-file-name { font-weight: 600; color: var(--bm-ink); overflow-wrap: anywhere; }
.bm-file-info { margin-top: 2px; font-size: 12px; color: var(--bm-muted); overflow-wrap: anywhere; }
.bm-partner-unset { --bs-warning-rgb: 180, 83, 9; font-weight: 600; white-space: nowrap; }
.bm-menu-btn { padding: 2px 8px; line-height: 1.2; }
.bm-media-table .dropdown-item { display: flex; align-items: center; gap: 8px; }
.bm-details { --bs-table-bg: transparent; }
.bm-details th { width: 1%; padding-right: 16px; font-weight: 500; color: var(--bm-muted); white-space: nowrap; }
.bm-details td { overflow-wrap: anywhere; }
.bm-details .bm-hash { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.bm-partner-select { flex: 1 1 220px; width: auto; min-width: 0; }
.bm-raw summary { cursor: pointer; color: var(--bm-muted); }
.bm-raw summary:hover { color: var(--bm-ink); }


/* Устройства */
.bm-chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.bm-chip .bm-dot { margin-right: 0; }
.bm-devices th { padding: 10px 14px; border-bottom: 1px solid var(--bm-line); }
.bm-devices td { padding: 12px 14px; vertical-align: middle; }
.bm-devices .bm-sort { color: inherit; text-decoration: none; }
.bm-devices .bm-sort:hover { text-decoration: underline; }
.bm-dev-name { font-weight: 700; color: var(--bm-ink); text-decoration: none; }
.bm-dev-name:hover { color: var(--bm-ink); text-decoration: underline; }
.bm-row-off > td { opacity: .6; }
.bm-row-off > td:last-child { opacity: 1; }
@media (min-width: 768px) { .bm-dev-version { white-space: nowrap; } }
.bm-edit-row > td { background: #fafafa; }
.bm-edit-row[hidden] { display: none; }
.bm-devices tr:last-child > td { border-bottom: 0; }

/* Система и пользователи */
.bm-badge-ok { background: var(--bm-ok-halo); color: #166534; border: 1px solid var(--bm-ok); font-weight: 500; }
.bm-badge-err { background: var(--bm-err-halo); color: var(--bm-err); border: 1px solid var(--bm-err); font-weight: 500; }
.bm-badge-warn { background: var(--bm-warn-halo); color: #92400e; border: 1px solid var(--bm-accent); font-weight: 500; }
.bm-card-head { background: transparent; font-weight: 700; }
.bm-narrow { max-width: 420px; }
.bm-check-list { max-height: 320px; overflow-y: auto; }
.bm-log-box { max-height: 400px; overflow-y: auto; background: #f9fafb; }
.bm-log-text {
  white-space: pre-wrap; word-wrap: break-word; font-size: .9rem; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  background: transparent; padding: 0; line-height: 1.4;
}
.log-error { color: var(--bm-err); font-weight: 500; }
.log-warning { color: #b45309; font-weight: 500; }
.log-info, .log-default { color: var(--bm-muted); }
.log-debug { color: #1d4ed8; font-weight: 500; }
code { color: #374151; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; word-break: break-all; }

/* Выбор партнёра у файла в медиатеке */
.partner-select { min-width: 11rem; }

/* Аналитика */
.bm-filters .form-label { font-size: 12px; color: var(--bm-muted); margin-bottom: 2px; }
.bm-chart { overflow-x: auto; }
.bm-chart svg { display: block; min-width: 560px; width: 100%; height: auto; }
.bm-chart .bar { fill: var(--bm-accent); }
.bm-chart .bar:hover { fill: var(--bm-accent-dark); }
.bm-chart .axis { stroke: var(--bm-line); }
.bm-chart text { font-size: 11px; fill: var(--bm-muted); }
.bm-stat b { display: block; font-size: 22px; }

/* Выбор файлов плитками (_media_picker.html) */
.bm-picker-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.bm-picker-tools [data-picker-search], .bm-picker-tools [data-device-search] { flex: 1 1 200px; min-width: 0; }
.bm-picker-drop { min-height: 84px; margin-bottom: 12px; }
.bm-picker-uploads:not(:empty) { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.bm-upload-row { padding: 6px 10px; border: 1px solid var(--bm-line); border-radius: 8px; background: var(--bm-bg); }
.bm-upload-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; min-width: 0; }
.bm-upload-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bm-upload-status { color: var(--bm-muted); flex-shrink: 0; max-width: 60%; text-align: right; }
.bm-upload-row .bm-upload-progress { width: 100%; height: 4px; margin: 6px 0 0; }
.bm-upload-row.is-done .bm-upload-status { color: #166534; }
.bm-upload-row.is-error { border-color: var(--bm-err); background: var(--bm-err-halo); }
.bm-upload-row.is-error .bm-upload-status { color: var(--bm-err); }
.bm-upload-row.is-error .progress-fill { background: var(--bm-err); }
.bm-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.bm-tile {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 8px;
  background: var(--bm-card); border: 2px solid var(--bm-line); border-radius: 12px; cursor: pointer;
  transition: border-color .15s;
}
.bm-tile:hover { border-color: var(--bm-accent-hover); }
.bm-tile.is-checked { border-color: var(--bm-accent); background: var(--bm-warn-halo); }
.bm-tile.is-in-group { cursor: default; opacity: .65; }
.bm-tile.is-in-group:hover { border-color: var(--bm-line); }
.bm-tile-check { position: absolute; top: 14px; left: 14px; z-index: 1; margin: 0; width: 1.2em; height: 1.2em; }
.bm-tile-thumb {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden;
  background: #f3f4f6; border-radius: 8px;
}
.bm-tile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bm-tile-thumb i { font-size: 2rem; color: var(--bm-muted); }
.bm-tile-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-tile-info { font-size: 12px; line-height: 1.35; color: var(--bm-muted); overflow-wrap: anywhere; }
.bm-tile-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.bm-badge-in { background: var(--bm-warn-halo); color: #92400e; border: 1px solid var(--bm-accent); font-weight: 500; }
@media (max-width: 575.98px) {
  .bm-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (min-width: 992px) {
  .bm-side-panel { position: sticky; top: 16px; }
}

/* Общее расписание на странице группы */
.bm-check-cell { width: 1%; white-space: nowrap; }
tr.bm-row-checked, .bm-row-checked > td { background: var(--bm-warn-halo); } /* tr — для карточек: у строки-flex отступы */
.bm-select-all-bar { display: none; }
@media (max-width: 899.98px) { /* карточки (.bm-stack-tablet): галочка «Отметить все» из шапки таблицы — строкой сверху */
  .bm-select-all-bar {
    display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--bm-line);
  }
  .bm-select-all-bar .form-check-input { float: none; margin: 0; }
}
@media (min-width: 900px) { /* ширины колонок — только у таблицы; уже 900px строки — карточки (.bm-stack-tablet) */
  .bm-group-table .bm-col-file { width: 100%; min-width: 100px; }
}
@media (min-width: 900px) and (max-width: 1199.98px) { /* узкий ПК: без подписей на кнопках, «Без ограничений» в две строки */
  .bm-group-table .btn-text { display: none; }
  .bm-group-table .action-buttons { flex-direction: column; }
  .bm-group-table .bm-badge { white-space: normal; text-align: left; }
  .bm-group-table .preview-container { width: 48px; height: 48px; border-radius: 8px; }
  .bm-group-table .no-preview { display: block; width: 48px; font-size: 10px; line-height: 1.15; text-align: center; }
  .bm-group-table td[data-label="Превью"] { width: 1%; }
  .bm-group-table > thead > tr > th, .bm-group-table > tbody > tr > td { padding-inline: 4px; }
}
@media (min-width: 1200px) {
  .bm-group-table .bm-col-nowrap { white-space: nowrap; }
}
.bm-bulk-open { border-color: var(--bm-accent-dark); }
.bm-offcanvas { --bs-offcanvas-width: min(420px, 100vw); }

/* Мастер «Новая группа» (content_group_wizard.html) */
.bm-wizard-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 12px; padding: 0; }
.bm-wizard-steps li { flex: 1 1 0; min-width: 0; }
.bm-wizard-step {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 8px 10px;
  background: var(--bm-card); border: 1px solid var(--bm-line); border-radius: 10px; color: var(--bm-ink);
  font-weight: 600; text-align: left;
}
.bm-wizard-step:disabled { color: var(--bm-muted); cursor: default; }
.bm-wizard-step:not(:disabled):hover { border-color: var(--bm-accent-hover); }
.bm-wizard-step.is-current { border-color: var(--bm-accent); background: var(--bm-warn-halo); }
.bm-wizard-num {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 24px; height: 24px;
  border-radius: 50%; background: var(--bm-side); font-size: 12px;
}
.bm-wizard-step.is-current .bm-wizard-num, .bm-wizard-step.is-done .bm-wizard-num { background: var(--bm-accent); color: #111111; }
.bm-wizard-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-wizard-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.bm-device-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.bm-device-row {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; min-width: 0;
  border: 1px solid var(--bm-line); border-radius: 10px; cursor: pointer;
}
.bm-device-row:hover { border-color: var(--bm-accent-hover); }
.bm-device-row.is-checked { border-color: var(--bm-accent); background: var(--bm-warn-halo); }
.bm-device-row .form-check-input { flex-shrink: 0; margin: 0; }
.bm-device-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.bm-device-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-device-group { flex-shrink: 0; max-width: 45%; color: var(--bm-muted); text-align: right; overflow-wrap: anywhere; }
.bm-device-group.is-moving { color: #92400e; }
.bm-wizard-summary { padding: 12px; border: 1px dashed var(--bm-accent); border-radius: 10px; background: var(--bm-bg); }
.bm-wizard-summary dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; }
.bm-wizard-summary dt { font-weight: 500; color: var(--bm-muted); }
.bm-wizard-summary dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
  .bm-wizard-title { display: none; }
  .bm-wizard-step { justify-content: center; }
  .bm-wizard-step.is-current .bm-wizard-title { display: inline; }
  .bm-wizard-steps li:has(.is-current) { flex: 2 1 0; }
  .bm-device-row { flex-wrap: wrap; }
  .bm-device-group { max-width: none; flex-basis: 100%; padding-left: 26px; text-align: left; }
}

/* «Все уведомления» */
.bm-ev-list { display: flex; flex-direction: column; gap: 8px; }
.bm-ev-row {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 14px;
  background: var(--bm-card); border: 1px solid var(--bm-line); border-left: 4px solid var(--bm-muted); border-radius: 10px;
}
.bm-ev-main { min-width: 0; overflow-wrap: anywhere; }
.bm-ev-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.bm-ev-level { font-weight: 700; }
.bm-ev-title { font-weight: 600; }
.bm-ev-time { font-size: 13px; }
.bm-ev-ack { flex-shrink: 0; }
.bm-ev-critical { border-left-color: var(--bm-err); }
.bm-ev-critical .bm-ev-level { color: var(--bm-err); }
.bm-ev-warning { border-left-color: var(--bm-warn); }
.bm-ev-warning .bm-ev-level { color: var(--bm-accent-dark); }
@media (max-width: 576px) {
  .bm-ev-row { flex-direction: column; }
}

/* Главная — сводка: быстрые действия и карточки состояния (верхняя полоса — тон: ok / warn / err) */
.bm-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.bm-dash { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.bm-dash-card {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 14px 16px 16px;
  background: var(--bm-card); border: 1px solid var(--bm-line); border-top: 4px solid var(--bm-line); border-radius: 12px;
}
.bm-dash-card.is-ok { border-top-color: var(--bm-ok); }
.bm-dash-card.is-warn { border-top-color: var(--bm-warn); }
.bm-dash-card.is-err { border-top-color: var(--bm-err); }
.bm-dash-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--bm-ink); text-decoration: none; }
.bm-dash-head > .bi:first-child { font-size: 18px; }
.bm-dash-head:hover { color: var(--bm-accent-dark); }
.bm-dash-go { margin-left: auto; color: var(--bm-muted); font-size: 13px; }
.bm-dash-sum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.bm-dash-value { font-size: 32px; font-weight: 700; line-height: 1; color: var(--bm-ink); font-variant-numeric: tabular-nums; }
.bm-dash-caption { color: var(--bm-muted); font-size: 13px; }
.bm-dash-state { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; font-weight: 600; }
.is-ok > .bm-dash-state { color: #166534; }
.is-warn > .bm-dash-state { color: #92400e; }
.is-err > .bm-dash-state { color: var(--bm-err); }
.bm-dash-conn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bm-dash-chip {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px; font-size: 13px;
  color: inherit; text-decoration: none; border: 1px solid var(--bm-line); border-radius: 10px;
}
.bm-dash-chip .bm-dot { flex-shrink: 0; margin: 0 2px 0 0; }
.bm-dash-chip b { font-size: 16px; }
.bm-dash-chip:hover { color: inherit; border-color: var(--bm-accent); }
.bm-dash-chip.is-zero { color: var(--bm-muted); }
.bm-dash-chip.is-zero .bm-dot { box-shadow: none; opacity: .5; }
.bm-dash-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.bm-dash-ev {
  display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; color: inherit; text-decoration: none;
  background: var(--bm-bg); border-left: 3px solid var(--bm-line); border-radius: 6px; overflow-wrap: anywhere;
}
.bm-dash-ev.bm-level-critical { border-left-color: var(--bm-err); }
.bm-dash-ev.bm-level-warning { border-left-color: var(--bm-warn); }
.bm-dash-ev.bm-level-info { border-left-color: var(--bm-muted); }
.bm-dash-ev:hover { color: inherit; background: var(--bm-warn-halo); }
.bm-dash-ev.is-acked { opacity: .65; }
.bm-dash-ev-title { font-weight: 600; }
.bm-dash-ev-text { font-size: 13px; }
.bm-dash-rows { display: flex; flex-direction: column; }
.bm-dash-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 12px; padding: 7px 0;
  color: inherit; text-decoration: none; border-top: 1px solid var(--bm-line);
}
.bm-dash-row:first-child { border-top: 0; padding-top: 0; }
.bm-dash-row:hover .bm-dash-row-file { color: var(--bs-link-hover-color); }
.bm-dash-row-file { font-weight: 600; overflow-wrap: anywhere; }
.bm-dash-row-date { font-weight: 600; color: #92400e; white-space: nowrap; }
.bm-dash-row-group { grid-column: 1 / -1; font-size: 12px; color: var(--bm-muted); overflow-wrap: anywhere; }
.bm-dash-bar { display: block; width: 100%; height: 8px; border: 0; border-radius: 4px; background: #f3f4f6; appearance: none; overflow: hidden; }
.bm-dash-bar::-webkit-progress-bar { background: #f3f4f6; border-radius: 4px; }
.bm-dash-bar::-webkit-progress-value { background: #9ca3af; border-radius: 4px; }
.bm-dash-bar::-moz-progress-bar { background: #9ca3af; border-radius: 4px; }
.is-err > .bm-dash-bar::-webkit-progress-value { background: var(--bm-err); }
.is-err > .bm-dash-bar::-moz-progress-bar { background: var(--bm-err); }
