/* ─── DKS Manager - Dark Dashboard Theme v2 ─── */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #0f1923;
    --sidebar-hover: #1a2d3d;
    --sidebar-active: #1e3a5f;
    --topbar-bg: #131d28;
    --content-bg: #0b131e;
    --card-bg: #141e2b;
    --card-border: #1e2d3d;
    --text-primary: #e8edf2;
    --text-secondary: #8899aa;
    --text-muted: #5a6a7a;
    --accent: #2d7dd2;
    --accent-light: #4a9eff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--content-bg); }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Sidebar ─── */
.sidebar {
    position: fixed; top: 0; left: 0; width: var(--sidebar-width); height: 100vh;
    background: var(--sidebar-bg); display: flex; flex-direction: column;
    z-index: 100; border-right: 1px solid var(--card-border);
}
.sidebar-header {
    padding: 20px; display: flex; align-items: center; gap: 12px;
    font-size: 20px; font-weight: 700; color: var(--text-primary);
    border-bottom: 1px solid var(--card-border); letter-spacing: -0.5px;
}
.sidebar-header i { font-size: 28px; color: var(--accent-light); }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    border-radius: 8px; color: var(--text-secondary); text-decoration: none;
    font-size: 14px; font-weight: 500; transition: all 0.15s ease;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.nav-item.active { background: var(--sidebar-active); color: var(--accent-light); }
.nav-item i { font-size: 18px; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--card-border); color: var(--text-muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }

/* ─── Main Content ─── */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; }
.top-bar {
    background: rgba(19,29,40,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 14px 28px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--card-border); position: sticky; top: 0; z-index: 50;
}
.top-bar-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.top-bar-info { display: flex; align-items: center; gap: 16px; color: var(--text-secondary); font-size: 13px; }
#server-status i { font-size: 8px; margin-right: 4px; vertical-align: middle; }
.content-container { padding: 24px 28px; }

/* ─── Summary Cards (Dashboard) ─── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    cursor: default;
}
.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    border-color: rgba(255,255,255,0.08);
}
.summary-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
}
.summary-card.online::after { background: linear-gradient(90deg, #22c55e, #4ade80); }
.summary-card.offline::after { background: linear-gradient(90deg, #ef4444, #f87171); }
.summary-card.backup::after { background: linear-gradient(90deg, #2d7dd2, #60a5fa); }
.summary-card.event::after { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.summary-icon {
    width: 52px; height: 52px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
}
.summary-icon.green { background: rgba(34,197,94,0.12); color: #22c55e; }
.summary-icon.red { background: rgba(239,68,68,0.12); color: #ef4444; }
.summary-icon.blue { background: rgba(45,125,210,0.12); color: #60a5fa; }
.summary-icon.amber { background: rgba(245,158,11,0.12); color: #fbbf24; }

.summary-body { flex: 1; min-width: 0; }
.summary-value { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -0.5px; }
.summary-label { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.summary-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ─── Type Summary Blocks ─── */
.type-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.type-block {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}
.type-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.type-block-left { display: flex; align-items: center; gap: 16px; }
.type-block-icon { font-size: 28px; }
.type-block-title { font-size: 15px; font-weight: 600; }
.type-block-counts { display: flex; gap: 20px; }
.type-block-count { text-align: center; }
.type-block-count .num { font-size: 20px; font-weight: 700; }
.type-block-count .lbl { font-size: 11px; color: var(--text-muted); }
.type-block-count .num.green { color: #22c55e; }
.type-block-count .num.red { color: #ef4444; }

/* ─── Cards ─── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-primary);
}
.card-body { padding: 20px; }

/* ─── Snapshot (16:9) ─── */
.snapshot-card .card-body { padding: 0; }
.snapshot-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #080e16;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0 0 12px 12px;
}
.snapshot-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}
.snapshot-placeholder {
    text-align: center;
    color: var(--text-muted);
}
.snapshot-placeholder i {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.35;
}
.snapshot-placeholder span {
    font-size: 13px;
    opacity: 0.5;
}

/* ─── Audio Panel (YouTube-style) ─── */
.audio-panel {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #0a111c;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-radius: 0 0 12px 12px;
}
.audio-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s;
    flex-shrink: 0;
    font-size: 20px;
    padding: 0;
}
.audio-btn:hover { color: var(--text-primary); }
.audio-btn.active { color: var(--accent-light); }

