/* HostMonitor Nexus — glassmorphism overlay inspired by dark topology UIs */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    --bg-body: #121212;
    --bg-sidebar: rgba(18, 18, 20, 0.72);
    --bg-card: rgba(28, 28, 32, 0.68);
    --bg-card-hover: rgba(48, 48, 56, 0.82);
    --text-primary: #f4f5f7;
    --text-muted: #9aa3b2;
    --border-color: rgba(255, 255, 255, 0.08);
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #38bdf8;
    --glow-blue: 0 0 18px rgba(59, 130, 246, 0.45);
    --glow-green: 0 0 14px rgba(34, 197, 94, 0.5);
    --glass: rgba(22, 22, 26, 0.62);
    --glass-strong: rgba(16, 16, 18, 0.82);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #121212;
    background-image:
        radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.08), transparent 32%),
        radial-gradient(circle at 82% 88%, rgba(34, 197, 94, 0.05), transparent 28%),
        radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: auto, auto, 22px 22px;
    color: var(--text-primary);
}

body.light {
    color-scheme: light;
    --bg-sidebar: rgba(255, 255, 255, 0.78);
    --bg-card: rgba(255, 255, 255, 0.82);
    --bg-card-hover: #f4f6fa;
    --text-primary: #111827;
    --text-muted: #64748b;
    --border-color: rgba(15, 23, 42, 0.08);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-strong: rgba(255, 255, 255, 0.9);
    background-color: #e8edf5;
    background-image:
        radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.1), transparent 32%),
        radial-gradient(rgba(15, 23, 42, 0.08) 1px, transparent 1px);
    background-size: auto, 22px 22px;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

.page-loader {
    background: #121212;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader p {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.02em;
}

.loader-spinner {
    border-color: rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    box-shadow: var(--glow-blue);
}

/* ——— Top bar ——— */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 58px;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: transparent;
}

.topbar-left,
.topbar-right,
.topbar-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-center {
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 15px;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #4b90ff, #2563eb);
    box-shadow: var(--glow-blue);
    color: #fff;
}

.brand-mark i,
.brand-mark svg {
    width: 18px;
    height: 18px;
}

.view-pill,
.project-switcher,
.mode-pill,
.search-chip,
.avatar-btn {
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    color: var(--text-primary);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.view-pill i,
.project-switcher i,
.search-chip i,
.view-pill svg,
.project-switcher svg,
.search-chip svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.project-switcher {
    max-width: 420px;
    font-weight: 600;
}

.project-switcher span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-row {
    display: flex;
    gap: 8px;
    padding: 0 18px 8px 90px;
}

.mode-pill {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.mode-pill.active {
    color: #fff;
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: var(--glow-blue);
    background: rgba(59, 130, 246, 0.18);
}

.search-chip {
    min-width: 180px;
    color: var(--text-muted);
}

.search-chip input {
    border: 0;
    background: transparent;
    color: var(--text-primary);
    padding: 0;
    width: 140px;
    font-size: 13px;
}

.search-chip input:focus {
    box-shadow: none;
    background: transparent;
}

.avatar-stack {
    display: flex;
    padding-left: 8px;
}

.avatar-stack .mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #121212;
    margin-left: -8px;
    background: #2a2a32;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.avatar-stack .mini-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
    position: relative;
}

.avatar-btn .status-dot {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: var(--glow-green);
    border: 2px solid #121212;
}

/* ——— Shell ——— */
.app-shell > .container {
    flex: 1;
    min-height: 0;
    height: calc(100vh - 66px);
    padding: 0 14px 14px;
    gap: 12px;
    background: transparent;
}

.sidebar {
    width: 248px;
    background: var(--glass);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    margin: 0;
    height: auto;
    max-height: 100%;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar-toggle {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    transform: none;
    align-self: flex-end;
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(244, 245, 247, 0.5);
    box-shadow: none;
    z-index: 12;
}

.sidebar.collapsed .sidebar-toggle {
    align-self: center;
    margin: 10px auto 0;
    right: auto;
    left: auto;
    transform: none;
}

.sidebar .logo {
    display: none;
}

.menu {
    padding: 8px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.hm-collapse-btn,
.sidebar-toggle,
.hm-nav-toggle {
    box-sizing: border-box;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 8px;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(244, 245, 247, 0.48);
    cursor: pointer;
    display: grid !important;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    line-height: 0;
}

.sidebar-toggle {
    margin: 10px 10px 0 auto !important;
    border-radius: 50%;
}

.sidebar.collapsed .sidebar-toggle {
    margin: 10px auto 0 !important;
}

.hm-nav-toggle {
    align-self: flex-end;
    margin: 0 2px 8px auto !important;
}

.mk-sidebar.collapsed .hm-nav-toggle {
    align-self: center;
    margin: 0 auto 8px !important;
}

.hm-collapse-btn:hover,
.sidebar-toggle:hover,
.hm-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #fff;
    opacity: 1;
}

body.light .hm-collapse-btn,
body.light .sidebar-toggle,
body.light .hm-nav-toggle {
    color: rgba(15, 23, 42, 0.42);
}

body.light .hm-collapse-btn:hover,
body.light .sidebar-toggle:hover,
body.light .hm-nav-toggle:hover {
    background: rgba(15, 23, 42, 0.06) !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
    color: #0f172a;
}

.hm-collapse-btn svg,
.sidebar-toggle svg,
.hm-nav-toggle svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    display: block;
    stroke: currentColor;
    fill: none;
}

.hm-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.hm-panel-head h2,
.hm-panel-head h3 {
    margin: 0;
    min-width: 0;
}

.hm-collapsible.is-collapsed > :not(.hm-panel-head):not(.chart-header):not(.netmap-panel-head) {
    display: none !important;
}

.chart-card.is-collapsed {
    min-height: 0;
    resize: none;
}

.chart-card.is-collapsed canvas {
    display: none;
}

.chart-header.hm-panel-head .chart-range {
    margin-left: auto;
}

.menu a,
.menu-group-header {
    border-radius: 12px;
    padding: 10px 12px;
}

.menu a i,
.menu a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.menu a:hover,
.menu-group-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.menu a.active {
    background: rgba(59, 130, 246, 0.18);
    color: #fff;
    border-left: 0;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35), var(--glow-blue);
}

