/* ── Admin / Система — единый стиль ─────────────────────────────────────── */

#adminSection {
    padding: 24px 28px 48px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}
/* Красивый скроллбар */
#adminSection::-webkit-scrollbar { width: 10px; }
#adminSection::-webkit-scrollbar-track { background: transparent; }
#adminSection::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-xs);
}
#adminSection::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Сетка верхних карточек (Сотрудники / Категории / Логи) */
#adminSection .admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

#adminSection .admin-grid .stat-card {
    text-align: left;
    padding: 14px 16px;
    transition: border-color .2s, transform .2s;
}

#adminSection .admin-grid .stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ── Карточки админки (переопределяем stat-card для крупных блоков) ────── */
#adminSection .admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    text-align: left;
    margin-bottom: 14px;
    transition: border-color .2s;
}

#adminSection .admin-card:hover {
    border-color: rgba(14, 165, 233, 0.25);
}

/* Заголовок-свёртка */
#adminSection .admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#adminSection .admin-card-header.clickable {
    cursor: pointer;
    user-select: none;
}

#adminSection .admin-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#adminSection .admin-card-title h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text);
}

#adminSection .admin-card-title .chev {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: transform .2s;
}

#adminSection .admin-card-title .chev.open {
    transform: rotate(90deg);
}

#adminSection .admin-card-title .icon-lg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

#adminSection .admin-card-subtle {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

#adminSection .admin-card-body {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

#adminSection .admin-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Метрики-панели внутри карточки ─────────────────────────────────────── */
#adminSection .admin-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
}

#adminSection .admin-panel {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

#adminSection .admin-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
}

#adminSection .admin-panel-header i {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

#adminSection .admin-panel-body {
    font-size: var(--text-sm);
    line-height: 1.7;
    color: var(--text);
}

#adminSection .admin-panel-body .row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 0;
}

#adminSection .admin-panel-body .row span.label {
    color: var(--text-muted);
}

/* ── Плашка нагрузки (в шапке system health) ────────────────────────────── */
.admin-load-badge {
    font-size: var(--text-2xs);
    padding: 3px 10px;
    border-radius: var(--radius);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.admin-load-badge.low   { background: rgba(16, 185, 129, .15); color: #10b981; }
.admin-load-badge.med   { background: rgba(245, 158, 11, .15); color: #f59e0b; }
.admin-load-badge.high  { background: rgba(239, 68, 68, .15);  color: #ef4444; }

/* Плашка «НАГРУЗКА: НИЗКАЯ/СРЕДНЯЯ/ВЫСОКАЯ» внутри блока Сервер */
#adminSection .load-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: var(--text-xs);
    font-weight: 600;
}
#adminSection .load-summary.low   { background: rgba(16, 185, 129, .10); color: #10b981; }
#adminSection .load-summary.med   { background: rgba(245, 158, 11, .10); color: #f59e0b; }
#adminSection .load-summary.high  { background: rgba(239, 68, 68, .10);  color: #ef4444; }

#adminSection .load-summary strong {
    font-size: var(--text-base);
    font-weight: 700;
    letter-spacing: .04em;
}

/* ── Прогресс-бары метрик ───────────────────────────────────────────────── */
#adminSection .metric-row {
    margin-bottom: 10px;
}
#adminSection .metric-row .metric-line {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    margin-bottom: 4px;
}
#adminSection .metric-row .metric-line .val {
    font-weight: 600;
}
#adminSection .metric-row .metric-line .sub {
    color: var(--text-muted);
    font-weight: 400;
    font-size: var(--text-2xs);
}
#adminSection .metric-bar {
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
}
#adminSection .metric-bar-fill {
    height: 100%;
    border-radius: var(--radius-xs);
    transition: width .35s ease;
}
#adminSection .metric-bar-fill.ok   { background: #10b981; }
#adminSection .metric-bar-fill.warn { background: #f59e0b; }
#adminSection .metric-bar-fill.crit { background: #ef4444; }

/* ── Дополнительная инфа под метриками ──────────────────────────────────── */
#adminSection .admin-extra {
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.7;
}

/* ── Чипы со счётчиками (Записи по таблицам, диск) ──────────────────────── */
#adminSection .admin-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: var(--text-xs);
}
#adminSection .admin-chip {
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 5px 11px;
    border-radius: var(--radius);
    color: var(--text);
    white-space: nowrap;
}
#adminSection .admin-chip strong {
    color: var(--primary);
    margin-left: 4px;
}
#adminSection .admin-chip.warn {
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .3);
    color: #f59e0b;
}

/* ── Точки-статусы ──────────────────────────────────────────────────────── */
#adminSection .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
#adminSection .dot.ok   { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,.5); }
#adminSection .dot.warn { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,.5); }
#adminSection .dot.err  { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.5); }
#adminSection .dot.off  { background: var(--text-muted); opacity: .6; }

/* ── Алерт-плашки сверху ────────────────────────────────────────────────── */
#sysAlertsBar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.admin-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1px solid transparent;
}
.admin-alert i { width: 15px; height: 15px; }
.admin-alert.error { background: rgba(239, 68, 68, .10); color: #ef4444; border-color: rgba(239, 68, 68, .25); }
.admin-alert.warn  { background: rgba(245, 158, 11, .10); color: #f59e0b; border-color: rgba(245, 158, 11, .25); }

/* ── Блок воронки ───────────────────────────────────────────────────────── */
#adminSection .funnel-row {
    margin-bottom: 8px;
    font-size: var(--text-xs);
}
#adminSection .funnel-row .funnel-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
#adminSection .funnel-row .funnel-bar {
    height: 5px;
    background: var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
}
#adminSection .funnel-row .funnel-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    transition: width .35s ease;
}
#adminSection .funnel-row .stuck {
    color: #f59e0b;
    font-weight: 600;
}

/* ── Таблицы внутри admin-card: чуть компактнее и аккуратнее ────────────── */
#adminSection .admin-card .data-table th,
#adminSection .admin-card .data-table td {
    padding: 8px 12px;
    font-size: 12.5px;
}
#adminSection .admin-card .data-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--text-2xs);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Кнопки действий в Обслуживании ─────────────────────────────────────── */
#adminSection .maint-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0 18px;
}

/* ── Details ────────────────────────────────────────────────────────────── */
#adminSection details > summary {
    cursor: pointer;
    padding: 8px 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
    user-select: none;
}
#adminSection details > summary:hover { color: var(--text); }
#adminSection details[open] > summary { color: var(--text); margin-bottom: 6px; }

/* ── Отступ над Настройками после обновления ────────────────────────────── */
#adminSection #settingsCard,
#adminSection #syncLogCard {
    margin-top: 18px;
}
#adminSection #syncLogCard { max-width: none; }

/* ── Таблица бэкапов — аккуратный action-column ─────────────────────────── */
#adminSection #backupsTableBody .btn-sm { padding: 4px 8px; }
#adminSection #backupsTableBody .btn-sm + .btn-sm { margin-left: 6px; }