.volume-slider-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    width: 0;
    overflow: hidden;
    transition: width 0.2s ease, margin 0.2s ease;
    margin: 0;
}
.audio-panel:hover .volume-slider-wrap,
.volume-slider-wrap:hover {
    width: 100px;
    margin-left: 6px;
}
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.15);
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
}
.volume-slider::-webkit-slider-thumb:hover { transform: scale(1.3); }
.volume-slider::-moz-range-thumb {
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; border: none; cursor: pointer;
}
.volume-slider::-moz-range-track {
    height: 3px; border-radius: 2px;
    background: rgba(255,255,255,0.15);
}
.volume-label {
    color: var(--text-muted);
    font-size: 11px;
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    margin-left: 6px;
    flex-shrink: 0;
}

/* ─── Tables ─── */
.table { color: var(--text-primary); margin-bottom: 0; }
.table thead th {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
}
.table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    vertical-align: middle;
}
.table tr:hover { background: rgba(255, 255, 255, 0.02); }
.dataTables_wrapper .dataTables_filter input {
    background: var(--sidebar-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 12px;
}
.dataTables_wrapper .dataTables_length select {
    background: var(--sidebar-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 4px 8px;
}

/* ─── Status Badges ─── */
.badge-online, .badge-offline {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge-online { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-offline { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-online i, .badge-offline i { font-size: 8px; }

/* ─── Search Bar ─── */
.search-bar { position: relative; }
.search-bar-input {
    padding-left: 42px !important;
    height: 48px;
    font-size: 15px;
    border-radius: 10px;
    background: var(--sidebar-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-bar-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45, 125, 210, 0.15);
    background: var(--sidebar-bg);
    color: var(--text-primary);
}
.search-bar-input::placeholder { color: var(--text-muted); font-size: 14px; }
.search-bar-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 18px; z-index: 5; pointer-events: none;
}
.search-bar-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted);
    font-size: 12px; padding: 4px 8px; cursor: pointer; z-index: 5; border-radius: 4px;
}
.search-bar-clear:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }
.dataTables_filter { display: none !important; }

/* ─── Forms ─── */
.form-control, .form-select {
    background: var(--sidebar-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 8px 14px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45, 125, 210, 0.2);
    background: var(--sidebar-bg);
    color: var(--text-primary);
}
.form-label { color: var(--text-secondary); font-size: 13px; font-weight: 500; margin-bottom: 6px; }

/* ─── Buttons ─── */
.btn { border-radius: 8px; font-weight: 500; padding: 8px 16px; font-size: 14px; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn-outline-secondary { border-color: var(--card-border); color: var(--text-secondary); }
.btn-outline-secondary:hover { background: var(--sidebar-hover); border-color: var(--card-border); color: var(--text-primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); }

/* ─── Modal ─── */
.modal-content { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; }
.modal-header { border-bottom: 1px solid var(--card-border); }
.modal-footer { border-top: 1px solid var(--card-border); }

/* ─── Toggles ─── */
.form-switch .form-check-input { width: 44px; height: 22px; background-color: var(--text-muted); border-color: var(--card-border); cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* ─── Misc ─── */
.spinning { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.backup-success { color: var(--success); }
.backup-partial { color: var(--warning); }
.backup-failed { color: var(--danger); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header span, .sidebar-nav span, .sidebar-footer span { display: none; }
    .sidebar-header { justify-content: center; padding: 16px; }
    .main-content { margin-left: 60px; }
    .content-container { padding: 16px; }
    .type-summary { grid-template-columns: 1fr; }
}


/* ─── Светлая тема ───
   Переключатель — иконка солнца/луны в верхней панели.
   Выбор сохраняется в localStorage и применяется до отрисовки (без мигания). */

html[data-bs-theme="light"] {
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f1f5f9;
    --sidebar-active: #2563eb;
    --topbar-bg: rgba(248, 250, 252, 0.85);
    --content-bg: #eef2f7;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-light: #2563eb;
    --success: #15803d;
    --warning: #b45309;
    --danger: #dc2626;
    --chart-grid: rgba(100, 116, 139, 0.14);
    --chart-ticks: #64748b;
    --chart-online: #16a34a;
    --chart-offline: #dc2626;
}
:root { --chart-grid: rgba(255, 255, 255, 0.04); --chart-ticks: #5a6a7a; --chart-online: #22c55e; --chart-offline: #ef4444; }

/* Фон страницы: мягкий вертикальный градиент вместо плоской заливки */
html[data-bs-theme="light"] body {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 60%, #e8edf4 100%);
    background-attachment: fixed;
}

/* Сайдбар: белый «лист» с активным пунктом-градиентом */
html[data-bs-theme="light"] .sidebar {
    box-shadow: 1px 0 0 #e2e8f0, 4px 0 24px -18px rgba(15, 42, 80, 0.25);
}
html[data-bs-theme="light"] .sidebar-header { border-bottom-color: #eef2f7; letter-spacing: -0.3px; }
html[data-bs-theme="light"] .sidebar-footer { border-top-color: #eef2f7; }
html[data-bs-theme="light"] .nav-item:hover { background: #f1f5f9; color: #0f172a; }
html[data-bs-theme="light"] .nav-item.active {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
html[data-bs-theme="light"] .nav-item.active i { color: #ffffff; }

/* Верхняя панель: матовое стекло */
html[data-bs-theme="light"] .top-bar {
    background: var(--topbar-bg);
    border-bottom-color: #e2e8f0;
}

/* Карточки: белый лист с двухслойной тенью, подъём при наведении */
html[data-bs-theme="light"] .summary-card,
html[data-bs-theme="light"] .card,
html[data-bs-theme="light"] .type-block {
    box-shadow: 0 1px 2px rgba(15, 42, 80, 0.04), 0 12px 32px -16px rgba(15, 42, 80, 0.16);
    border-color: var(--card-border);
}
html[data-bs-theme="light"] .summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 2px 4px rgba(15, 42, 80, 0.05), 0 20px 44px -18px rgba(15, 42, 80, 0.28);
    border-color: #d3dce8;
}
html[data-bs-theme="light"] .type-block:hover {
    box-shadow: 0 1px 2px rgba(15, 42, 80, 0.05), 0 16px 36px -18px rgba(15, 42, 80, 0.24);
}

/* Иконки в сводке: сочнее и глубже */
html[data-bs-theme="light"] .summary-icon.green { background: rgba(22, 163, 74, 0.13); color: #16a34a; }
html[data-bs-theme="light"] .summary-icon.red { background: rgba(220, 38, 38, 0.11); color: #dc2626; }
html[data-bs-theme="light"] .summary-icon.blue { background: rgba(37, 99, 235, 0.11); color: #2563eb; }
html[data-bs-theme="light"] .summary-icon.amber { background: rgba(217, 119, 6, 0.13); color: #d97706; }
html[data-bs-theme="light"] .type-block-count .num.green { color: #16a34a; }
html[data-bs-theme="light"] .type-block-count .num.red { color: #dc2626; }

/* Таблицы: на светлом видимые разделители строк и фон заголовка */
html[data-bs-theme="light"] .table thead th {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
}
html[data-bs-theme="light"] .table td { border-bottom: 1px solid #eef2f7; }
html[data-bs-theme="light"] .table tbody tr:hover { background: #f8fafc; }
html[data-bs-theme="light"] .table-striped tbody tr:nth-of-type(odd) { background-color: rgba(248, 250, 252, 0.6); }

/* Инпуты/поиск/селекты: сланцевые, с аккуратным фокусом */
html[data-bs-theme="light"] .form-control,
html[data-bs-theme="light"] .form-select,
html[data-bs-theme="light"] .search-bar-input,
html[data-bs-theme="light"] .dataTables_wrapper .dataTables_filter input,
html[data-bs-theme="light"] .dataTables_wrapper .dataTables_length select {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #0f172a;
}
html[data-bs-theme="light"] .form-control:focus,
html[data-bs-theme="light"] .form-select:focus,
html[data-bs-theme="light"] .search-bar-input:focus {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    color: #0f172a;
}
html[data-bs-theme="light"] .search-bar-clear:hover { background: rgba(15, 23, 42, 0.06); color: #0f172a; }

/* Кнопки: главная — с градиентом и цветной тенью */
html[data-bs-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.30);
}
html[data-bs-theme="light"] .btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.40);
}
html[data-bs-theme="light"] .btn-outline-secondary { border-color: #e2e8f0; color: #475569; }
html[data-bs-theme="light"] .btn-outline-secondary:hover { background: #f1f5f9; border-color: #e2e8f0; color: #0f172a; }

/* Статус-бейджи: плотнее фон, глубже текст */
html[data-bs-theme="light"] .badge-online { background: rgba(22, 163, 74, 0.12); color: #15803d; }
html[data-bs-theme="light"] .badge-offline { background: rgba(220, 38, 38, 0.10); color: #b91c1c; }

/* Модалки и скроллбары */
html[data-bs-theme="light"] .modal-content { box-shadow: 0 24px 64px -16px rgba(15, 42, 80, 0.35); }
html[data-bs-theme="light"] ::-webkit-scrollbar-track { background: #eef2f7; }
html[data-bs-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
html[data-bs-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Видеоплеер и снапшот остаются тёмными — так кадры смотрятся лучше */

/* Кнопка переключателя темы */
.theme-toggle {
    background: transparent; border: 1px solid var(--card-border);
    color: var(--text-secondary); width: 34px; height: 34px;
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s ease; font-size: 16px; line-height: 1;
}
.theme-toggle:hover { color: var(--accent-light); border-color: var(--accent-light); transform: rotate(15deg); }

/* ─── Авторизация / пользователи ─── */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0f1923 0%, #1a2d3d 55%, #0f2440 100%);
    background-attachment: fixed;
}
html[data-bs-theme="light"] .login-body {
    background: linear-gradient(160deg, #eef2f7 0%, #dde7f3 55%, #cfe0f0 100%);
}
.login-wrap { width: 100%; max-width: 400px; padding: 24px; }
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 40px 36px 36px;
    box-shadow: 0 24px 64px -24px rgba(0, 0, 0, 0.45);
}
html[data-bs-theme="light"] .login-card {
    box-shadow: 0 24px 64px -24px rgba(15, 42, 80, 0.35);
}
.login-logo {
    width: 64px; height: 64px; margin: 0 auto 16px;
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.55);
}
.login-title { text-align: center; font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.3px; }
.login-sub { text-align: center; font-size: 13px; color: var(--text-secondary); margin: 4px 0 24px; }
.login-btn { padding: 11px 16px; }

.user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text-secondary); text-decoration: none; font-size: 13px;
    padding: 4px 10px; border-radius: 20px; border: 1px solid transparent;
    transition: all 0.15s ease; max-width: 260px;
}
.user-chip:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.user-chip > i { font-size: 18px; }
.user-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }

.role-badge {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.role-badge.role-admin { background: rgba(37, 99, 235, 0.14); color: #2563eb; }
.role-badge.role-operator { background: rgba(100, 116, 139, 0.16); color: #64748b; }
html[data-bs-theme="dark"] .role-badge.role-admin { background: rgba(74, 158, 255, 0.16); color: #60a5fa; }
html[data-bs-theme="dark"] .role-badge.role-operator { background: rgba(136, 153, 170, 0.16); color: #8899aa; }

.gen-password {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 20px; font-weight: 700; letter-spacing: 1px;
    color: var(--text-primary);
    background: var(--sidebar-hover);
    border: 1px dashed var(--card-border);
    border-radius: 10px; padding: 8px 16px;
    cursor: pointer; user-select: all;
}

.role-badge.role-coordinator { background: rgba(124, 58, 237, 0.13); color: #7c3aed; }
html[data-bs-theme="dark"] .role-badge.role-coordinator { background: rgba(167, 139, 250, 0.16); color: #a78bfa; }

/* ─── Polish v3 (ui-ux-pro-max + design-taste) ───
   Правила: контраст 4.5:1, видимый фокус-ринг, cursor-pointer,
   переходы 150–300 мс, только transform/opacity в анимациях,
   reduced-motion, единый радиус, тактильное :active. */

/* Глобальные интерактивные состояния */
button, .btn, .nav-item, .form-check-input, a:not(.text-decoration-none),
.dropdown-item, .page-link, .theme-toggle, .audio-btn, .search-bar-clear {
    cursor: pointer;
}
:where(button, a, input, select, .nav-item):focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Кнопки: физика нажатия + плавность (обе темы) */
.btn { transition: transform .16s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-sm { transition: transform .16s ease, box-shadow .18s ease, background-color .18s ease; }

/* Тёмная тема: главная кнопка — тот же градиент, что в светлой */
.btn-primary {
    background: linear-gradient(135deg, #2d7dd2 0%, #2563eb 100%);
    border: none;
    box-shadow: 0 2px 10px rgba(45, 125, 210, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4a9eff 0%, #3b82f6 100%);
    box-shadow: 0 4px 16px rgba(74, 158, 255, 0.45);
}
.btn-danger { transition: transform .16s ease, box-shadow .18s ease, background-color .18s ease; }
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35); }
.btn-success:hover { box-shadow: 0 4px 14px rgba(34, 197, 94, 0.30); }
.btn-outline-secondary:hover, .btn-outline-danger:hover { transform: translateY(-1px); }
html[data-bs-theme="light"] .btn-outline-secondary:hover { transform: none; }

/* Outline-кнопки в тёмной: мягкая заливка при hover */
.btn-outline-secondary { transition: background-color .18s ease, color .18s ease, transform .16s ease; }

/* Тумблеры: плавный ход + фокус */
.form-switch .form-check-input {
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.form-switch .form-check-input:focus-visible {
    box-shadow: 0 0 0 3px rgba(45, 125, 210, 0.35);
    outline: none;
}
html[data-bs-theme="light"] .form-switch .form-check-input:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Тумблер: «бегунок» с тактильным нажатием */
.form-switch .form-check-input:active { transform: scale(1.05); }

/* Статус-бейджи: живая точка «в сети» (только без reduced-motion) */
.badge-online i, .badge-offline i { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
    .badge-online i { animation: pulse-dot 2s ease-in-out infinite; }
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: .45; }
}

/* Сайдбар: активный пункт в тёмной — градиент + мягкая синяя тень (как в светлой) */
.nav-item { transition: background-color .18s ease, color .18s ease, transform .18s ease; }
html[data-bs-theme="dark"] .nav-item.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
html[data-bs-theme="dark"] .nav-item.active i { color: #ffffff; }
.nav-item:active { transform: translateX(1px); }

/* Таблицы: плавный hover строк */
.table tbody tr { transition: background-color .15s ease; }

/* Ссылки-IP в таблицах */
.table a { transition: color .15s ease; }

/* Модалки: чуть глубже тень в тёмной */
html[data-bs-theme="dark"] .modal-content { box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.6); }

/* Топ-бар: кнопки-иконки — единый тактильный отклик */
.theme-toggle:active { transform: scale(.92); }

/* Пагинация DataTables */
.page-link { transition: background-color .15s ease, color .15s ease; }

/* Карточки: плавная смена рамки */
.card, .summary-card, .type-block { transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease; }

/* Reduced motion: всё статичное */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ─── Restore/warning-кнопки: вместо жёлтой — инженерный графит ───
   Заливка бэкапа = серьёзная операция: спокойная тёмная кнопка с рамкой,
   жёлтый убран как дешевящий акцент (просьба владельца 06.10). */
.btn-warning {
    background: #334155;
    border: 1px solid #475569;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(51, 65, 85, 0.30);
}
.btn-warning:hover, .btn-warning:focus {
    background: #1e293b !important;
    border-color: #334155;
    color: #ffffff;
}
html[data-bs-theme="dark"] .btn-warning {
    background: #475569;
    border: 1px solid #64748b;
    color: #ffffff;
}
html[data-bs-theme="dark"] .btn-warning:hover,
html[data-bs-theme="dark"] .btn-warning:focus {
    background: #64748b !important;
    border-color: #94a3b8;
    color: #ffffff;
}
.btn-outline-warning {
    border-color: var(--card-border);
    color: var(--text-secondary);
}
.btn-outline-warning:hover {
    background: var(--sidebar-hover);
    border-color: var(--card-border);
    color: var(--text-primary);
}