.menu-submenu {
    border-left: 1px solid rgba(59, 130, 246, 0.25);
}

.menu-submenu a.active {
    border-left: 0;
    background: rgba(59, 130, 246, 0.16);
    box-shadow: none;
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle {
    width: 100%;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border-radius: 12px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.theme-toggle:hover {
    color: #fff;
    border-color: rgba(59, 130, 246, 0.4);
}

.content {
    background: transparent;
    padding: 4px 8px 20px 4px;
}

.header {
    margin-bottom: 18px;
    align-items: center;
}

.header-title h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    padding-right: 0;
}

.header-subtitle {
    color: var(--text-muted);
}

.user-menu {
    background: var(--glass);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    backdrop-filter: blur(16px);
}

.user-avatar {
    background: linear-gradient(180deg, #4b90ff, #2563eb);
    box-shadow: var(--glow-blue);
}

.user-dropdown {
    background: var(--glass-strong);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.header-actions button,
.header-actions .primary {
    border-radius: 999px;
    height: 36px;
    padding: 0 14px;
}

/* ——— Surfaces ——— */
.stat-card,
.chart-card,
.card,
.table-container,
.page-controls,
.compact-filters,
.login-card,
.modal-dialog,
.modal-content,
.confirm-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}

.stat-card,
.chart-card,
.card {
    border-radius: var(--radius-md);
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}

.stat-card {
    padding: 16px 18px;
    position: relative;
    overflow: visible;
    min-width: 0;
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: auto -20% -40% auto;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.12);
    filter: blur(18px);
    pointer-events: none;
    z-index: 0;
}

.stat-card-icon,
.stat-card-content {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.stat-card-content {
    flex: 1;
}

.stat-card-icon {
    border-radius: 14px;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.25);
    flex: 0 0 auto;
}

.stat-card-icon i,
.stat-card-icon svg {
    width: 24px;
    height: 24px;
}

.stat-value {
    font-size: 22px;
    letter-spacing: -0.03em;
}

.stat-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-row i,
.info-row svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.chart-card,
.card {
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.card:hover,
.chart-card:hover,
.stat-card:hover {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(59, 130, 246, 0.12);
    transform: translateY(-1px);
}

.table-container {
    border-radius: var(--radius-md);
}

.table-container thead,
.table-container thead th {
    background: rgba(18, 18, 20, 0.9);
}

th, td {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

th {
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

button,
.primary,
.btn-outline,
.icon-btn {
    border-radius: 12px;
}

.primary {
    background: linear-gradient(180deg, #4d8dff, #2563eb);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.38);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}

.icon-btn:hover {
    box-shadow: var(--glow-blue);
}

input, textarea, select {
    background: rgba(0, 0, 0, 0.28);
    border-radius: 12px;
    border-color: var(--border-color);
}

input:focus, textarea:focus, select:focus {
    background: rgba(0, 0, 0, 0.38);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18), var(--glow-blue);
}

.status {
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.status.status-online {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
}

.status.status-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
}

.status.status-offline {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
}

.status.running {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
}

.status.paused,
.status.restarting {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
}

.status.stopped,
.status.exited,
.status.dead,
.status.created {
    background: rgba(148, 163, 184, 0.16);
    color: #94a3b8;
}

.pill {
    background: rgba(255, 255, 255, 0.06);
}

.tabs,
.tab-buttons {
    border-bottom-color: var(--border-color);
}

.tab-btn {
    border-radius: 12px 12px 0 0;
}

.tab-btn.active {
    color: #fff;
    box-shadow: inset 0 -2px 0 var(--accent);
}

.toast {
    background: var(--glass-strong);
    backdrop-filter: blur(18px);
    border-radius: 14px;
}

.modal,
.confirm-modal {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
}

.modal-dialog,
.modal-content,
.confirm-dialog {
    border-radius: 20px;
}

.login-container {
    background: transparent;
}

.login-card {
    border-radius: 22px;
    padding: 36px;
}

.login-card.setup-card {
    max-width: 560px;
}

.login-card .db-ha-fieldset {
    text-align: left;
    padding: 14px 16px 16px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 16px;
}

.login-card .db-ha-fieldset .db-ha-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.login-card .db-ha-fieldset textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    resize: vertical;
}

.setup-section {
    text-align: left;
    padding: 14px 14px 8px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
}

.setup-section h2,
.setup-optional summary {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.setup-optional summary {
    cursor: pointer;
    list-style: none;
    margin-bottom: 8px;
}

.setup-optional summary::-webkit-details-marker {
    display: none;
}

.setup-section h2 svg,
.setup-section h2 i,
.setup-optional summary svg,
.setup-optional summary i {
    width: 16px;
    height: 16px;
}

.setup-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.setup-check input {
    width: auto;
}

.setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.setup-grid .span-2 {
    grid-column: 1 / -1;
}

.setup-grid .form-field {
    margin-bottom: 0;
}

.setup-grid input {
    width: 100%;
}

.setup-hint {
    margin: 8px 0 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.db-ha-banner {
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.14);
    border-bottom: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    font-size: 13px;
    text-align: center;
}

.db-ha-banner a {
    color: inherit;
    text-decoration: underline;
}

.login-ok {
    background: rgba(34, 197, 94, 0.12) !important;
    border-color: rgba(34, 197, 94, 0.45) !important;
    color: #4ade80 !important;
}

@media (max-width: 640px) {
    .setup-grid {
        grid-template-columns: 1fr;
    }
    .setup-grid .span-2 {
        grid-column: auto;
    }
}

.login-logo {
    color: #fff;
}

body.light .table-container thead,
body.light .table-container thead th {
    background: rgba(255, 255, 255, 0.92);
}

.topbar .user-menu-wrapper {
    position: relative;
}

.panel-update-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Установленная версия панели рядом с кнопкой обновления. Компактно: канал
 * (ветка) уже показан select'ом, поэтому здесь только шортен коммита с полной
 * строкой в title. */
.panel-update-version {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    letter-spacing: 0.2px;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}


.panel-update-check.panel-update-pending {
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.panel-update-apply.panel-update-available {
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.12);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}

.panel-update-apply.panel-update-available:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.65);
    color: #86efac;
}

.topbar .user-dropdown {
    right: 0;
    top: calc(100% + 8px);
}

.brand span:last-child {
    white-space: nowrap;
}

.sidebar-footer .theme-toggle {
    text-align: center;
}

@media (max-width: 960px) {
    .topbar-center,
    .search-chip,
    .avatar-stack,
    .mode-row {
        display: none;
    }

    .app-shell > .container {
        height: auto;
        min-height: calc(100vh - 58px);
        flex-direction: column;
    }

    .sidebar,
    .sidebar.collapsed {
        width: 100%;
        max-height: none;
    }

    .charts {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mk-stats {
        grid-template-columns: 1fr 1fr;
    }
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, 0.5) rgba(255, 255, 255, 0.04);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 99px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.9), rgba(37, 99, 235, 0.55));
    border-radius: 99px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #60a5fa;
}

body.light * {
    scrollbar-color: rgba(37, 99, 235, 0.45) rgba(15, 23, 42, 0.06);
}

body.light *::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.05);
}

body.light *::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.form-grid .full,
.form-grid label.full {
    grid-column: 1 / -1;
}

/* ——— Unified popovers / menus / toasts ——— */
.hm-drop {
    position: relative;
    display: inline-flex;
}

.hm-drop-center {
    display: flex;
    justify-content: center;
}

.hm-menu,
.user-dropdown,
.context-menu,
.date-picker-panel,
.history-range-panel {
    min-width: 220px;
    max-width: min(360px, 92vw);
    max-height: min(70vh, 480px);
    overflow: auto;
    padding: 6px;
    z-index: 80;
    background: rgba(10, 10, 12, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    color: var(--text-muted);
}

.hm-menu,
.user-dropdown,
.date-picker-panel,
.history-range-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
}

.hm-drop-center .hm-menu {
    left: 50%;
    transform: translateX(-50%);
}

.user-menu-wrapper .hm-menu,
.user-dropdown {
    left: auto;
    right: 0;
}

.context-menu {
    position: fixed;
    top: 50%;
    left: auto;
    right: 24px;
    transform: translateY(-50%);
    padding: 8px;
    z-index: 1200;
}

.hm-menu.hidden,
.user-dropdown.hidden,
.context-menu.hidden,
.date-picker-panel.hidden,
.history-range-panel.hidden {
    display: none;
}

.hm-menu-item,
.user-dropdown-item,
.context-action-link,
.context-action-btn,
.context-menu .context-action-refresh,
.context-menu .context-action-delete,
.context-menu .context-action-enable,
.context-menu .context-action-disable,
.context-menu .context-action-edit,
.context-menu .context-power-on,
.context-menu .context-power-off {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 0;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font: 500 13px Inter, sans-serif;
    border: 0;
    background: transparent;
    box-shadow: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    opacity: 1;
}

.hm-menu-item i,
.hm-menu-item svg,
.user-dropdown-item i,
.user-dropdown-item svg,
.context-action-link i,
.context-action-link svg,
.context-action-btn i,
.context-action-btn svg {
    width: 16px;
    height: 16px;
    color: inherit;
    flex-shrink: 0;
}

.hm-menu-item:hover,
.user-dropdown-item:hover,
.context-action-link:hover,
.context-action-btn:hover,
.context-menu .context-action-refresh:hover,
.context-menu .context-action-enable:hover,
.context-menu .context-action-disable:hover,
.context-menu .context-action-edit:hover:not(:disabled),
.context-menu .context-power-on:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #fff;
    opacity: 1;
}

.hm-menu-item.active {
    background: rgba(59, 130, 246, 0.22);
    color: #fff;
}

.hm-menu-item.active i,
.hm-menu-item.active svg {
    color: #93c5fd;
}

.context-menu .context-action-delete,
.context-menu .context-action-btn.context-action-delete,
.context-menu .context-power-off {
    color: #f87171;
}

.context-menu .context-action-delete:hover,
.context-menu .context-action-btn.context-action-delete:hover,
.context-menu .context-power-off:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
    opacity: 1;
}

.context-menu button,
.hm-menu button,
.user-dropdown button {
    margin: 0;
    opacity: 1;
}

.context-action-edit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.hm-menu-label,
.context-menu-header {
    padding: 8px 12px 6px;
    margin: 0;
    border: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}

.context-menu-header {
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.context-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hm-menu-sep,
.user-dropdown-divider {
    height: 1px;
    margin: 5px 8px;
    background: rgba(255, 255, 255, 0.08);
}

.hm-select {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.page-controls .hm-select,
.compact-filters .hm-select,
.sort-control .hm-select,
.hm-select.compact-select {
    width: auto;
    min-width: 180px;
    max-width: 240px;
    flex: 0 0 auto;
}

.input-with-icon .hm-select {
    flex: 1;
    width: auto;
}

.hm-select-native {
    position: absolute !important;
    inset: 0 auto auto 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.hm-select-btn,
.hm-select-menu .hm-select-option {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    opacity: 1;
    box-shadow: none;
    font-family: Inter, system-ui, sans-serif;
}

.hm-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.page-controls .hm-select-btn,
.compact-filters .hm-select-btn,
.sort-control .hm-select-btn,
.hm-select.compact-select .hm-select-btn {
    height: 38px;
    font-size: 13px;
}

.hm-select-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
}

.hm-select-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.hm-select.is-open .hm-select-btn svg {
    transform: rotate(180deg);
    color: #93c5fd;
}

.hm-select.is-open .hm-select-btn,
.hm-select-btn:hover,
.hm-select-btn:focus {
    outline: none;
    opacity: 1;
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.hm-select.is-disabled .hm-select-btn {
    opacity: 0.55;
    cursor: not-allowed;
}

.input-with-icon .hm-select-btn {
    padding-left: 42px;
}

.hm-select-menu {
    position: fixed !important;
    top: auto;
    left: auto;
    right: auto;
    transform: none !important;
    z-index: 2600;
    min-width: 180px;
    max-width: min(420px, 92vw);
    max-height: min(70vh, 360px);
    overflow: auto;
    padding: 6px;
    background: rgba(10, 10, 12, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    color: var(--text-muted);
}

.hm-select-menu[hidden],
.hm-select-menu.hidden {
    display: none !important;
}

.hm-select-menu .hm-select-option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #9aa3b2;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.hm-select-menu .hm-select-option:hover,
.hm-select-menu .hm-select-option:focus {
    opacity: 1;
    background: rgba(59, 130, 246, 0.18);
    color: #fff;
}

.hm-select-menu .hm-select-option.active {
    background: rgba(59, 130, 246, 0.22);
    color: #fff;
}

.hm-select-menu .hm-select-option:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

select option,
select optgroup {
    background-color: #121214;
    color: #e8eaed;
}

.view-pill.active i:last-child,
.project-switcher.active i:last-child,
.user-menu.active i:last-child,
.pt-pill.active i:last-child,
.pt-pill.active svg:last-child {
    transform: rotate(180deg);
}

.confirm-dialog.hm-popover,
.confirm-dialog {
    background: rgba(10, 10, 12, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.confirm-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(245, 158, 11, 0.16);
    color: var(--warning);
}

.confirm-icon i,
.confirm-icon svg {
    width: 18px;
    height: 18px;
}

.date-picker-panel,
.history-range-panel {
    min-width: 280px;
    max-width: 420px;
    max-height: none;
    overflow: visible;
    padding: 10px;
}

.confirm-actions .btn-cancel,
.confirm-actions .btn-confirm {
    border-radius: 12px;
}

.toast-host {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

/* --- Фоновые задачи (всплывающая панель сверху) --- */
.hm-jobs-panel {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4500;
    width: min(560px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--glass-strong, rgba(18, 22, 32, 0.92));
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    display: grid;
    gap: 8px;
    animation: hm-jobs-in 0.22s ease;
}

.hm-jobs-panel.hidden {
    display: none;
}

@keyframes hm-jobs-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hm-jobs-panel.has-active {
    border-color: rgba(96, 165, 250, 0.35);
}

.hm-jobs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.hm-jobs-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.hm-jobs-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.25);
    flex-shrink: 0;
}

.hm-jobs-icon i,
.hm-jobs-icon svg {
    width: 14px;
    height: 14px;
    color: #60a5fa;
}

.hm-jobs-brand strong {
    display: block;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
}

.hm-jobs-brand small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.hm-jobs-head-actions {
    display: inline-flex;
    gap: 6px;
}

.hm-jobs-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 !important;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: pointer;
}

.hm-jobs-chip:hover {
    color: var(--text-primary);
    border-color: rgba(96, 165, 250, 0.4);
}

.hm-jobs-chip i,
.hm-jobs-chip svg {
    width: 14px;
    height: 14px;
}

.hm-jobs-list {
    display: grid;
    gap: 8px;
    max-height: min(42vh, 320px);
    overflow: auto;
}

.hm-jobs-panel.is-collapsed .hm-jobs-list {
    max-height: none;
    overflow: visible;
}

.hm-jobs-item {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

.hm-jobs-item.is-done {
    border-color: rgba(74, 222, 128, 0.35);
}

.hm-jobs-item.is-fail {
    border-color: rgba(248, 113, 113, 0.4);
}

.hm-jobs-item-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

.hm-jobs-item-top > i,
.hm-jobs-item-top > svg {
    width: 15px;
    height: 15px;
    color: #60a5fa;
    flex-shrink: 0;
}

.hm-jobs-item.is-done .hm-jobs-item-top > i,
.hm-jobs-item.is-done .hm-jobs-item-top > svg { color: #4ade80; }
.hm-jobs-item.is-fail .hm-jobs-item-top > i,
.hm-jobs-item.is-fail .hm-jobs-item-top > svg { color: #f87171; }

.hm-jobs-item-text {
    min-width: 0;
}

.hm-jobs-item-text strong {
    display: block;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hm-jobs-item-text small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hm-jobs-pct {
    font-size: 11px;
    font-weight: 650;
    color: var(--text-secondary, #9aa3b2);
    font-variant-numeric: tabular-nums;
}

.hm-jobs-meter {
    margin-top: 8px;
    height: 6px;
}

.hm-jobs-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary);
}

.hm-jobs-mini.muted { color: var(--text-muted); }

.hm-jobs-mini i,
.hm-jobs-mini svg {
    width: 14px;
    height: 14px;
    color: #60a5fa;
    flex-shrink: 0;
}

.hm-jobs-mini em {
    margin-left: auto;
    font-style: normal;
    font-size: 11px;
    font-weight: 650;
    color: var(--text-muted);
}

.hm-jobs-panel .spinning {
    animation: hm-jobs-spin 0.9s linear infinite;
}

@keyframes hm-jobs-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
    .hm-jobs-panel {
        top: 8px;
        width: calc(100vw - 16px);
    }
}

.toast-card {
    pointer-events: auto;
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 12px 12px 14px;
    overflow: hidden;
    background: var(--glass-strong);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-card.in {
    opacity: 1;
    transform: translateX(0);
}

.toast-card.out {
    opacity: 0;
    transform: translateX(18px);
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.toast-icon i,
.toast-icon svg {
    width: 16px;
    height: 16px;
}

.toast-success .toast-icon { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.toast-error .toast-icon,
.toast-danger .toast-icon { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.toast-info .toast-icon { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }

.toast-body p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    padding-top: 6px;
}

.toast-close {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.toast-close i,
.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    transform-origin: left;
    animation: toast-bar linear forwards;
}

.toast-success .toast-bar { background: #22c55e; }
.toast-error .toast-bar,
.toast-danger .toast-bar { background: #ef4444; }
.toast-warning .toast-bar { background: #f59e0b; }
.toast-info .toast-bar { background: #38bdf8; }

@keyframes toast-bar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 640px) {
    .toast-host {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
    }
}

/* ——— Dashboard surfaces ——— */
.stats-grid-dash {
    margin-bottom: 18px;
}

.dash-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.dash-ranges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.dash-ranges button {
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font: 600 12px Inter, sans-serif;
    cursor: pointer;
}

.dash-ranges button.active,
.dash-ranges button:hover {
    color: #fff;
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(59, 130, 246, 0.18);
}

.dash-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

.dash-board {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.dash-widget {
    position: relative;
    min-width: 0;
    grid-column: span 6;
}

.dash-widget[data-span="3"] { grid-column: span 3; }
.dash-widget[data-span="6"] { grid-column: span 6; }
.dash-widget[data-span="12"] { grid-column: span 12; }
.dash-widget.is-hidden { display: none !important; }
.dash-widget.is-dragging { opacity: 0.45; }

.dash-widget[data-href] {
    cursor: pointer;
}

.dash-widget.stat-card,
.dash-widget.chart-card,
.dash-widget.card {
    margin: 0;
}

.dash-widget-bar {
    display: none;
    position: absolute;
    top: 8px;
    left: 8px;
    right: auto;
    z-index: 4;
    gap: 6px;
    align-items: center;
    padding: 4px;
    border-radius: 999px;
    background: rgba(10, 10, 12, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
}

.dashboard.is-editing .dash-widget-bar {
    display: flex;
}

.dashboard.is-editing .dash-widget {
    outline: 1px dashed rgba(96, 165, 250, 0.28);
    cursor: default;
    padding-top: 42px;
}

.dashboard.is-editing .dash-widget[data-href] {
    cursor: default;
}

.dashboard.is-editing .dash-widget:hover {
    transform: none;
}

.dash-grip {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    color: var(--text-muted);
    cursor: grab;
}

.dash-grip:active {
    cursor: grabbing;
}

.dash-grip i,
.dash-grip svg,
.dash-hide i,
.dash-hide svg {
    width: 14px;
    height: 14px;
}

.dash-span-btns {
    display: flex;
    gap: 2px;
}

.dash-span-btns button,
.dash-hide {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #9aa3b2;
    font: 700 10px Inter, sans-serif;
    cursor: pointer;
}

.dash-span-btns button.active,
.dash-span-btns button:hover,
.dash-hide:hover {
    color: #fff;
    background: rgba(59, 130, 246, 0.28);
}

.dash-catalog {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px dashed rgba(96, 165, 250, 0.35);
    background: rgba(10, 10, 12, 0.35);
}

.dash-catalog h4 {
    margin: 0;
    font-size: 13px;
}

.dash-catalog p {
    margin: 4px 0 10px;
    color: var(--text-muted);
    font-size: 12px;
}

.dash-catalog-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dash-catalog-item {
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(59, 130, 246, 0.12);
    color: #dbe7ff;
    font: 600 12px Inter, sans-serif;
    cursor: pointer;
}

.dash-catalog-item:hover {
    background: rgba(59, 130, 246, 0.28);
}

.dash-nodes .list-item,
.dash-alerts .list-item {
    cursor: pointer;
}

@media (max-width: 1100px) {
    .dash-widget[data-span="3"] {
        grid-column: span 6;
    }
}

@media (max-width: 720px) {
    .dash-board {
        grid-template-columns: 1fr;
    }
    .dash-widget,
    .dash-widget[data-span="3"],
    .dash-widget[data-span="6"],
    .dash-widget[data-span="12"] {
        grid-column: 1 / -1;
    }
}

.stat-card[data-tone="ok"] .stat-value { color: #4ade80; }
.stat-card[data-tone="warn"] .stat-value { color: #fbbf24; }
.stat-card[data-tone="bad"] .stat-value { color: #f87171; }

.dash-widget[data-detail] {
    cursor: pointer;
}

.dash-detail-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.dash-detail-kpi {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.dash-detail-kpi-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 4px;
}

.dash-detail-kpi-value {
    display: block;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.dash-detail-chart {
    height: 220px;
    margin-bottom: 8px;
}

.hm-meter {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-top: 8px;
}

.hm-meter > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: #60a5fa;
    transition: width 0.35s ease;
}

.hm-meter[data-tone="ok"] > span,
.hm-meter-ram > span { background: #34d399; }
.hm-meter[data-tone="warn"] > span { background: #fbbf24; }
.hm-meter[data-tone="bad"] > span { background: #f87171; }
.hm-meter-cpu > span { background: #60a5fa; }
.hm-meter-disk > span { background: #fbbf24; }
.hm-meter-ram > span { background: #34d399; }
.hm-meter-swap > span { background: #fb923c; }
.hm-meter-gpu > span { background: #c084fc; }
.hm-meter-net > span { background: #38bdf8; }

.top-nodes-tabs {
    display: flex;
    gap: 4px;
}
.top-tab {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.top-tab.active,
.top-tab:hover {
    background: rgba(59,130,246,0.15);
    color: #60a5fa;
    border-color: #60a5fa;
}
.top-nodes-body {
    padding: 0 4px;
}
.top-node-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
}
.top-node-row:last-child {
    border-bottom: none;
}
.top-node-row:hover {
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
}
.top-node-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-node-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.top-node-val {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.dash-node-meters {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
    min-width: 132px;
}

.meter-cell {
    min-width: 110px;
}

.meter-label {
    display: inline-block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.charts-split {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
    margin-bottom: 18px;
}

.chart-body {
    position: relative;
    height: 220px;
}

.chart-body canvas {
    width: 100% !important;
    height: 100% !important;
}

.metrics-charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.metrics-charts .chart-card {
    margin: 0;
}

.metrics-charts .metrics-chart-wide {
    grid-column: 1 / -1;
}

.metrics-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    z-index: 2;
}

.metrics-chart-empty.hidden {
    display: none;
}

.compact-filters .dash-ranges {
    margin: 0;
}

@media (max-width: 900px) {
    .metrics-charts {
        grid-template-columns: 1fr;
    }
    .metrics-charts .metrics-chart-wide {
        grid-column: auto;
    }
}


.dashboard .card-header,
.dashboard .chart-header {
    margin-bottom: 12px;
}

.dash-nodes .list-item,
.dash-alerts .list-item {
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.dash-nodes .list-item:last-child,
.dash-alerts .list-item:last-child {
    border-bottom: 0;
}

.pill.online,
.status.online {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
}

.pill.offline,
.status.offline,
.pill-error,
.pill-critical,
.pill-danger {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
}

.pill-warning,
.pill-warn {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
}

.pill-info {
    background: rgba(56, 189, 248, 0.16);
    color: #38bdf8;
}

.traffic-split {
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.traffic-split span:first-child { background: #38bdf8; }
.traffic-split span:last-child { background: #818cf8; }

.traffic-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
    gap: 16px;
    align-items: start;
    margin-top: 4px;
}

.traffic-tops {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.traffic-top-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 13px;
}

.traffic-top-name {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.traffic-top-value {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.traffic-top-bar {
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.traffic-top-in { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.traffic-top-out { background: linear-gradient(90deg, #6366f1, #818cf8); }

.traffic-top-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.iface-card .card-header {
    align-items: center;
    gap: 12px;
}

.iface-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.iface-tools .sort-control .hm-select {
    min-width: 180px;
    max-width: 220px;
}

.iface-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ifaces-table td.num,
.ifaces-table th.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ifaces-table th.col-share,
.ifaces-table td.col-share {
    width: 26%;
    min-width: 140px;
}

.ifaces-table tr.iface-group > td {
    padding: 0;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.iface-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
}

.iface-node {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.iface-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.iface-dot.is-online {
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.iface-dot.is-offline {
    background: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16);
}

.iface-group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.iface-group-meta {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.iface-group-total {
    font-weight: 600;
    color: var(--text-primary);
}

.iface-group-status {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.iface-group-status.is-online {
    background: rgba(52, 211, 153, 0.14);
    color: #6ee7b7;
}

.iface-group-status.is-offline {
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
}

.ifaces-table tr.iface-row > td {
    padding: 9px 14px;
    font-size: 13px;
}

.ifaces-table tr.iface-row > td:first-child {
    padding-left: 30px;
}

.ifaces-table tr.iface-row:hover > td {
    background: rgba(56, 189, 248, 0.05);
}

.iface-name {
    display: inline-block;
    padding: 3px 9px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    font-weight: 500;
}

.iface-in,
.iface-out {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.iface-in {
    color: #7dd3fc;
}

.iface-out {
    color: #a5b4fc;
}

.iface-in::before {
    content: '↓';
    margin-right: 5px;
    color: #38bdf8;
}

.iface-out::before {
    content: '↑';
    margin-right: 5px;
    color: #818cf8;
}

.iface-bar {
    display: flex;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.iface-bar-in {
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}

.iface-bar-out {
    background: linear-gradient(90deg, #6366f1, #818cf8);
}

.iface-share-label {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.iface-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.iface-badge--err {
    background: rgba(251, 191, 36, 0.16);
    color: #fcd34d;
}

.iface-badge--drop {
    background: rgba(248, 113, 113, 0.16);
    color: #fca5a5;
}

body.light .iface-name {
    background: rgba(15, 23, 42, 0.04);
}

body.light .iface-count {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

body.light .ifaces-table tr.iface-group > td {
    background: rgba(15, 23, 42, 0.03);
}

body.light .iface-group-count {
    background: rgba(15, 23, 42, 0.06);
}

body.light .iface-group-status.is-online {
    color: #047857;
}

body.light .iface-group-status.is-offline {
    color: #b91c1c;
}

body.light .iface-in {
    color: #0284c7;
}

body.light .iface-out {
    color: #4f46e5;
}

body.light .iface-badge {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-muted);
}

body.light .iface-badge--err {
    background: rgba(217, 119, 6, 0.14);
    color: #b45309;
}

body.light .iface-badge--drop {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

@media (max-width: 1100px) {
    .traffic-layout {
        grid-template-columns: 1fr;
    }
}

#history-tab .card {
    margin-top: 0;
}

#history-tab .history-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 960px) {
    .charts-split {
        grid-template-columns: 1fr;
    }
}

.dbmon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    margin: 16px 0 20px;
}
.dbmon-card { padding: 16px 16px 12px; }
.dbmon-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}
.dbmon-top h3 { margin: 0; font-size: 16px; }
.dbmon-host, .dbmon-lag, .dbmon-error {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}
.dbmon-error { color: #f87171; word-break: break-word; }
.dbmon-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 10px 0;
    font-size: 12px;
    color: var(--text-muted);
}
.dbmon-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 8px 0 12px;
}
.dbmon-kpis small {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dbmon-kpis strong { font-size: 14px; }
.dbmon-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}
.dbmon-chart-card { margin-top: 8px; }

/* --- Резерв панели: отдельный блок над сеткой баз --- */
.dbmon-ha-card {
    margin: 12px 0 16px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

.dbmon-ha-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
    min-width: 0;
}

.dbmon-ha-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.dbmon-ha-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.22);
    flex-shrink: 0;
}

.dbmon-ha-icon i,
.dbmon-ha-icon svg {
    width: 14px;
    height: 14px;
    color: #60a5fa;
}

.dbmon-ha-brand strong {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
    white-space: nowrap;
}

.dbmon-ha-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    min-width: 0;
}

.dbmon-ha-pills .ha-pill {
    font-size: 11px;
    padding: 3px 8px;
    line-height: 1.2;
    margin: 0;
}

.dbmon-ha-toolbtns {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.dbmon-ha-card .dbmon-ha-tool,
.dbmon-ha-card .dbmon-ha-act,
.dbmon-ha-card #dbmon-sync-cancel {
    margin: 0 !important;
    box-sizing: border-box;
}

.dbmon-ha-tool {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 8px;
}

.dbmon-ha-tool i,
.dbmon-ha-tool svg {
    width: 13px;
    height: 13px;
}

.dbmon-ha-hosts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
}

.dbmon-ha-host {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.dbmon-ha-host > span {
    display: block;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.dbmon-ha-host code {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-secondary, #9aa3b2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dbmon-ha-note {
    margin: 0;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-muted);
}

.dbmon-ha-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
}

.dbmon-ha-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(96, 165, 250, 0.08);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.dbmon-ha-act > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dbmon-ha-act:hover:not(:disabled) {
    background: rgba(96, 165, 250, 0.16);
    border-color: rgba(96, 165, 250, 0.55);
}

.dbmon-ha-act:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dbmon-ha-act i,
.dbmon-ha-act svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #60a5fa;
}

.dbmon-ha-act-muted {
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    font-weight: 500;
}

.dbmon-ha-act-muted i,
.dbmon-ha-act-muted svg {
    color: var(--text-muted);
}

.dbmon-ha-actions.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

#dbmon-sync-progress,
#dbmon-sync-result {
    margin-top: 0;
}

@media (max-width: 900px) {
    .dbmon-ha-bar {
        grid-template-columns: auto 1fr;
    }
    .dbmon-ha-toolbtns {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .dbmon-ha-hosts,
    .dbmon-ha-actions {
        grid-template-columns: 1fr;
    }
    .dbmon-ha-tool span {
        display: none;
    }
}

/* SMART monitoring */
.smart-row-critical {
    background: rgba(239, 68, 68, 0.08) !important;
    border-left: 3px solid #dc2626;
}

.smart-row-critical:hover {
    background: rgba(239, 68, 68, 0.14) !important;
}

.smart-row-warning {
    background: rgba(245, 158, 11, 0.08) !important;
    border-left: 3px solid #d97706;
}

.smart-row-warning:hover {
    background: rgba(245, 158, 11, 0.14) !important;
}

.smart-row-selected {
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

.smart-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.smart-detail-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.smart-detail-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#smartExportMenu .hm-menu-item:disabled,
#smartExportMenu .hm-menu-item[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

#smartExportMenu .hm-menu-item:disabled:hover,
#smartExportMenu .hm-menu-item[disabled]:hover {
    background: transparent;
    color: var(--text-muted);
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#smart-tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

#smart-tbody tr:hover {
    background: var(--bg-card-hover);
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-sm:hover {
    background: rgba(255,255,255,0.12);
    color: var(--text-primary);
}

#key-attrs .stat-card {
    padding: 14px 16px;
}

/* ── Nodes import/export ── */
.import-nodes-table-wrap {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.ha-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ha-table th,
.ha-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.ha-table th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text-secondary);
    z-index: 1;
}

.ha-table tbody tr:hover {
    background: rgba(255,255,255,0.04);
}

.ha-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.ha-result {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.ha-result-ok {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.ha-result-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* ——— Widget configurator ——— */
.gauge-body,
.pie-body {
    position: relative;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gauge-body canvas,
.pie-body canvas {
    width: 100% !important;
    height: 100% !important;
}
.gauge-value,
.pie-center {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    pointer-events: none;
}

.bar-body {
    height: 180px;
}
.bar-body canvas {
    width: 100% !important;
    height: 100% !important;
}

.dash-config-btn {
    display: none;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #9aa3b2;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.dash-config-btn i,
.dash-config-btn svg {
    width: 14px;
    height: 14px;
}
.dash-config-btn:hover {
    color: #fff;
    background: rgba(59, 130, 246, 0.28);
}
.dashboard.is-editing .dash-config-btn {
    display: inline-flex;
}

.dash-config-panel {
    position: absolute;
    top: 44px;
    left: 8px;
    right: 8px;
    z-index: 20;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-config-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dash-config-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dash-config-types {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.dash-config-type-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.15s;
}
.dash-config-type-btn i,
.dash-config-type-btn svg {
    width: 16px;
    height: 16px;
}
.dash-config-type-btn.active,
.dash-config-type-btn:hover {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(96, 165, 250, 0.55);
    color: #fff;
}

.dash-config-select,
.dash-config-input {
    height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font: 500 12px Inter, sans-serif;
}
.dash-config-select:focus,
.dash-config-input:focus {
    border-color: rgba(96, 165, 250, 0.55);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.dash-config-colors {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.dash-config-color-btn {
    width: 24px;
    height: 24px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.dash-config-color-btn.active,
.dash-config-color-btn:hover {
    border-color: #fff;
    transform: scale(1.15);
}

.dash-config-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 2px;
}
.dash-config-actions button {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
}
.dash-config-reset {
    margin-left: auto;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
}
.dash-config-reset:hover {
    background: rgba(239, 68, 68, 0.18) !important;
}

.has-generic-config .chart-header {
    margin-bottom: 8px;
}
.has-generic-config .chart-header h3 {
    margin: 0;
}


/* Колокольчик фоновых операций. */
.topbar .jobs-bell-wrapper {
    position: relative;
}

.jobs-bell {
    position: relative;
}

.jobs-bell-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    pointer-events: none;
}

.jobs-bell-dropdown {
    width: 360px;
    max-width: min(360px, calc(100vw - 24px));
    padding: 0;
    overflow: hidden;
    /* Колокольчик стоит у правого края шапки, а .hm-menu по умолчанию
     * раскрывается вправо от кнопки (left: 0). Окно шириной 360px при этом
     * уезжало за правый край страницы и перекрывало соседние элементы.
     * Прижимаем к правому краю — уезжать больше некуда. */
    left: auto;
    right: 0;
}

.jobs-bell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    /* На узком экране подпись «воркер не запущен» не должна выдавливать
     * заголовок за пределы окна. */
    flex-wrap: wrap;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(148, 163, 142, 0.16);
    color: var(--panel-text, #d4d6e4);
    font-size: 12.5px;
    font-weight: 600;
}

.jobs-bell-worker {
    /* Прижимаем к правому краю, чтобы «Очистить» осталось справа от
     * заголовка, а не улетело в середину из-за space-between. */
    margin-left: auto;
    color: #f59e0b;
    font-size: 10.5px;
    font-weight: 500;
}

.jobs-bell-clear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid rgba(148, 163, 142, 0.22);
    border-radius: 6px;
    background: rgba(148, 163, 142, 0.08);
    color: var(--panel-muted, #8b93a6);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.jobs-bell-clear:hover:not(:disabled) {
    background: rgba(148, 163, 142, 0.18);
    color: var(--panel-text, #d4d6e4);
}

.jobs-bell-clear:disabled {
    opacity: 0.5;
    cursor: default;
}

.jobs-bell-clear svg {
    width: 13px;
    height: 13px;
}

.jobs-bell-list {
    max-height: 340px;
    overflow-y: auto;
}

.jobs-bell-empty {
    padding: 16px 12px;
    color: var(--panel-muted, #8b93a6);
    font-size: 12px;
    text-align: center;
}

.jobs-bell-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(148, 163, 142, 0.08);
}

.jobs-bell-item:last-child {
    border-bottom: none;
}

.jobs-bell-item > svg {
    flex: 0 0 auto;
    margin-top: 1px;
    width: 15px;
    height: 15px;
    color: var(--panel-muted, #8b93a6);
}

.jobs-bell-item-done > svg { color: #22c55e; }
.jobs-bell-item-failed > svg { color: #ef4444; }
.jobs-bell-item-canceled > svg { color: #94a3b8; }
.jobs-bell-item-running > svg {
    color: #3b82f6;
    animation: jobs-bell-spin 1.4s linear infinite;
}

@keyframes jobs-bell-spin {
    to { transform: rotate(360deg); }
}

.jobs-bell-body {
    flex: 1 1 auto;
    min-width: 0;
}

.jobs-bell-title {
    color: var(--panel-text, #d4d6e4);
    font-size: 12.5px;
    font-weight: 500;
    /* Название задачи может быть любым, хоть из git-сообщения. Без переноса
     * длинное слово распирало бы окно и ломало бы раскладку. */
    overflow-wrap: anywhere;
}

.jobs-bell-meta {
    color: var(--panel-muted, #8b93a6);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.jobs-bell-label {
    color: var(--panel-muted, #8b93a6);
    font-size: 10.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jobs-bell-error {
    color: #f87171;
    font-size: 10.5px;
    overflow-wrap: anywhere;
}

.jobs-bell-bar {
    height: 3px;
    margin-top: 5px;
    border-radius: 2px;
    background: rgba(148, 163, 142, 0.18);
    overflow: hidden;
}

.jobs-bell-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: #3b82f6;
    transition: width 0.4s ease;
}

.jobs-bell-time {
    flex: 0 0 auto;
    color: var(--panel-muted, #8b93a6);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

/* Отчёт об обновлении панели. */
.update-report {
    width: 520px;
    max-width: calc(100vw - 24px);
}

.update-report-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.update-report-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
}

.update-report-list > div {
    display: flex;
    gap: 10px;
    font-size: 12.5px;
    line-height: 1.45;
}

.update-report-list dt {
    flex: 0 0 62px;
    color: var(--panel-muted, #8b93a6);
}

.update-report-list dd {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: var(--panel-text, #d4d6e4);
    overflow-wrap: anywhere;
}

.update-report-list code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(148, 163, 142, 0.14);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
}

.update-report-worker {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 7px;
    background: rgba(148, 163, 142, 0.09);
}

.update-report-worker > svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

.update-report-worker strong {
    display: block;
    color: var(--panel-text, #d4d6e4);
    font-size: 12.5px;
    font-weight: 600;
}

.update-report-worker p {
    margin: 3px 0 0;
    color: var(--panel-muted, #8b93a6);
    font-size: 11.5px;
    line-height: 1.45;
}

.update-report-worker-ok > svg { color: #22c55e; }
.update-report-worker-info > svg { color: #3b82f6; }
.update-report-worker-warning > svg { color: #f59e0b; }
.update-report-worker-danger > svg { color: #ef4444; }

/* ——— Update confirm dialog (styled like post-update report) ——— */
.confirm-dialog.update-confirm {
    width: min(94vw, 560px);
    max-width: 560px;
    padding: 0;
    overflow: hidden;
}

.confirm-dialog.update-confirm .confirm-header {
    align-items: center;
    gap: 12px;
    padding: 20px 24px 6px;
}

.confirm-dialog.update-confirm .confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.confirm-dialog.update-confirm .confirm-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent, #3b82f6);
}

.confirm-dialog.update-confirm .confirm-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.confirm-dialog.update-confirm .confirm-body {
    padding: 10px 24px 4px;
    color: var(--text-primary);
    line-height: 1.6;
}

.update-confirm-lead {
    font-size: 14px;
}

.update-confirm-commits {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
}

.update-confirm-commits > strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.update-confirm-commits-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
    max-height: 240px;
    overflow: auto;
}

.update-confirm-commits-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 8px;
    border-left: 2px solid var(--accent, #3b82f6);
    background: rgba(59, 130, 246, 0.06);
    line-height: 1.5;
    word-break: break-word;
}

.update-confirm-commits-list code {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.14);
    color: var(--accent, #3b82f6);
}

.update-confirm-commits-list span {
    flex: 1 1 auto;
    color: var(--text-primary);
}

.panel-update-releases {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.panel-update-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-update-tag svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.panel-update-empty {
    color: var(--text-muted);
    font-size: 13px;
}

.panel-update-status-error {
    color: #f87171;
}

.panel-update-changelog {
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.5;
}

.update-confirm-note {
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.update-confirm-note code {
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--bg-card-hover);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

.confirm-dialog.update-confirm .confirm-actions {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
}

/* ——— Processes page ——— */
#processes-table td:first-child,
#processes-table td:nth-child(3),
#processes-table td:nth-child(4) {
    font-variant-numeric: tabular-nums;
}

#processes-table td:nth-child(2) {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
