:root,
body.theme-ast_light {
    --ast-blue: #5b8cff;
    --ast-blue-main: #3c75ff;
    --ast-blue-dark: #2f63de;
    --ast-accent: #ffb347;

    --ast-bg: #f5f9ff;
    --ast-map-bg: #fbfdff;
    --ast-toolbar-from: #f4f8ff;
    --ast-toolbar-mid: #eaf2ff;
    --ast-toolbar-to: #dce9ff;

    --ast-card-bg: rgba(255,255,255,0.98);
    --ast-border: #dbe8ff;
    --ast-text: #244264;
    --ast-muted: #6f86a3;
    --ast-button-bg: #ffffff;
    --ast-button-text: #315fbe;
    --ast-button-hover: #edf4ff;
    --ast-shadow: rgba(60, 117, 255, 0.12);
    --ast-grid: rgba(91,140,255,0.08);
}

body.theme-ast_blue {
    --ast-blue: #6d9bff;
    --ast-blue-main: #3c75ff;
    --ast-blue-dark: #255fdf;
    --ast-accent: #ffb347;

    --ast-bg: #eef5ff;
    --ast-map-bg: #f8fbff;
    --ast-toolbar-from: #eaf2ff;
    --ast-toolbar-mid: #dce9ff;
    --ast-toolbar-to: #cfe0ff;

    --ast-card-bg: rgba(255,255,255,0.98);
    --ast-border: #cfe0ff;
    --ast-text: #1f4677;
    --ast-muted: #6a89ad;
    --ast-button-bg: #ffffff;
    --ast-button-text: #255fdf;
    --ast-button-hover: #eaf2ff;
    --ast-shadow: rgba(60, 117, 255, 0.14);
    --ast-grid: rgba(60,117,255,0.10);
}

body.theme-ast_white {
    --ast-blue: #6f93e8;
    --ast-blue-main: #4f7ee8;
    --ast-blue-dark: #315fc4;
    --ast-accent: #f5b85f;

    --ast-bg: #ffffff;
    --ast-map-bg: #ffffff;
    --ast-toolbar-from: #ffffff;
    --ast-toolbar-mid: #f8fafc;
    --ast-toolbar-to: #f1f5f9;

    --ast-card-bg: rgba(255,255,255,0.99);
    --ast-border: #e2e8f0;
    --ast-text: #334155;
    --ast-muted: #75849a;
    --ast-button-bg: #ffffff;
    --ast-button-text: #315fc4;
    --ast-button-hover: #f8fafc;
    --ast-shadow: rgba(15, 23, 42, 0.08);
    --ast-grid: rgba(100,116,139,0.08);
}

body.theme-ast_green {
    --ast-blue: #6ccf9a;
    --ast-blue-main: #28a96b;
    --ast-blue-dark: #188052;
    --ast-accent: #f2b95f;

    --ast-bg: #f3fff8;
    --ast-map-bg: #fbfffd;
    --ast-toolbar-from: #f3fff8;
    --ast-toolbar-mid: #e8fff1;
    --ast-toolbar-to: #d9f8e7;

    --ast-card-bg: rgba(255,255,255,0.98);
    --ast-border: #cceedd;
    --ast-text: #24513d;
    --ast-muted: #6b8b7a;
    --ast-button-bg: #ffffff;
    --ast-button-text: #188052;
    --ast-button-hover: #ecfff5;
    --ast-shadow: rgba(40, 169, 107, 0.12);
    --ast-grid: rgba(40,169,107,0.08);
}

body.theme-ast_gray {
    --ast-blue: #8aa4c8;
    --ast-blue-main: #647fa8;
    --ast-blue-dark: #4c6385;
    --ast-accent: #d9a55d;

    --ast-bg: #f6f8fb;
    --ast-map-bg: #fbfcfe;
    --ast-toolbar-from: #f8fafc;
    --ast-toolbar-mid: #eef2f7;
    --ast-toolbar-to: #e2e8f0;

    --ast-card-bg: rgba(255,255,255,0.98);
    --ast-border: #d9e1eb;
    --ast-text: #334155;
    --ast-muted: #778596;
    --ast-button-bg: #ffffff;
    --ast-button-text: #4c6385;
    --ast-button-hover: #f1f5f9;
    --ast-shadow: rgba(100, 116, 139, 0.12);
    --ast-grid: rgba(100,116,139,0.08);
}

body.theme-ast_contrast {
    --ast-blue: #4d7cff;
    --ast-blue-main: #245cff;
    --ast-blue-dark: #1743bd;
    --ast-accent: #ff9f1c;

    --ast-bg: #eef3ff;
    --ast-map-bg: #f8fbff;
    --ast-toolbar-from: #e7eeff;
    --ast-toolbar-mid: #dbe6ff;
    --ast-toolbar-to: #c8d8ff;

    --ast-card-bg: rgba(255,255,255,0.98);
    --ast-border: #bcd0ff;
    --ast-text: #12213a;
    --ast-muted: #526b90;
    --ast-button-bg: #ffffff;
    --ast-button-text: #1743bd;
    --ast-button-hover: #e7eeff;
    --ast-shadow: rgba(36, 92, 255, 0.16);
    --ast-grid: rgba(36,92,255,0.10);
}


body.theme-ast_dark {
    --ast-blue: #7aa2ff;
    --ast-blue-main: #5d7cff;
    --ast-blue-dark: #3147c9;
    --ast-accent: #f59e0b;

    --ast-bg: #0f172a;
    --ast-bg-start: #111827;
    --ast-bg-end: #0b1120;
    --ast-map-bg: #101827;
    --ast-toolbar-from: #172033;
    --ast-toolbar-mid: #111827;
    --ast-toolbar-to: #0b1120;

    --portal-nav-color-from: #120022;
    --portal-nav-color-to: #1d2b64;
    --map-toolbar-color-from: #172033;
    --map-toolbar-color-to: #101827;

    --ast-card-bg: rgba(15, 23, 42, 0.94);
    --ast-panel-bg: rgba(20, 31, 52, 0.90);
    --ast-input-bg: rgba(8, 13, 24, 0.92);
    --ast-border: rgba(122, 162, 255, 0.28);
    --ast-text: #dbeafe;
    --ast-title: #f8fafc;
    --ast-muted: #9caecb;
    --ast-button-bg: rgba(30, 41, 59, 0.96);
    --ast-button-text: #dbeafe;
    --ast-button-hover: rgba(51, 65, 85, 0.96);
    --ast-shadow: rgba(0, 0, 0, 0.36);
    --ast-grid: rgba(125, 162, 255, 0.12);
}

body.theme-noc_night {
    --ast-blue: #22d3ee;
    --ast-blue-main: #06b6d4;
    --ast-blue-dark: #0891b2;
    --ast-accent: #f97316;

    --ast-bg: #020617;
    --ast-bg-start: #06111f;
    --ast-bg-end: #020617;
    --ast-map-bg: #030a18;
    --ast-toolbar-from: #071426;
    --ast-toolbar-mid: #07111f;
    --ast-toolbar-to: #020617;

    --portal-nav-color-from: #020617;
    --portal-nav-color-to: #082f49;
    --map-toolbar-color-from: #06111f;
    --map-toolbar-color-to: #031525;

    --ast-card-bg: rgba(2, 6, 23, 0.94);
    --ast-panel-bg: rgba(8, 19, 35, 0.92);
    --ast-input-bg: rgba(1, 5, 16, 0.94);
    --ast-border: rgba(34, 211, 238, 0.28);
    --ast-text: #d9f99d;
    --ast-title: #ecfeff;
    --ast-muted: #8bb3c7;
    --ast-button-bg: rgba(8, 47, 73, 0.96);
    --ast-button-text: #ecfeff;
    --ast-button-hover: rgba(14, 116, 144, 0.80);
    --ast-shadow: rgba(0, 0, 0, 0.46);
    --ast-grid: rgba(34, 211, 238, 0.14);
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background: var(--ast-bg);
    color: var(--ast-text);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#toolbar {
    height: 68px;
    background:
        linear-gradient(
            135deg,
            var(--ast-toolbar-from) 0%,
            var(--ast-toolbar-mid) 48%,
            var(--ast-toolbar-to) 100%
        );
    color: var(--ast-text);
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 22px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--ast-border);
    box-shadow: 0 8px 24px var(--ast-shadow);
    z-index: 10;
}

#toolbar .title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--ast-text);
}

#toolbar .subtitle {
    font-size: 13px;
    color: var(--ast-muted);
    margin-top: 3px;
}

.toolbar-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--ast-muted);
}

.mode {
    border-radius: 999px;
    padding: 5px 9px;
    font-weight: 800;
    font-size: 11px;
}

.mode-edit {
    background: #e8f9ef;
    color: #17884f;
    border: 1px solid #b9eacb;
}

.mode-view {
    background: #fff5e7;
    color: #b56c00;
    border: 1px solid #ffd79c;
}

#content {
    position: relative;
    flex: 1;
    overflow: hidden;
}

#network {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, var(--ast-grid), transparent 32%),
        radial-gradient(circle at 80% 80%, var(--ast-grid), transparent 35%),
        linear-gradient(to right, var(--ast-grid) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(to bottom, var(--ast-grid) 1px, transparent 1px) 0 0 / 24px 24px,
        var(--ast-map-bg);
}

.controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

button,
.logout-link {
    border: 1px solid var(--ast-border);
    background: var(--ast-button-bg);
    color: var(--ast-button-text);
    border-radius: 10px;
    padding: 9px 13px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 3px 10px var(--ast-shadow);
}

button:hover,
.logout-link:hover {
    background: var(--ast-button-hover);
    border-color: var(--ast-blue);
}

.theme-control {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--ast-muted);
    font-weight: 700;
}

.theme-control select {
    border: 1px solid var(--ast-border);
    background: var(--ast-button-bg);
    color: var(--ast-text);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    box-shadow: 0 3px 10px var(--ast-shadow);
}

.theme-control select:hover {
    background: var(--ast-button-hover);
}

.info-panel {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 420px;
    min-height: 220px;
    max-height: calc(100% - 36px);
    overflow: auto;
    background: var(--ast-card-bg);
    border: 1px solid var(--ast-border);
    border-radius: 18px;
    box-shadow: 0 18px 42px var(--ast-shadow);
    padding: 16px;
    box-sizing: border-box;
    z-index: 20;
}

.info-panel.hidden {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--ast-text);
}

.info-panel h2 {
    margin: 0 0 10px 0;
    font-size: 21px;
    color: var(--ast-text);
}

.info-row {
    margin-bottom: 7px;
    font-size: 14px;
    color: var(--ast-text);
}

.device-actions {
    margin-top: 12px;
}

.device-actions a {
    display: inline-flex;
    background: var(--ast-button-hover);
    color: var(--ast-button-text);
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    padding: 9px 12px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
}

.device-actions a:hover {
    background: var(--ast-button-bg);
    border-color: var(--ast-blue);
}

.chart-block {
    margin-top: 14px;
}

.chart-block img {
    display: block;
    width: 100%;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: #ffffff;
}

.edge-popup {
    position: absolute;
    width: 430px;
    background: var(--ast-card-bg);
    border: 1px solid var(--ast-border);
    border-radius: 16px;
    box-shadow: 0 18px 42px var(--ast-shadow);
    padding: 12px;
    box-sizing: border-box;
    z-index: 30;
    pointer-events: none;
    font-size: 13px;
    color: var(--ast-text);
}

.edge-popup.hidden {
    display: none;
}

.edge-popup .title {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--ast-text);
}

.edge-popup img {
    width: 100%;
    margin-top: 8px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: #ffffff;
}

.readonly-badge {
    position: absolute;
    left: 18px;
    bottom: 18px;
    background: var(--ast-card-bg);
    color: var(--ast-text);
    border: 1px solid var(--ast-border);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    z-index: 15;
    box-shadow: 0 8px 24px var(--ast-shadow);
}

.hidden {
    display: none;
}

.status-online {
    color: #16a34a;
    font-weight: 800;
}

.status-offline {
    color: #dc2626;
    font-weight: 800;
}

.status-warning {
    color: #d97706;
    font-weight: 800;
}

.status-unknown,
.status-disabled {
    color: #64748b;
    font-weight: 800;
}

.device-graph-item {
    margin-top: 14px;
}

.device-graph-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--ast-text);
    margin-bottom: 6px;
}

.device-graph-item img {
    display: block;
    width: 100%;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: #ffffff;
}

/* Manual map edit mode */
#btn-edit-map.editing {
    background: #f59e0b;
    border-color: #d97706;
    color: #fff;
}

#btn-save-positions {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
}

#btn-cancel-positions {
    background: #64748b;
    border-color: #475569;
    color: #fff;
}

.map-edit-status {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    font-size: 12px;
    font-weight: 700;
}

.map-edit-status.dirty {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.hidden {
    display: none !important;
}

#btn-save-map-view {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

/* Clean manual map edit bar */
.map-edit-bar {
    min-height: 54px;
    padding: 9px 18px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--ast-border);
    background: linear-gradient(135deg, #fff7ed 0%, #eef2ff 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    z-index: 9;
}

.map-edit-bar.hidden {
    display: none !important;
}

.map-edit-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1e2f6f;
    min-width: 260px;
}

.map-edit-bar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.map-edit-bar-actions button {
    min-height: 36px;
}

.map-edit-bar .map-edit-status {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.map-edit-bar .map-edit-status.dirty {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

#btn-edit-map.editing {
    background: #f59e0b;
    border-color: #d97706;
    color: #fff;
}

#btn-save-positions {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
}

#btn-save-positions:disabled,
#btn-cancel-positions:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#btn-cancel-positions {
    background: #64748b;
    border-color: #475569;
    color: #fff;
}

#btn-save-map-view {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

@media (max-width: 1100px) {
    .map-edit-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .map-edit-bar-left,
    .map-edit-bar-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Selected node coordinate editor */
.map-edit-coordinates {
    width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.map-edit-coordinates.hidden {
    display: none !important;
}

.map-edit-selected-label {
    color: #1e2f6f;
    font-size: 13px;
}

.map-edit-coordinates label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #334155;
    font-weight: 800;
}

.map-edit-coordinates input {
    width: 92px;
    height: 32px;
    box-sizing: border-box;
    padding: 5px 7px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-weight: 700;
    color: #0f172a;
    background: #ffffff;
}

#btn-apply-node-coords {
    min-height: 34px;
    background: #0ea5e9;
    border-color: #0284c7;
    color: #ffffff;
}

/* Operator panel: core load */
.core-load-panel {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 390px;
    max-width: calc(100vw - 36px);
    box-sizing: border-box;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(199, 210, 254, 0.95);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.15);
    z-index: 900;
    backdrop-filter: blur(8px);
}

.core-load-panel.hidden {
    display: none !important;
}

.core-load-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.core-load-title {
    font-size: 13px;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.core-load-name {
    margin-top: 2px;
    font-size: 17px;
    font-weight: 900;
    color: #1e2f6f;
}

#btn-focus-core {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 10px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-weight: 800;
}

.core-load-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
    color: #334155;
    margin-bottom: 5px;
}

.core-load-small {
    font-size: 11px;
    color: #64748b;
    line-height: 1.25;
}

.core-load-panel .snmp-mini-wrap {
    margin-top: 10px;
    margin-bottom: 0;
}

.core-load-panel .snmp-mini-grid {
    grid-template-columns: repeat(5, minmax(55px, 1fr));
    gap: 6px;
}

.core-load-panel .snmp-mini-card {
    min-height: 54px;
    padding: 6px 5px;
}

.core-load-panel .snmp-mini-value {
    font-size: 14px;
}

@media (max-width: 1100px) {
    .core-load-panel {
        width: 340px;
    }

    .core-load-panel .snmp-mini-grid {
        grid-template-columns: repeat(3, minmax(55px, 1fr));
    }
}

/* Core load panel collapse */
.core-load-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#btn-hide-core-panel {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #dbe3f4;
    color: #334155;
    font-weight: 800;
}

.core-load-collapsed {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 901;
    max-width: 430px;
}

.core-load-collapsed.hidden {
    display: none !important;
}

.core-load-collapsed-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    border: 1px solid #dbe3f4;
    backdrop-filter: blur(8px);
}

.core-load-collapsed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.9);
    flex: 0 0 auto;
}

.core-load-collapsed-title {
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
}

.core-load-collapsed-name {
    font-size: 13px;
    font-weight: 900;
    color: #1e2f6f;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.core-load-collapsed-status {
    font-size: 12px;
    font-weight: 800;
    color: #334155;
}

#btn-show-core-panel {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-weight: 800;
}

.core-state-online {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.35);
}

.core-state-warning {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.35);
}

.core-state-offline {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.35);
}

.core-state-unknown {
    color: #64748b;
    border-color: rgba(100, 116, 139, 0.35);
}

/* Draggable core panel in manual map edit mode */
body.map-edit-mode .core-load-panel,
body.map-edit-mode .core-load-collapsed {
    cursor: move;
    outline: 2px dashed rgba(99, 102, 241, 0.45);
    outline-offset: 3px;
}

body.core-panel-dragging,
body.core-panel-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

/* Operator panel: device problems */
.problems-panel {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 360px;
    max-width: calc(100vw - 36px);
    box-sizing: border-box;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(199, 210, 254, 0.95);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.15);
    z-index: 880;
    backdrop-filter: blur(8px);
}

.problems-panel.hidden {
    display: none !important;
}

.problems-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.problems-title {
    font-size: 16px;
    font-weight: 900;
    color: #1e2f6f;
}

.problems-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
}

#btn-refresh-problems {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 10px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-weight: 800;
}

.problem-counters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.problem-counters span {
    display: block;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 12px;
    color: #334155;
}

.problem-counters .counter-bad {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.problem-counters .counter-warn {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.problem-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 330px;
    overflow: auto;
}

.problem-row {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    text-align: left;
    box-shadow: none;
}

.problem-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.10);
}

.problem-dot {
    width: 10px;
    height: 10px;
    margin-top: 4px;
    border-radius: 50%;
    background: #94a3b8;
    flex: 0 0 auto;
}

.problem-row-critical {
    border-color: #fecaca;
    background: #fff7f7;
}

.problem-row-critical .problem-dot {
    background: #dc2626;
}

.problem-row-warning {
    border-color: #fde68a;
    background: #fffdf4;
}

.problem-row-warning .problem-dot {
    background: #d97706;
}

.problem-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.problem-main strong {
    font-size: 13px;
    color: #1e2f6f;
    line-height: 1.2;
}

.problem-main span {
    font-size: 12px;
    color: #334155;
    line-height: 1.2;
}

.problem-main em {
    font-style: normal;
    font-size: 11px;
    color: #64748b;
    line-height: 1.25;
}

.problem-ok {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    font-size: 13px;
    font-weight: 800;
}

.problem-extra {
    padding: 6px 2px 0 2px;
    font-size: 11px;
    color: #64748b;
}

@media (max-width: 1100px) {
    .problems-panel {
        right: 12px;
        width: 320px;
    }
}

/* Problems panel collapse */
.problems-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#btn-hide-problems-panel {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #dbe3f4;
    color: #334155;
    font-weight: 800;
}

.problems-panel-collapsed {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 881;
    max-width: 390px;
}

.problems-panel-collapsed.hidden {
    display: none !important;
}

.problems-panel-collapsed-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    border: 1px solid #dbe3f4;
    backdrop-filter: blur(8px);
}

.problems-panel-collapsed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.9);
    flex: 0 0 auto;
}

.problems-panel-collapsed-title {
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
}

.problems-panel-collapsed-inner strong {
    font-size: 13px;
    color: #1e2f6f;
}

.problems-panel-collapsed-status {
    font-size: 12px;
    font-weight: 800;
    color: #334155;
}

#btn-show-problems-panel {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-weight: 800;
}

.problems-state-critical {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.35);
}

.problems-state-warning {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.35);
}

.problems-state-ok {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.35);
}

/* Draggable problems panel in manual map edit mode */
body.map-edit-mode .problems-panel,
body.map-edit-mode .problems-panel-collapsed {
    cursor: move;
    outline: 2px dashed rgba(99, 102, 241, 0.45);
    outline-offset: 3px;
}

body.problems-panel-dragging,
body.problems-panel-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

/* Auto-refresh status indicator */
.auto-refresh-badge {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 890;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    max-width: 360px;
    padding: 7px 12px;
    box-sizing: border-box;
    border-radius: 999px;
    border: 1px solid #dbe3f4;
    background: rgba(255, 255, 255, 0.96);
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(8px);
}

.auto-refresh-badge.hidden {
    display: none !important;
}

.auto-refresh-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.auto-refresh-ok {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.35);
}

.auto-refresh-run {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.35);
}

.auto-refresh-paused {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.35);
}

.auto-refresh-error {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.35);
}

.auto-refresh-disabled {
    color: #64748b;
    border-color: rgba(100, 116, 139, 0.35);
}

/* Readonly badge: bottom center */
.readonly-badge {
    left: 50% !important;
    right: auto !important;
    bottom: 18px !important;
    top: auto !important;
    transform: translateX(-50%) !important;
    z-index: 889;
}

/* Draggable auto-refresh badge in manual map edit mode */
body.map-edit-mode .auto-refresh-badge {
    cursor: move;
    outline: 2px dashed rgba(99, 102, 241, 0.45);
    outline-offset: 3px;
}

body.auto-refresh-badge-dragging,
body.auto-refresh-badge-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

/* AST Monitoring Portal global navigation */
.portal-nav {
    min-height: 38px;
    padding: 6px 14px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: linear-gradient(135deg, #0f172a 0%, #1e2f6f 48%, #334155 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    z-index: 1200;
}

.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.portal-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 24px;
    padding: 0 8px;
    box-sizing: border-box;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.portal-brand-text {
    font-size: 14px;
    font-weight: 900;
}

.portal-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
}

.portal-links a {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.84);
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.portal-links a:hover,
.portal-links a.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

/* Compact map toolbar under global portal navigation */
#toolbar {
    min-height: 54px !important;
    height: auto !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
}

#toolbar .title {
    font-size: 18px !important;
}

#toolbar .subtitle {
    font-size: 11px !important;
    margin-top: 1px !important;
}

.toolbar-info {
    gap: 6px !important;
}

.toolbar-info button,
.toolbar-info a {
    min-height: 32px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

/* Simple portal placeholder pages */
.portal-page-app {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 34%),
        linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.portal-page {
    padding: 28px;
    box-sizing: border-box;
}

.portal-page-card {
    max-width: 920px;
    margin: 0 auto;
    padding: 28px;
    border-radius: 22px;
    border: 1px solid rgba(199, 210, 254, 0.9);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.12);
}

.portal-page-kicker {
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.portal-page-card h1 {
    margin: 8px 0 10px;
    color: #1e2f6f;
    font-size: 30px;
}

.portal-page-card p {
    margin: 0;
    color: #334155;
    font-size: 15px;
    line-height: 1.5;
}

.portal-page-note {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 800;
}

@media (max-width: 900px) {
    .portal-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .portal-links {
        justify-content: flex-start;
    }
}

/* Compact portal and map headers */
.portal-nav {
    min-height: 30px !important;
    padding: 3px 14px !important;
}

.portal-brand {
    gap: 6px !important;
}

.portal-brand-mark {
    min-width: 30px !important;
    height: 21px !important;
    padding: 0 7px !important;
    font-size: 11px !important;
}

.portal-brand-text {
    font-size: 13px !important;
}

.portal-links {
    gap: 4px !important;
}

.portal-links a {
    min-height: 23px !important;
    padding: 3px 9px !important;
    font-size: 11px !important;
}

#toolbar {
    min-height: 44px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

#toolbar .title {
    font-size: 17px !important;
    line-height: 1.05 !important;
}

#toolbar .subtitle {
    font-size: 10px !important;
    line-height: 1.1 !important;
    margin-top: 0 !important;
}

.toolbar-info {
    gap: 5px !important;
}

.toolbar-info button,
.toolbar-info a,
#toolbar button,
#toolbar select {
    min-height: 29px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    font-size: 12px !important;
}

#toolbar select {
    height: 29px !important;
}

.mode-badge,
.readonly-mode-badge,
.admin-mode-badge {
    min-height: 26px !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    font-size: 11px !important;
}

.map-edit-bar {
    min-height: 42px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

.map-edit-bar button {
    min-height: 30px !important;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    font-size: 12px !important;
}

/* Portal appearance controlled from settings.php */
.portal-nav {
    min-height: var(--portal-nav-height, 30px) !important;
    height: var(--portal-nav-height, 30px) !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    background: linear-gradient(
        135deg,
        var(--portal-nav-color-from, #170034) 0%,
        var(--portal-nav-color-to, #1e2f6f) 100%
    ) !important;
}

.portal-brand-mark {
    height: calc(var(--portal-nav-height, 30px) - 9px) !important;
    min-height: 18px !important;
}

.portal-links a {
    min-height: calc(var(--portal-nav-height, 30px) - 9px) !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

#toolbar {
    min-height: var(--map-toolbar-height, 40px) !important;
    height: var(--map-toolbar-height, 40px) !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    background: linear-gradient(
        135deg,
        var(--map-toolbar-color-from, #eef2ff) 0%,
        var(--map-toolbar-color-to, #dbe6ff) 100%
    ) !important;
}

#toolbar .title {
    font-size: 16px !important;
    line-height: 1 !important;
}

#toolbar .subtitle {
    font-size: 10px !important;
    line-height: 1 !important;
}

#toolbar button,
#toolbar select,
.toolbar-info button,
.toolbar-info a {
    min-height: 27px !important;
    height: auto !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    font-size: 12px !important;
}

#toolbar select {
    height: 27px !important;
}

.mode-badge,
.readonly-mode-badge,
.admin-mode-badge {
    min-height: 24px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    font-size: 10px !important;
}

/* Fix compact map toolbar overflow */
#toolbar {
    overflow: visible !important;
}

#toolbar,
#toolbar * {
    box-sizing: border-box;
}

#toolbar .toolbar-info,
.toolbar-info {
    align-items: center !important;
}

#toolbar button,
#toolbar a,
#toolbar select,
.toolbar-info button,
.toolbar-info a {
    white-space: nowrap !important;
    line-height: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

#toolbar button,
.toolbar-info button {
    max-height: calc(var(--map-toolbar-height, 40px) - 8px) !important;
}

#toolbar #btn-add-device,
#toolbar [id*="add"],
#toolbar button[id*="add"],
#toolbar a[href*="add"] {
    min-width: 88px !important;
}

/* If button text is too long, keep it inside the map toolbar */
#toolbar .btn,
#toolbar button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Portal settings layout */
.portal-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.portal-settings-block {
    margin-top: 20px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #dbe3f4;
    background: #ffffff;
}

.portal-settings-block h2 {
    margin: 0 0 10px;
    color: #1e2f6f;
    font-size: 19px;
}

.portal-settings-block h3 {
    margin: 16px 0 8px;
    color: #334155;
    font-size: 15px;
}

.portal-table-wrap {
    overflow: auto;
}

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

.portal-simple-table th,
.portal-simple-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

.portal-simple-table th {
    color: #334155;
    background: #f8fafc;
    font-weight: 900;
}

.portal-simple-table td {
    color: #1f2937;
}

@media (max-width: 900px) {
    .portal-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Portal no-access placeholders */
.portal-denied-card {
    max-width: 760px;
}

.portal-denied-card h1 {
    color: #991b1b;
}

.portal-denied-box {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #fecaca;
    background: #fff7f7;
    color: #7f1d1d;
    font-size: 14px;
    line-height: 1.6;
}

.portal-denied-actions {
    margin-top: 18px;
}

.portal-denied-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 12px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    text-decoration: none;
    font-weight: 900;
}

/* Portal role management */
.portal-settings-wide {
    max-width: 1180px;
}

.role-inline-form {
    margin: 0;
}

.role-checkboxes {
    display: grid;
    gap: 6px;
    min-width: 180px;
}

.role-checkboxes label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 800;
    color: #334155;
}

.perm-cell {
    text-align: center !important;
    font-size: 18px;
    font-weight: 900;
    color: #16a34a !important;
}

/* Single role / single group controls */
.role-radio-list {
    display: grid;
    gap: 6px;
    min-width: 155px;
}

.role-radio-list label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 800;
    color: #334155;
}

.role-radio-list input[type="radio"] {
    width: 15px;
    height: 15px;
}

.role-live-description {
    min-width: 260px;
    max-width: 340px;
}

.role-live-title {
    margin-bottom: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.35;
}

/* Make live role descriptions clearly visible */
.role-live-description {
    display: block !important;
    min-width: 280px !important;
    max-width: 420px !important;
    color: #1f2937 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
}

.role-live-description .role-live-title {
    display: block !important;
    margin-bottom: 8px !important;
    color: #1e2f6f !important;
    font-size: 12px !important;
    font-weight: 900 !important;
}

.role-live-description .permission-pills {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
}

.role-live-description .permission-pills span {
    color: #3730a3 !important;
    background: #eef2ff !important;
    border: 1px solid #c7d2fe !important;
}

/* Rebuilt portal user cards */
.portal-users-list {
    display: grid;
    gap: 16px;
}

.portal-user-card {
    margin: 0;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #dbe3f4;
    background: #fbfdff;
}

.portal-user-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.portal-user-login {
    color: #1e2f6f;
    font-size: 18px;
    font-weight: 900;
}

.portal-user-subtitle {
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.portal-user-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    gap: 12px;
}

.portal-user-grid label {
    display: grid;
    gap: 5px;
}

.portal-user-grid label span {
    color: #334155;
    font-size: 12px;
    font-weight: 900;
}

.portal-user-grid input,
.portal-user-grid select {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 11px;
    border: 1px solid #c7d2fe;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
}

.portal-user-grid input[readonly] {
    background: #f8fafc;
    color: #334155;
    font-weight: 900;
}

.role-summary {
    margin-top: 14px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid #c7d2fe;
    background: #f8faff;
}

.role-summary-title {
    margin-bottom: 5px;
    color: #1e2f6f;
    font-size: 12px;
    font-weight: 900;
}

.role-summary-description {
    margin-bottom: 10px;
    color: #334155;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 800;
}

.role-summary-permissions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.role-summary-permissions span {
    color: #3730a3 !important;
    background: #eef2ff !important;
    border: 1px solid #c7d2fe !important;
}

@media (max-width: 1000px) {
    .portal-user-grid {
        grid-template-columns: 1fr;
    }
}

/* Compact users block: 3 cards per row on wide screens */
.portal-users-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(260px, 1fr)) !important;
    gap: 14px !important;
    align-items: start !important;
}

.portal-user-card {
    padding: 12px !important;
    border-radius: 16px !important;
    min-width: 0 !important;
}

.portal-user-card-head {
    margin-bottom: 10px !important;
    align-items: flex-start !important;
}

.portal-user-login {
    font-size: 16px !important;
    line-height: 1.1 !important;
}

.portal-user-subtitle {
    font-size: 11px !important;
}

/* === AST DISABLED DUPLICATED PORTAL USER CARD HEAD BTN 2026-04-26 ===
   Удалён ранний дубль .portal-user-card-head .btn: original lines 2008-2016.
   В финальном правиле сохранено white-space: nowrap.
   Оригиналы сохранены в: /var/www/ast-css-disabled-portal-user-card-head-btn-duplicates-20260426_214939.css
=== AST DISABLED DUPLICATED PORTAL USER CARD HEAD BTN END === */
.portal-user-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
}

.portal-user-grid label {
    gap: 3px !important;
}

.portal-user-grid label span {
    font-size: 11px !important;
}

.portal-user-grid input,
.portal-user-grid select {
    min-height: 30px !important;
    padding: 5px 8px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
}

.role-summary {
    margin-top: 10px !important;
    padding: 10px !important;
    border-radius: 13px !important;
    max-height: 190px !important;
    overflow: auto !important;
}

.role-summary-title {
    font-size: 11px !important;
    margin-bottom: 4px !important;
}

.role-summary-description {
    font-size: 12px !important;
    line-height: 1.3 !important;
    margin-bottom: 8px !important;
}

.role-summary-permissions {
    gap: 4px !important;
}

.role-summary-permissions span,
.permission-pills span {
    padding: 2px 6px !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
}

/* Two cards per row on medium screens */
@media (max-width: 1280px) {
    .portal-users-list {
        grid-template-columns: repeat(2, minmax(260px, 1fr)) !important;
    }
}

/* One card per row on small screens */
@media (max-width: 820px) {
    .portal-users-list {
        grid-template-columns: 1fr !important;
    }
}

/* Final compact user cards controlled by portal setting */
.portal-users-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(var(--portal-user-card-width, 300px), var(--portal-user-card-width, 300px))) !important;
    gap: 10px !important;
    align-items: start !important;
    justify-content: start !important;
}

.portal-user-card {
    width: var(--portal-user-card-width, 300px) !important;
    max-width: var(--portal-user-card-width, 300px) !important;
    padding: 9px !important;
    border-radius: 14px !important;
}

.portal-user-card-head {
    margin-bottom: 8px !important;
    gap: 8px !important;
}

.portal-user-login {
    font-size: 14px !important;
}

.portal-user-subtitle {
    font-size: 10px !important;
}

/* === AST DISABLED DUPLICATED PORTAL USER CARD HEAD BTN 2026-04-26 ===
   Удалён ранний дубль .portal-user-card-head .btn: original lines 2109-2117.
   В финальном правиле сохранено white-space: nowrap.
   Оригиналы сохранены в: /var/www/ast-css-disabled-portal-user-card-head-btn-duplicates-20260426_214939.css
=== AST DISABLED DUPLICATED PORTAL USER CARD HEAD BTN END === */
.portal-user-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
}

.portal-user-grid label span {
    font-size: 10px !important;
}

.portal-user-grid input,
.portal-user-grid select {
    min-height: 27px !important;
    padding: 4px 6px !important;
    border-radius: 8px !important;
    font-size: 11px !important;
}

.portal-user-grid label:nth-child(4),
.portal-user-grid label:nth-child(5),
.portal-user-grid label:nth-child(6) {
    grid-column: 1 / -1;
}

.role-summary {
    margin-top: 8px !important;
    padding: 8px !important;
    max-height: 135px !important;
    overflow: auto !important;
}

.role-summary-title {
    font-size: 10px !important;
}

.role-summary-description {
    font-size: 11px !important;
    margin-bottom: 6px !important;
}

.role-summary-permissions span,
.permission-pills span {
    padding: 2px 5px !important;
    font-size: 9px !important;
}

.portal-compact-layout-settings {
    margin-bottom: 14px !important;
}

.portal-layout-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.portal-layout-form label {
    display: grid;
    gap: 5px;
}

.portal-layout-form label span {
    color: #334155;
    font-size: 12px;
    font-weight: 900;
}

.portal-layout-form input {
    width: 130px;
    min-height: 32px;
    padding: 6px 9px;
    border-radius: 10px;
    border: 1px solid #c7d2fe;
}

.portal-layout-form .portal-page-note {
    flex-basis: 100%;
    margin-top: 0 !important;
}

/* On very small screens user cards use full available width */
@media (max-width: 720px) {
    .portal-users-list {
        grid-template-columns: 1fr !important;
    }

    .portal-user-card {
        width: auto !important;
        max-width: none !important;
    }
}

/* ===== User cards: spacing + non-overlap fix ===== */
.portal-users-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(var(--portal-user-card-width, 300px), var(--portal-user-card-width, 300px))) !important;
    gap: 14px !important;
    align-items: start !important;
    justify-content: start !important;
    align-content: start !important;
}

.portal-user-card {
    box-sizing: border-box !important;
    width: var(--portal-user-card-width, 300px) !important;
    max-width: var(--portal-user-card-width, 300px) !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 8px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
}

.portal-user-card * {
    box-sizing: border-box !important;
}

.portal-user-card-head {
    margin-bottom: 6px !important;
    gap: 6px !important;
}

.portal-user-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
}

.portal-user-grid label {
    min-width: 0 !important;
}

.portal-user-grid input,
.portal-user-grid select,
.portal-user-grid textarea {
    width: 100% !important;
    min-width: 0 !important;
}

.role-summary {
    margin-top: 8px !important;
}

@media (max-width: 760px) {
    .portal-users-list {
        grid-template-columns: 1fr !important;
    }

    .portal-user-card {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ===== Extra compact portal user cards ===== */
.portal-users-list {
    gap: 12px !important;
}

.portal-user-card {
    padding: 7px !important;
    border-radius: 13px !important;
}

.portal-user-card-head {
    margin-bottom: 5px !important;
    gap: 6px !important;
}

.portal-user-login {
    font-size: 13px !important;
    line-height: 1 !important;
}

.portal-user-subtitle {
    margin-top: 1px !important;
    font-size: 9px !important;
    line-height: 1 !important;
}

.portal-user-card-head .btn {
    min-height: 24px !important;
    padding: 3px 7px !important;
    border-radius: 8px !important;
    font-size: 9px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.portal-user-grid {
    gap: 5px !important;
}

.portal-user-grid label {
    gap: 2px !important;
}

.portal-user-grid label span {
    font-size: 9px !important;
    line-height: 1.1 !important;
}

.portal-user-grid input,
.portal-user-grid select {
    min-height: 24px !important;
    height: 24px !important;
    padding: 2px 6px !important;
    border-radius: 8px !important;
    font-size: 10px !important;
    line-height: 1 !important;
}

.portal-user-grid input[readonly] {
    font-size: 10px !important;
}

/* Make the role block compact but still readable */
.role-summary {
    margin-top: 6px !important;
    padding: 6px !important;
    border-radius: 11px !important;
    max-height: 105px !important;
    overflow: auto !important;
}

.role-summary-title {
    margin-bottom: 3px !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
}

.role-summary-description {
    margin-bottom: 5px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
}

.role-summary-permissions,
.permission-pills {
    gap: 3px !important;
}

.role-summary-permissions span,
.permission-pills span {
    padding: 1px 4px !important;
    border-radius: 7px !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
}

/* Compact portal layout setting block too */
.portal-compact-layout-settings {
    padding: 10px 14px !important;
}

.portal-compact-layout-settings h2 {
    margin-bottom: 8px !important;
    font-size: 17px !important;
}

.portal-layout-form {
    gap: 8px !important;
}

.portal-layout-form input {
    width: 105px !important;
    min-height: 26px !important;
    padding: 3px 7px !important;
    font-size: 11px !important;
}

.portal-layout-form .btn {
    min-height: 28px !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
}

.portal-layout-form .portal-page-note {
    padding: 7px 10px !important;
    font-size: 11px !important;
}

/* Reduce block padding on portal settings page */
.portal-settings-block {
    padding: 12px 14px !important;
}

.portal-settings-block h2 {
    margin-bottom: 8px !important;
    font-size: 18px !important;
}

/* ===== Portal header owns authorization/user controls ===== */
.portal-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    overflow: hidden !important;
}

.portal-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

.portal-brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    flex: 0 0 auto !important;
}

.portal-links {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    min-width: 0 !important;
    overflow: hidden !important;
    margin-right: auto !important;
}

.portal-links a {
    flex: 0 0 auto !important;
}

.portal-user {
    margin-left: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
}

.portal-user-name {
    max-width: 210px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* The map toolbar should not duplicate authentication controls */
#toolbar a[href*="logout"],
#toolbar a[href*="/auth/logout"],
#toolbar a[href*="login"],
#toolbar .logout,
#toolbar .login,
#toolbar .toolbar-user,
#toolbar .user-info,
#toolbar .current-user {
    display: none !important;
}

/*
   Старый текст "Пользователь: ..." оставляем скрытым только внутри панели карты.
   В портале ФИО показывается справа.
*/
#toolbar .toolbar-info > span:has(+ span),
#toolbar .toolbar-info .user-label {
    /* modern browsers ignore this safely if selector unsupported */
}

/* Compact map toolbar after moving auth to portal */
#toolbar {
    min-height: calc(var(--map-toolbar-height, 40px) - 2px) !important;
}

#toolbar .toolbar-info {
    justify-content: flex-end !important;
}

/* If map toolbar still has a textual user block, make it visually harmless */
#toolbar [class*="user"],
#toolbar [id*="user"] {
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* Do not affect portal user block */
.portal-nav [class*="user"],
.portal-nav [id*="user"] {
    max-width: none !important;
    overflow: visible !important;
}

/* ===== Portal user name style: same visual weight as nav links ===== */
.portal-user {
    gap: 6px !important;
}

.portal-user-name,
.portal-logout {
    min-height: 23px !important;
    padding: 3px 9px !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    color: rgba(255, 255, 255, 0.84) !important;
    text-decoration: none !important;
}

.portal-user-name {
    display: inline-flex !important;
    align-items: center !important;
    max-width: 180px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    background: transparent !important;
}

.portal-logout {
    display: inline-flex !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.10) !important;
}

.portal-logout:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
}

/* ===== Hide duplicated user info from map toolbar ===== */
#toolbar .map-user-block,
#toolbar .toolbar-user-block,
#toolbar .toolbar-user,
#toolbar .current-user,
#toolbar .user-info,
#toolbar [data-map-user-block="1"] {
    display: none !important;
}

/* Portal auth page */
.auth-page-wrap {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    max-width: 440px;
}

.auth-form {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.auth-form label {
    font-weight: 900;
    color: #1e2f6f;
}

.auth-form input {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #c7d2fe;
    font-size: 15px;
}

/* User management: create user, active flag, password mini form */
.create-user-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    align-items: end;
}

.create-user-form label,
.password-mini-form label {
    display: grid;
    gap: 4px;
}

.create-user-form label span,
.password-mini-form label span {
    color: #334155;
    font-size: 11px;
    font-weight: 900;
}

.create-user-form input,
.create-user-form select {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid #c7d2fe;
    background: #fff;
    color: #111827;
    font-size: 12px;
}

.check-line {
    display: flex !important;
    align-items: center;
    gap: 7px !important;
    min-height: 30px;
}

.check-line input {
    width: auto !important;
    height: auto !important;
    min-height: auto !important;
}

.inactive-user-card {
    opacity: 0.68;
    filter: grayscale(0.35);
    border-style: dashed !important;
}

.password-mini-form {
    margin-top: 7px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 5px;
    align-items: center;
}

.password-mini-form input {
    min-width: 0;
    width: 100%;
    min-height: 24px;
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid #c7d2fe;
    font-size: 10px;
}

.password-mini-form .btn {
    min-height: 24px !important;
    padding: 3px 7px !important;
    font-size: 9px !important;
    border-radius: 8px !important;
}

.portal-user-main-form {
    margin: 0;
}

/* ===== Portal settings: hide inactive users + block layouts ===== */
.portal-layout-check {
    min-height: 32px !important;
    align-items: center !important;
}

.portal-layout-check input {
    width: auto !important;
}

.compact-note {
    margin: 0 0 10px 0 !important;
    padding: 7px 10px !important;
    font-size: 11px !important;
}

.assignment-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.assignment-card {
    padding: 10px;
    border-radius: 14px;
    border: 1px solid #dbe3f4;
    background: #fbfdff;
}

.assignment-card-title {
    color: #1e2f6f;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.1;
}

.assignment-card-subtitle {
    margin-top: 3px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.assignment-targets {
    display: grid;
    gap: 5px;
    margin-top: 8px;
}

.assignment-targets label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 6px;
    border-radius: 9px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 11px;
    font-weight: 900;
}

.assignment-targets input {
    width: 14px;
    height: 14px;
}

.role-permission-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.role-permission-card {
    padding: 10px;
    border-radius: 14px;
    border: 1px solid #dbe3f4;
    background: #fbfdff;
}

.role-permission-card-title {
    color: #1e2f6f;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.1;
}

.role-permission-card-description {
    margin-top: 5px;
    color: #334155;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
}

.role-permission-card-pills {
    margin-top: 8px;
    max-height: 120px;
    overflow: auto;
}

.role-permission-card-pills span {
    font-size: 9px !important;
}

/* Make disabled users disappear completely when PHP filtered them;
   this only keeps visible inactive cards compact when setting is off. */
.inactive-user-card .portal-user-login::after {
    content: " отключён";
    margin-left: 5px;
    color: #991b1b;
    font-size: 9px;
    font-weight: 900;
}

/* Live hiding inactive users in portal settings */
.portal-user-card[data-user-active="0"] {
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* === AST DISABLED DUPLICATED INACTIVE USER CARD RULE 2026-04-26 ===
   Удалён ранний дубль .portal-user-card.ast-hidden-inactive: original lines 2791-2796.
   Активным оставлено последнее правило: original lines 2806-2811.
   Оригиналы сохранены в: /var/www/ast-css-disabled-inactive-user-card-duplicates-20260426_213840.css
=== AST DISABLED DUPLICATED INACTIVE USER CARD RULE END === */
/* Positive logic for disabled users visibility:
   checked = show disabled users, unchecked = hide disabled users */
.portal-layout-check span {
    user-select: none;
}

/* === AST DISABLED DUPLICATED INACTIVE USER CARD RULE 2026-04-26 ===
   Удалён ранний дубль .portal-user-card.ast-hidden-inactive: original lines 2801-2806.
   Активным оставлено последнее правило: original lines 2806-2811.
   Оригиналы сохранены в: /var/www/ast-css-disabled-inactive-user-card-duplicates-20260426_213840.css
=== AST DISABLED DUPLICATED INACTIVE USER CARD RULE END === */
/* Final persistent disabled users visibility */
.portal-user-card.ast-hidden-inactive {
    display: none !important;
}

/* ===== Log analyzer module ===== */
.portal-logs-page {
    max-width: 1180px;
}

.log-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.log-stat-card {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #dbe3f4;
    background: #fbfdff;
}

.log-stat-card span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

.log-stat-card strong {
    display: block;
    margin-top: 4px;
    color: #1e2f6f;
    font-size: 24px;
    font-weight: 900;
}

.log-stat-card.danger {
    border-color: #fecaca;
    background: #fff5f5;
}

.log-stat-card.danger strong {
    color: #b91c1c;
}

.log-stat-card.warn {
    border-color: #fde68a;
    background: #fffbeb;
}

.log-stat-card.warn strong {
    color: #92400e;
}

.log-storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.log-storage-grid div {
    padding: 10px;
    border-radius: 13px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.log-storage-grid strong,
.log-storage-grid span,
.log-storage-grid code {
    display: block;
}

.log-storage-grid strong {
    color: #1e2f6f;
    font-size: 12px;
    font-weight: 900;
}

.log-storage-grid code,
.log-storage-grid span {
    margin-top: 5px;
    color: #334155;
    font-size: 12px;
}

.log-filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: end;
}
/* === AST DISABLED LOG SAFE BATCH DUPLICATE 2026-04-26 ===
   Selector: .log-filter-form label
   Removed early duplicate: original lines 2899-2904.
   Kept later stronger rule: original lines 3162-3173.
   Removed copy saved in: /var/www/ast-css-disabled-log-safe-batch-20260426_233121.css
=== AST DISABLED LOG SAFE BATCH DUPLICATE END === */

/* === AST DISABLED LOG SAFE BATCH DUPLICATE 2026-04-26 ===
   Selector: .log-filter-form label span
   Removed early duplicate: original lines 2904-2910.
   Kept later stronger rule: original lines 3173-3181.
   Removed copy saved in: /var/www/ast-css-disabled-log-safe-batch-20260426_233121.css
=== AST DISABLED LOG SAFE BATCH DUPLICATE END === */


/* === AST DISABLED DUPLICATED LOG FILTER INPUT RULE 2026-04-26 ===
   Удалён ранний дубль .log-filter-form input/select: original lines 2911-2923.
   Активным оставлен более поздний сильный блок с width/height/!important.
   Оригинал сохранён в: /var/www/ast-css-disabled-log-filter-input-duplicate-20260426_220119.css
=== AST DISABLED DUPLICATED LOG FILTER INPUT RULE END === */
/* === AST DISABLED LOG SAFE BATCH DUPLICATE 2026-04-26 ===
   Selector: .log-events-list
   Removed early duplicate: original lines 2916-2920.
   Kept later stronger rule: original lines 3224-3230.
   Removed copy saved in: /var/www/ast-css-disabled-log-safe-batch-20260426_233121.css
=== AST DISABLED LOG SAFE BATCH DUPLICATE END === */


.log-event-card {
    padding: 10px;
    border-radius: 14px;
    border: 1px solid #dbe3f4;
    background: #fbfdff;
}

.log-event-card.severity-critical,
.log-event-card.severity-alert,
.log-event-card.severity-emergency {
    border-color: #fca5a5;
    background: #fff5f5;
}

.log-event-card.severity-error,
.log-event-card.severity-warning {
    border-color: #fde68a;
    background: #fffbeb;
}

/* === AST DISABLED DUPLICATED LOG EVENT HEAD RULE 2026-04-26 ===
   Удалён ранний дубль .log-event-head: original lines 2941-2950.
   font-size:12px перенесён в поздний сильный блок: original lines 3251-3260.
   Оригинал сохранён в: /var/www/ast-css-disabled-log-event-head-duplicate-20260426_232128.css
=== AST DISABLED DUPLICATED LOG EVENT HEAD RULE END === */
.log-event-head strong {
    color: #1e2f6f;
    text-transform: uppercase;
}

.log-event-head span {
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 900;
}

/* === AST DISABLED DUPLICATED LOG EVENT HEAD EM RULE 2026-04-26 ===
   Удалён ранний дубль .log-event-head em: original lines 2959-2967.
   Активным оставлен поздний сильный блок: original lines 3257-3268.
   Оригинал сохранён в: /var/www/ast-css-disabled-log-event-head-em-duplicate-20260426_232523.css
=== AST DISABLED DUPLICATED LOG EVENT HEAD EM RULE END === */
.log-event-source {
    margin-top: 6px;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
}

.log-event-message {
    margin-top: 5px;
    color: #111827;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Log sources management ===== */
/* === AST DISABLED DUPLICATED LOG SOURCE GRID RULE 2026-04-26 ===
   Удалён ранний дубль .log-source-grid: original lines 2987-2994.
   Активным оставлен поздний сильный блок: original lines 3062-3071.
   Оригинал сохранён в: /var/www/ast-css-disabled-log-source-grid-duplicate-20260426_231539.css
=== AST DISABLED DUPLICATED LOG SOURCE GRID RULE END === */
.log-source-card {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 10px;
    border-radius: 15px;
    border: 1px solid #dbe3f4;
    background: #fbfdff;
}

.log-source-card.disabled-source {
    opacity: 0.65;
    border-style: dashed;
}

/* === AST DISABLED DUPLICATED LOG SOURCE HEAD RULE 2026-04-26 ===
   Удалён ранний дубль .log-source-head: original lines 3008-3016.
   Активным оставлен поздний сильный блок: original lines 3116-3125.
   Оригинал сохранён в: /var/www/ast-css-disabled-log-source-head-duplicate-20260426_230725.css
=== AST DISABLED DUPLICATED LOG SOURCE HEAD RULE END === */
.log-source-head strong {
    display: block;
    color: #1e2f6f;
    font-size: 15px;
    font-weight: 900;
}

.log-source-head span {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.log-source-card label {
    display: grid;
    gap: 4px;
}

.log-source-card label span {
    color: #334155;
    font-size: 11px;
    font-weight: 900;
}

.log-source-card input,
.log-source-card select {
    width: 100%;
    min-height: 29px;
    padding: 5px 8px;
    border-radius: 10px;
    border: 1px solid #c7d2fe;
    background: #fff;
    color: #111827;
    font-size: 12px;
}

/* === AST DISABLED DUPLICATED LOG SOURCE CHECK LINE RULE 2026-04-26 ===
   Удалён ранний дубль .log-source-card .check-line: original lines 3053-3059.
   Активным оставлен поздний сильный блок: original lines 3103-3110.
   Оригинал сохранён в: /var/www/ast-css-disabled-log-source-check-line-duplicate-20260426_225526.css
=== AST DISABLED DUPLICATED LOG SOURCE CHECK LINE RULE END === */
/* === AST DISABLED DUPLICATED LOG SOURCE CHECK INPUT RULE 2026-04-26 ===
   Удалён ранний дубль .log-source-card .check-line input: original lines 3058-3064.
   min-height:auto перенесён в поздний сильный блок: original lines 3109-3116.
   Оригинал сохранён в: /var/www/ast-css-disabled-log-source-check-input-duplicate-20260426_224625.css
=== AST DISABLED DUPLICATED LOG SOURCE CHECK INPUT RULE END === */
/* ===== Exact fix: log source cards layout ===== */
.log-source-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 300px)) !important;
    gap: 14px !important;
    align-items: start !important;
    justify-content: start !important;
}

.log-source-card {
    box-sizing: border-box !important;
    width: 300px !important;
    max-width: 300px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 10px !important;
    margin: 0 !important;
}

.log-source-card *,
.log-source-card *::before,
.log-source-card *::after {
    box-sizing: border-box !important;
}

.log-source-card label {
    width: 100% !important;
    min-width: 0 !important;
}

.log-source-card input:not([type="checkbox"]):not([type="radio"]),
.log-source-card select,
.log-source-card textarea {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

.log-source-card .check-line {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.log-source-card .check-line input {
    width: auto !important;
    max-width: none !important;
    min-width: auto !important;
    min-height: auto !important;
}

.log-source-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 8px !important;
    min-width: 0 !important;
}

.log-source-head > div {
    min-width: 0 !important;
}

.log-source-head strong,
.log-source-head span {
    max-width: 170px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.log-source-head .btn {
    flex: 0 0 auto !important;
    min-height: 28px !important;
    padding: 5px 9px !important;
    font-size: 11px !important;
}

/* On narrow screens cards use full width */
@media (max-width: 760px) {
    .log-source-grid {
        grid-template-columns: 1fr !important;
    }

    .log-source-card {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ===== Logs page: block filter layout and block results ===== */

/* Search/filter block */
.log-filter-form {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 12px !important;
    align-items: stretch !important;
}

.log-filter-form *,
.log-filter-form *::before,
.log-filter-form *::after {
    box-sizing: border-box !important;
}

.log-filter-form label {
    display: grid !important;
    gap: 6px !important;
    min-width: 0 !important;
    width: 100% !important;
    padding: 10px !important;
    border-radius: 14px !important;
    border: 1px solid #dbe3f4 !important;
    background: #fbfdff !important;
}

.log-filter-form label span {
    display: block !important;
    color: #334155 !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
}

.log-filter-form input,
.log-filter-form select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 6px 9px !important;
    border-radius: 10px !important;
    border: 1px solid #c7d2fe !important;
    background: #fff !important;
    color: #111827 !important;
    font-size: 12px !important;
}

/* Date fields: give browser calendar enough room */
.log-filter-form input[type="date"] {
    min-width: 170px !important;
    font-family: inherit !important;
}

/* Direct buttons inside the filter form */
.log-filter-form > .btn,
.log-filter-form > button,
.log-filter-form > a.btn {
    align-self: end !important;
    width: 100% !important;
    min-height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* Keep Reset as a normal card-like action */
.log-filter-form > a.btn {
    text-decoration: none !important;
}

/* Results block grid */
.log-events-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)) !important;
    gap: 12px !important;
    align-items: start !important;
}

.log-event-card {
    box-sizing: border-box !important;
    min-width: 0 !important;
    width: 100% !important;
    padding: 12px !important;
    border-radius: 15px !important;
    overflow: hidden !important;
}

.log-event-card *,
.log-event-card *::before,
.log-event-card *::after {
    box-sizing: border-box !important;
}

.log-event-head {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
    flex-wrap: wrap !important;
    min-width: 0 !important;
    font-size: 12px !important;
}

.log-event-head em {
    margin-left: 0 !important;
    flex: 1 1 100% !important;
    text-align: right !important;
    color: #64748b !important;
    font-size: 11px !important;
    font-style: normal !important;
    font-weight: 900 !important;
}

.log-event-source {
    margin-top: 7px !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.log-event-message {
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    white-space: pre-wrap !important;
}

/* Storage cards: prevent long paths from breaking layout */
.log-storage-grid div {
    min-width: 0 !important;
    overflow: hidden !important;
}

.log-storage-grid code {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

/* Smaller screens */
@media (max-width: 900px) {
    .log-filter-form {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
    }

    .log-events-list {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 560px) {
    .log-filter-form {
        grid-template-columns: 1fr !important;
    }

    .log-filter-form input[type="date"] {
        min-width: 0 !important;
    }
}


/* ===== Global portal theme selector ===== */
.portal-theme-control {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: calc(var(--portal-nav-height, 30px) - 8px);
    padding: 0 5px 0 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .88);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.portal-theme-control span {
    opacity: .86;
}

.portal-theme-control select {
    height: 21px;
    max-width: 132px;
    border: 0;
    border-radius: 999px;
    padding: 0 22px 0 8px;
    background: rgba(255, 255, 255, .94);
    color: #25005c;
    font-size: 11px;
    font-weight: 800;
    outline: none;
}

.portal-theme-control select:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
}

.portal-user {
    gap: 8px !important;
}

@media (max-width: 980px) {
    .portal-theme-control span {
        display: none;
    }

    .portal-theme-control select {
        max-width: 108px;
    }
}


/* ===== Portal pages theme support ===== */
body[class*="theme-"] .portal-page-app,
body[class*="theme-"] .portal-page {
    background:
        radial-gradient(circle at 20% 0%, rgba(122, 92, 255, .10), transparent 32%),
        linear-gradient(135deg, var(--ast-bg-start, #f6f8ff), var(--ast-bg-end, #edf3ff));
    color: var(--ast-text, #253054);
}

body[class*="theme-"] .portal-page-card {
    background: var(--ast-card-bg, rgba(255, 255, 255, .88));
    color: var(--ast-text, #253054);
    border-color: rgba(122, 92, 255, .22);
    box-shadow: 0 18px 50px rgba(43, 26, 96, .12);
}

body[class*="theme-"] .portal-page-card h1,
body[class*="theme-"] .portal-page-card h2,
body[class*="theme-"] .portal-page-card h3 {
    color: var(--ast-title, #2a0068);
}

body[class*="theme-"] .portal-page-kicker,
body[class*="theme-"] .portal-page-note,
body[class*="theme-"] .log-rule-note,
body[class*="theme-"] .logs-work-panel-title-text span,
body[class*="theme-"] .portal-section-title span {
    color: var(--ast-muted, #5b6380);
}

body[class*="theme-"] .portal-settings-block,
body[class*="theme-"] .logs-work-panel,
body[class*="theme-"] .portal-section-toolbar,
body[class*="theme-"] .portal-help-panel,
body[class*="theme-"] .portal-help-card,
body[class*="theme-"] .log-source-card,
body[class*="theme-"] .rules-row {
    background: var(--ast-panel-bg, rgba(255, 255, 255, .78));
    color: var(--ast-text, #253054);
    border-color: rgba(122, 92, 255, .22);
}

body[class*="theme-"] .log-stat-card {
    background: var(--ast-panel-bg, rgba(255, 255, 255, .72));
    color: var(--ast-text, #253054);
    border-color: rgba(122, 92, 255, .18);
}

body[class*="theme-"] .log-stat-card strong {
    color: var(--ast-title, #2a0068);
}

body[class*="theme-"] .portal-help-card p,
body[class*="theme-"] .portal-help-card li,
body[class*="theme-"] .log-event-message,
body[class*="theme-"] .log-event-source {
    color: var(--ast-text, #253054);
}

body[class*="theme-"] input,
body[class*="theme-"] select,
body[class*="theme-"] textarea {
    background: var(--ast-input-bg, rgba(255, 255, 255, .96));
    color: var(--ast-text, #253054);
    border-color: rgba(122, 92, 255, .28);
}

body[class*="theme-"] input::placeholder,
body[class*="theme-"] textarea::placeholder {
    color: var(--ast-muted, #6b7280);
}

body.theme-ast_contrast .portal-page-app,
body.theme-ast_contrast .portal-page {
    --ast-card-bg: rgba(255, 255, 255, .92);
    --ast-panel-bg: rgba(248, 250, 255, .86);
}

body.theme-ast_gray .portal-page-app,
body.theme-ast_gray .portal-page {
    --ast-card-bg: rgba(255, 255, 255, .90);
    --ast-panel-bg: rgba(248, 250, 252, .86);
}

body.theme-ast_green .portal-page-app,
body.theme-ast_green .portal-page {
    --ast-card-bg: rgba(255, 255, 255, .90);
    --ast-panel-bg: rgba(247, 255, 250, .86);
}

/* ===== AST Portal unified toolbar and button system =====
   Финальный единый стиль.
   Эталон — верхняя рабочая панель карты #toolbar.
   Используется для карты, логов, правил, добавления устройства и будущих разделов.
*/

:root {
    --ast-top-btn-height: 30px;
    --ast-top-btn-radius: 999px;
    --ast-top-btn-px: 13px;
    --ast-top-btn-font-size: 12px;
}

/* Рабочая панель раздела под глобальным меню портала */
.portal-work-panel-global {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;

    height: var(--map-toolbar-height, 40px) !important;
    min-height: var(--map-toolbar-height, 40px) !important;

    margin: 0 !important;
    padding: 2px 18px !important;

    border: 0 !important;
    border-radius: 0 !important;

    background: linear-gradient(
        135deg,
        var(--map-toolbar-color-from, #eef2ff) 0%,
        var(--map-toolbar-color-to, #dbe6ff) 100%
    ) !important;

    box-shadow: none !important;
    box-sizing: border-box !important;
}

.portal-work-panel-left {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 1px !important;
    min-width: 260px !important;
    overflow: hidden !important;
}

.portal-work-panel-title {
    color: var(--ast-title, #1e2f6f) !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.portal-work-panel-subtitle {
    color: var(--ast-muted, #526b90) !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.portal-work-panel-actions,
#toolbar .controls {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
}

/* Единая базовая кнопка */
.btn,
button.btn,
a.btn,
#toolbar .controls .btn,
#toolbar .controls a.btn,
#toolbar .controls button.btn,
.portal-work-panel-actions .btn,
.portal-work-panel-actions a.btn,
.portal-work-panel-actions button.btn {
    appearance: none !important;
    -webkit-appearance: none !important;

    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;

    height: var(--ast-top-btn-height) !important;
    min-height: var(--ast-top-btn-height) !important;
    max-height: var(--ast-top-btn-height) !important;

    padding: 0 var(--ast-top-btn-px) !important;
    margin: 0 !important;

    border-radius: var(--ast-top-btn-radius) !important;
    border: 1px solid color-mix(in srgb, var(--ast-blue-main, #3c75ff) 34%, transparent) !important;

    background: color-mix(in srgb, var(--ast-button-bg, #ffffff) 88%, var(--ast-blue-main, #3c75ff) 12%) !important;
    color: var(--ast-button-text, #315fbe) !important;

    box-shadow: 0 6px 16px color-mix(in srgb, var(--ast-shadow, rgba(60, 117, 255, .12)) 72%, transparent) !important;

    font-size: var(--ast-top-btn-font-size) !important;
    font-weight: 850 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    white-space: nowrap !important;

    cursor: pointer !important;
    transition:
        transform .12s ease,
        box-shadow .12s ease,
        border-color .12s ease,
        background .12s ease,
        color .12s ease !important;
}

.btn:hover,
button.btn:hover,
a.btn:hover,
#toolbar .controls .btn:hover,
#toolbar .controls a.btn:hover,
#toolbar .controls button.btn:hover,
.portal-work-panel-actions .btn:hover,
.portal-work-panel-actions a.btn:hover,
.portal-work-panel-actions button.btn:hover {
    transform: translateY(-1px) !important;
    background: color-mix(in srgb, var(--ast-button-hover, #edf4ff) 78%, var(--ast-blue-main, #3c75ff) 22%) !important;
    border-color: color-mix(in srgb, var(--ast-blue-main, #3c75ff) 55%, transparent) !important;
    box-shadow: 0 9px 22px color-mix(in srgb, var(--ast-shadow, rgba(60, 117, 255, .12)) 92%, transparent) !important;
}

.btn:active,
button.btn:active,
a.btn:active,
#toolbar .controls .btn:active,
#toolbar .controls a.btn:active,
#toolbar .controls button.btn:active,
.portal-work-panel-actions .btn:active,
.portal-work-panel-actions a.btn:active,
.portal-work-panel-actions button.btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 3px 10px color-mix(in srgb, var(--ast-shadow, rgba(60, 117, 255, .12)) 60%, transparent) !important;
}

/* Главная кнопка */
.btn.primary,
button.btn.primary,
a.btn.primary,
#toolbar .controls .btn.primary,
#toolbar .controls button.btn.primary,
#toolbar .controls a.btn.primary,
.portal-work-panel-actions .btn.primary,
.portal-work-panel-actions button.btn.primary,
.portal-work-panel-actions a.btn.primary {
    background: linear-gradient(
        135deg,
        var(--ast-blue-main, #3c75ff) 0%,
        var(--ast-blue-dark, #2f63de) 100%
    ) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--ast-blue-main, #3c75ff) 34%, transparent) !important;
}

/* Малые кнопки внутри карточек, таблиц и форм */
.log-source-head .btn,
.rules-row .btn,
.log-compact-form .btn,
.add-device-actions .btn {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    padding: 0 11px !important;
    border-radius: 999px !important;
    font-size: 11px !important;
}

/* Disabled */
.btn:disabled,
button.btn:disabled,
#toolbar button:disabled,
.map-edit-bar button:disabled {
    opacity: .48 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Тёмные темы */
body.theme-ast_dark .btn,
body.theme-ast_dark button.btn,
body.theme-ast_dark a.btn,
body.theme-noc_night .btn,
body.theme-noc_night button.btn,
body.theme-noc_night a.btn {
    background: color-mix(in srgb, var(--ast-button-bg, #1e293b) 88%, var(--ast-blue-main, #06b6d4) 12%) !important;
    color: var(--ast-button-text, #ecfeff) !important;
    border-color: color-mix(in srgb, var(--ast-blue-main, #06b6d4) 38%, transparent) !important;
    box-shadow: 0 7px 18px rgba(0, 0, 0, .28) !important;
}

body.theme-ast_dark .btn.primary,
body.theme-ast_dark button.btn.primary,
body.theme-ast_dark a.btn.primary,
body.theme-noc_night .btn.primary,
body.theme-noc_night button.btn.primary,
body.theme-noc_night a.btn.primary {
    background: linear-gradient(
        135deg,
        var(--ast-blue-main, #06b6d4) 0%,
        var(--ast-blue-dark, #0891b2) 100%
    ) !important;
    color: #ffffff !important;
}

/* Страница после рабочей панели */
.portal-work-panel-global + .portal-page {
    padding-top: 14px !important;
}

@media (max-width: 900px) {
    .portal-work-panel-global {
        height: auto !important;
        min-height: var(--map-toolbar-height, 40px) !important;
        align-items: stretch !important;
        flex-direction: column !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    .portal-work-panel-actions,
    #toolbar .controls {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }
}

/* ===== Portal section help panels ===== */
.portal-section-help-panel {
    display: none;
    margin: 0;
    padding: 14px 18px;
    border-top: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 70%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 70%, transparent);
    background: color-mix(in srgb, var(--ast-card-bg, #ffffff) 92%, var(--ast-blue-main, #3c75ff) 8%);
    color: var(--ast-text, #244264);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--ast-shadow, rgba(60,117,255,.12)) 70%, transparent);
}

.portal-section-help-panel.open {
    display: block;
}

.portal-section-help-panel h2 {
    margin: 0 0 12px;
    color: var(--ast-title, #1e2f6f);
    font-size: 18px;
}

.portal-section-help-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 12px;
}

.portal-section-help-card {
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
    border-radius: 14px;
    background: var(--ast-panel-bg, rgba(255,255,255,.78));
}

.portal-section-help-card h3 {
    margin: 0 0 8px;
    color: var(--ast-title, #1e2f6f);
    font-size: 14px;
}

.portal-section-help-card p,
.portal-section-help-card li {
    color: var(--ast-text, #244264);
    font-size: 13px;
    line-height: 1.45;
}

.portal-section-help-card ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.portal-section-help-warning {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(239, 68, 68, .25);
    border-radius: 14px;
    background: rgba(255, 245, 245, .86);
    color: #7f1d1d;
    font-size: 13px;
    font-weight: 800;
}

/* === AST DISABLED OLD PORTAL NAV BLOCK 2026-04-26 ===
   Старый блок 'Theme-aware global portal nav: always darker than the page theme'
   удалён из активного CSS, потому что полностью перекрывался следующим блоком:
   'FINAL: soft theme-aware portal nav'.
   Оригинал сохранён в: /root/ast-css-disabled-old-portal-nav-20260426_174440.css
=== AST DISABLED OLD PORTAL NAV BLOCK END === */

@media (max-width: 1100px) {
    .portal-section-help-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== FINAL: soft theme-aware portal nav =====
   Панель портала должна быть в цвет темы и всего на пару тонов темнее основного фона.
   Для светлых тем текст делаем тёмным, для тёмных тем — светлым.
*/

body.theme-ast_light {
    --portal-nav-color-from: #eee9ff;
    --portal-nav-color-to: #ded4ff;
    --portal-nav-text: #2a0068;
    --portal-nav-muted: #5b4a88;
    --portal-nav-active-bg: rgba(42, 0, 104, .12);
    --portal-nav-border: rgba(122, 92, 255, .20);
}

body.theme-ast_blue {
    --portal-nav-color-from: #e2edff;
    --portal-nav-color-to: #cddfff;
    --portal-nav-text: #183b72;
    --portal-nav-muted: #486996;
    --portal-nav-active-bg: rgba(60, 117, 255, .13);
    --portal-nav-border: rgba(60, 117, 255, .22);
}

body.theme-ast_white {
    --portal-nav-color-from: #f1f5f9;
    --portal-nav-color-to: #e2e8f0;
    --portal-nav-text: #1e293b;
    --portal-nav-muted: #475569;
    --portal-nav-active-bg: rgba(51, 65, 85, .10);
    --portal-nav-border: rgba(100, 116, 139, .22);
}

body.theme-ast_green {
    --portal-nav-color-from: #e6fff0;
    --portal-nav-color-to: #cff3df;
    --portal-nav-text: #14532d;
    --portal-nav-muted: #3f6f55;
    --portal-nav-active-bg: rgba(40, 169, 107, .14);
    --portal-nav-border: rgba(40, 169, 107, .22);
}

body.theme-ast_gray {
    --portal-nav-color-from: #edf1f5;
    --portal-nav-color-to: #dce3eb;
    --portal-nav-text: #263445;
    --portal-nav-muted: #5d6b7c;
    --portal-nav-active-bg: rgba(76, 99, 133, .13);
    --portal-nav-border: rgba(100, 116, 139, .22);
}

body.theme-ast_contrast {
    --portal-nav-color-from: #e2eaff;
    --portal-nav-color-to: #cbd9ff;
    --portal-nav-text: #102a66;
    --portal-nav-muted: #425f92;
    --portal-nav-active-bg: rgba(36, 92, 255, .14);
    --portal-nav-border: rgba(36, 92, 255, .24);
}

body.theme-ast_dark {
    --portal-nav-color-from: #0b1120;
    --portal-nav-color-to: #111827;
    --portal-nav-text: #e5edff;
    --portal-nav-muted: #9caecb;
    --portal-nav-active-bg: rgba(122, 162, 255, .18);
    --portal-nav-border: rgba(122, 162, 255, .18);
}

body.theme-noc_night {
    --portal-nav-color-from: #020617;
    --portal-nav-color-to: #061525;
    --portal-nav-text: #ecfeff;
    --portal-nav-muted: #8bb3c7;
    --portal-nav-active-bg: rgba(34, 211, 238, .16);
    --portal-nav-border: rgba(34, 211, 238, .18);
}

.portal-nav {
    background: linear-gradient(
        135deg,
        var(--portal-nav-color-from, #eee9ff) 0%,
        var(--portal-nav-color-to, #ded4ff) 100%
    ) !important;
    border-bottom: 1px solid var(--portal-nav-border, rgba(122, 92, 255, .20)) !important;
    box-shadow: 0 2px 10px rgba(43, 26, 96, .08) !important;
}

.portal-nav,
.portal-nav a,
.portal-brand-text,
.portal-user-name,
.portal-theme-control {
    color: var(--portal-nav-text, #2a0068) !important;
}

.portal-brand-mark {
    background: var(--ast-blue-main, #3c75ff) !important;
    color: #ffffff !important;
}

.portal-links a {
    color: var(--portal-nav-text, #2a0068) !important;
    opacity: .92 !important;
}

.portal-links a:hover {
    background: var(--portal-nav-active-bg, rgba(42, 0, 104, .12)) !important;
    color: var(--portal-nav-text, #2a0068) !important;
    opacity: 1 !important;
}

.portal-links a.active {
    background: var(--portal-nav-active-bg, rgba(42, 0, 104, .12)) !important;
    color: var(--portal-nav-text, #2a0068) !important;
    opacity: 1 !important;
}

.portal-logout {
    background: var(--portal-nav-active-bg, rgba(42, 0, 104, .12)) !important;
    color: var(--portal-nav-text, #2a0068) !important;
    border: 1px solid var(--portal-nav-border, rgba(122, 92, 255, .20)) !important;
}

.portal-theme-control {
    background: rgba(255, 255, 255, .36) !important;
    border: 1px solid var(--portal-nav-border, rgba(122, 92, 255, .20)) !important;
}

.portal-theme-control span {
    color: var(--portal-nav-muted, #5b4a88) !important;
}

.portal-theme-control select {
    background: rgba(255, 255, 255, .82) !important;
    color: var(--portal-nav-text, #2a0068) !important;
    border: 1px solid var(--portal-nav-border, rgba(122, 92, 255, .20)) !important;
}

/* В тёмных темах селектор темы должен быть читаемым */
body.theme-ast_dark .portal-theme-control,
body.theme-noc_night .portal-theme-control {
    background: rgba(255, 255, 255, .08) !important;
}

body.theme-ast_dark .portal-theme-control select,
body.theme-noc_night .portal-theme-control select {
    background: rgba(15, 23, 42, .92) !important;
    color: var(--portal-nav-text, #ecfeff) !important;
}

/* ===== FINAL: AST light neutral portal nav =====
   AST светлая не должна уходить в фиолетовый.
   Панель портала делаем светло-серо-голубой, всего на пару тонов темнее фона.
*/
body.theme-ast_light {
    --portal-nav-color-from: #edf3fb;
    --portal-nav-color-to: #dce7f5;
    --portal-nav-text: #18345f;
    --portal-nav-muted: #5b6f8c;
    --portal-nav-active-bg: rgba(60, 117, 255, .12);
    --portal-nav-border: rgba(60, 117, 255, .18);
}

body.theme-ast_light .portal-nav {
    background: linear-gradient(
        135deg,
        var(--portal-nav-color-from) 0%,
        var(--portal-nav-color-to) 100%
    ) !important;
    border-bottom: 1px solid var(--portal-nav-border) !important;
}

body.theme-ast_light .portal-links a.active,
body.theme-ast_light .portal-links a:hover,
body.theme-ast_light .portal-logout {
    background: var(--portal-nav-active-bg) !important;
    color: var(--portal-nav-text) !important;
}

body.theme-ast_light .portal-theme-control {
    background: rgba(255, 255, 255, .48) !important;
    border-color: var(--portal-nav-border) !important;
}

/* ===== Portal branding settings form ===== */
.portal-branding-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 12px;
    align-items: end;
}

.portal-branding-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.portal-branding-form label span {
    color: var(--ast-muted, #6f86a3);
    font-size: 12px;
    font-weight: 850;
}

.portal-branding-form input {
    width: 100%;
    box-sizing: border-box;
}

.portal-branding-preview {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 2px;
}

.portal-branding-preview > div {
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 80%, transparent);
    border-radius: 14px;
    background: var(--ast-panel-bg, rgba(255,255,255,.72));
}

.portal-branding-preview span {
    display: block;
    margin-bottom: 4px;
    color: var(--ast-muted, #6f86a3);
    font-size: 11px;
    font-weight: 850;
}

.portal-branding-preview strong {
    color: var(--ast-title, #1e2f6f);
    font-size: 13px;
}

.portal-branding-form button {
    justify-self: start;
}

@media (max-width: 900px) {
    .portal-branding-form,
    .portal-branding-preview {
        grid-template-columns: 1fr;
    }
}

/* Device display name editor */
.device-display-name-form {
    margin: 8px 0 12px 0;
    padding: 10px;
    border: 1px solid rgba(110, 130, 170, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.55);
}

.device-display-name-label {
    display: grid;
    gap: 5px;
    font-size: 12px;
    color: var(--ast-muted, #6d7893);
}

.device-display-name-label input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 9px;
    border: 1px solid rgba(110, 130, 170, 0.35);
    border-radius: 9px;
    background: var(--ast-input-bg, #fff);
    color: var(--ast-text, #1f2a44);
}

.device-display-name-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.device-display-name-actions button {
    border: 0;
    border-radius: 9px;
    padding: 7px 10px;
    cursor: pointer;
}

.device-display-name-hint,
.device-display-name-message {
    margin-top: 7px;
    font-size: 12px;
    color: var(--ast-muted, #6d7893);
}

.device-display-name-message.error {
    color: #b00020;
    font-weight: 700;
}

/* Bulk device display-name editor in map settings */
.device-display-name-row {
    margin: 10px 0 8px 0;
    display: grid;
    gap: 5px;
}

.device-display-name-row label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ast-muted, #6b7390);
}

.device-display-name-row input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(140, 100, 255, .28);
    border-radius: 9px;
    padding: 7px 9px;
    background: var(--ast-input-bg, #fff);
    color: var(--ast-text, #1f2a44);
}

/* ===== AST portal fixed footer ===== */
.portal-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    min-height: var(--portal-topbar-height, 30px);
    box-sizing: border-box;
    padding: 6px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: linear-gradient(
        90deg,
        var(--portal-panel-start, rgba(240, 235, 255, .96)),
        var(--portal-panel-end, rgba(228, 238, 255, .96))
    );
    border-top: 1px solid rgba(130, 100, 255, .22);
    color: var(--ast-text, #1f2a44);
    font-size: 12px;
    line-height: 1.35;
    backdrop-filter: blur(10px);
}

.portal-footer-left,
.portal-footer-right {
    opacity: .94;
}

.portal-footer-right {
    text-align: right;
    font-weight: 700;
}

/* === AST DISABLED DUPLICATED BODY PADDING 2026-04-26 ===
   Удалён ранний дубль body padding-bottom: original lines 4150-4155.
   Активным оставлено последнее правило: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important.
   Оригиналы сохранены в: /var/www/ast-css-disabled-body-padding-duplicates-20260426_210953.css
=== AST DISABLED DUPLICATED BODY PADDING END === */
#network {
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .portal-footer {
        position: static;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .portal-footer-right {
        text-align: left;
    }

    body {
        padding-bottom: 0;
    }
}

/* ===== AST final portal footer panel override ===== */
.ast-portal-footer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99990 !important;
    height: 30px !important;
    min-height: 30px !important;
    box-sizing: border-box !important;
    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;
    background: linear-gradient(90deg, #efe9ff 0%, #e9efff 100%) !important;
    border-top: 1px solid rgba(130, 100, 255, .28) !important;
    color: #1f2a44 !important;
    font-size: 12px !important;
    line-height: 30px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    box-shadow: 0 -8px 22px rgba(90, 70, 180, .10) !important;
}

.ast-portal-footer-left,
.ast-portal-footer-right {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.ast-portal-footer-left {
    flex: 0 1 auto !important;
}

.ast-portal-footer-right {
    flex: 1 1 auto !important;
    text-align: right !important;
    font-weight: 700 !important;
}

/* === AST DISABLED DUPLICATED BODY PADDING 2026-04-26 ===
   Удалён ранний дубль body padding-bottom: original lines 4217-4222.
   Активным оставлено последнее правило: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important.
   Оригиналы сохранены в: /var/www/ast-css-disabled-body-padding-duplicates-20260426_210953.css
=== AST DISABLED DUPLICATED BODY PADDING END === */
.portal-links a.portal-settings-tool-link {
    font-size: 12px;
    opacity: .95;
}

.map-settings-top-panel {
    max-width: 1150px;
    margin: 16px auto 18px auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.map-settings-top-panel h1 {
    margin: 0 0 4px 0;
}

.map-settings-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.map-settings-actions a {
    border-radius: 999px;
    padding: 9px 14px;
    text-decoration: none;
    font-weight: 800;
    border: 1px solid rgba(107, 0, 255, .25);
    background: rgba(107, 0, 255, .10);
    color: #5a00c8;
}

.map-settings-actions a.primary {
    background: #6b00ff;
    color: #fff;
    box-shadow: 0 10px 24px rgba(107, 0, 255, .18);
}

@media (max-width: 900px) {
    .ast-portal-footer {
        position: static !important;
        height: auto !important;
        line-height: 1.35 !important;
        padding: 6px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        white-space: normal !important;
    }

    .ast-portal-footer-right {
        text-align: left !important;
    }

    body {
        padding-bottom: 0 !important;
    }

    .map-settings-top-panel {
        flex-direction: column;
    }

    .map-settings-actions {
        justify-content: flex-start;
    }
}

/* ===== AST final portal nav/footer repair ===== */
body.theme-ast-light,
body.theme-ast_light,
body.theme-ast-dark,
body.theme-ast_dark {
    padding-bottom: 30px !important;
}

/* Верхняя панель портала: страховка для старых страниц */
.portal-topbar,
.portal-nav,
.portal-header,
.portal-panel,
.portal-mainbar {
    box-sizing: border-box;
}

.portal-links {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
}

.portal-links a,
.portal-settings-tool-link {
    text-decoration: none !important;
    font-weight: 800 !important;
}

.portal-settings-tool-link {
    border-radius: 999px !important;
    padding: 4px 10px !important;
    background: rgba(107, 0, 255, .09) !important;
    border: 1px solid rgba(107, 0, 255, .18) !important;
}

/* Нижняя панель портала */
.ast-portal-footer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99990 !important;

    height: 30px !important;
    min-height: 30px !important;
    box-sizing: border-box !important;

    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;

    background: linear-gradient(90deg, #efe9ff 0%, #e9efff 100%) !important;
    border-top: 1px solid rgba(130, 100, 255, .30) !important;
    box-shadow: 0 -8px 24px rgba(90, 70, 180, .10) !important;

    color: #1f2a44 !important;
    font-size: 12px !important;
    line-height: 30px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.ast-portal-footer-left,
.ast-portal-footer-right {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.ast-portal-footer-left {
    flex: 0 1 auto !important;
}

.ast-portal-footer-right {
    flex: 1 1 auto !important;
    text-align: right !important;
    font-weight: 700 !important;
}

/* Верхняя шапка страницы настроек карты */
.map-settings-top-panel {
    max-width: 1150px !important;
    margin: 16px auto 18px auto !important;
    padding: 0 24px !important;
}

.map-settings-top-panel h1 {
    margin: 0 0 4px 0 !important;
}

@media (max-width: 900px) {
    body.theme-ast-light,
    body.theme-ast_light,
    body.theme-ast-dark,
    body.theme-ast_dark {
        padding-bottom: 0 !important;
    }

    .ast-portal-footer {
        position: static !important;
        height: auto !important;
        min-height: 30px !important;
        line-height: 1.35 !important;
        padding: 6px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        white-space: normal !important;
    }

    .ast-portal-footer-right {
        text-align: left !important;
    }
}

/* ===== AST portal footer: common bottom portal panel ===== */
.ast-portal-footer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99990 !important;

    height: 30px !important;
    min-height: 30px !important;
    box-sizing: border-box !important;

    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;

    background: linear-gradient(90deg, #efe9ff 0%, #e9efff 100%) !important;
    border-top: 1px solid rgba(130, 100, 255, .30) !important;
    box-shadow: 0 -8px 24px rgba(90, 70, 180, .10) !important;

    color: #1f2a44 !important;
    font-size: 12px !important;
    line-height: 30px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.ast-portal-footer-left,
.ast-portal-footer-right {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.ast-portal-footer-left {
    flex: 0 1 auto !important;
}

.ast-portal-footer-right {
    flex: 1 1 auto !important;
    text-align: right !important;
    font-weight: 700 !important;
}

/* Чтобы нижняя панель не перекрывала контент */
/* === AST DISABLED DUPLICATED BODY PADDING 2026-04-26 ===
   Удалён ранний дубль body padding-bottom: original lines 4456-4461.
   Активным оставлено последнее правило: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important.
   Оригиналы сохранены в: /var/www/ast-css-disabled-body-padding-duplicates-20260426_210953.css
=== AST DISABLED DUPLICATED BODY PADDING END === */
.portal-settings-tool-link {
    border-radius: 999px !important;
    padding: 4px 10px !important;
    background: rgba(107, 0, 255, .09) !important;
    border: 1px solid rgba(107, 0, 255, .18) !important;
    text-decoration: none !important;
    font-weight: 800 !important;
}

@media (max-width: 900px) {
    .ast-portal-footer {
        position: static !important;
        height: auto !important;
        min-height: 30px !important;
        line-height: 1.35 !important;
        padding: 6px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        white-space: normal !important;
    }

    .ast-portal-footer-right {
        text-align: left !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* Settings section local tools: belongs to settings section, not global portal nav */
.settings-section-tools {
    max-width: 1180px;
    margin: 10px auto 0 auto;
    padding: 0 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-section-tools .btn {
    border-radius: 999px;
    padding: 8px 13px;
    text-decoration: none;
    font-weight: 800;
    background: rgba(107, 0, 255, .10);
    border: 1px solid rgba(107, 0, 255, .25);
    color: var(--ast-accent, #5a00c8);
}

/* ===== AST portal footer: theme-aware final override ===== */
.ast-portal-footer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99990 !important;

    height: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
    min-height: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
    box-sizing: border-box !important;

    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;

    background: linear-gradient(
        90deg,
        var(--portal-footer-color-from, var(--portal-nav-color-from, #170034)) 0%,
        var(--portal-footer-color-to, var(--portal-nav-color-to, #1e2f6f)) 100%
    ) !important;

    border-top: 1px solid rgba(255, 255, 255, .18) !important;
    box-shadow: 0 -8px 24px rgba(20, 20, 60, .14) !important;

    color: #fff !important;
    font-size: 12px !important;
    line-height: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.ast-portal-footer-left,
.ast-portal-footer-right {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.ast-portal-footer-left {
    flex: 0 1 auto !important;
}

.ast-portal-footer-right {
    flex: 1 1 auto !important;
    text-align: right !important;
    font-weight: 700 !important;
}

/* === AST DISABLED DUPLICATED BODY PADDING 2026-04-26 ===
   Удалён ранний дубль body padding-bottom: original lines 4561-4566.
   Активным оставлено последнее правило: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important.
   Оригиналы сохранены в: /var/www/ast-css-disabled-body-padding-duplicates-20260426_210953.css
=== AST DISABLED DUPLICATED BODY PADDING END === */
/* Светлые темы: если верхняя панель настроена светлой, футер остаётся читаемым */
body.theme-ast_white .ast-portal-footer,
body.theme-ast_gray .ast-portal-footer {
    color: #1f2a44 !important;
    border-top: 1px solid rgba(130, 100, 255, .30) !important;
}

/* Контрастная и тёмные темы */
body.theme-ast_dark .ast-portal-footer,
body.theme-noc_night .ast-portal-footer,
body.theme-ast_contrast .ast-portal-footer {
    color: #fff !important;
}

@media (max-width: 900px) {
    .ast-portal-footer {
        position: static !important;
        height: auto !important;
        min-height: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
        line-height: 1.35 !important;
        padding: 6px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        white-space: normal !important;
    }

    .ast-portal-footer-right {
        text-align: left !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* ===== AST footer follows real top portal panel ===== */
.ast-portal-footer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99990 !important;

    height: var(--ast-portal-footer-real-height, var(--portal-nav-height, 30px)) !important;
    min-height: var(--ast-portal-footer-real-height, var(--portal-nav-height, 30px)) !important;
    box-sizing: border-box !important;

    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;

    background: linear-gradient(90deg, #efe9ff 0%, #e9efff 100%);
    border-top: 1px solid rgba(130, 100, 255, .30) !important;
    box-shadow: 0 -8px 24px rgba(90, 70, 180, .10) !important;

    color: #1f2a44;
    font-size: 12px !important;
    line-height: var(--ast-portal-footer-real-height, var(--portal-nav-height, 30px)) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.ast-portal-footer-left,
.ast-portal-footer-right {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.ast-portal-footer-left {
    flex: 0 1 auto !important;
}

.ast-portal-footer-right {
    flex: 1 1 auto !important;
    text-align: right !important;
    font-weight: 700 !important;
}

/* === AST DISABLED DUPLICATED BODY PADDING 2026-04-26 ===
   Удалён ранний дубль body padding-bottom: original lines 4646-4651.
   Активным оставлено последнее правило: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important.
   Оригиналы сохранены в: /var/www/ast-css-disabled-body-padding-duplicates-20260426_210953.css
=== AST DISABLED DUPLICATED BODY PADDING END === */
@media (max-width: 900px) {
    .ast-portal-footer {
        position: static !important;
        height: auto !important;
        min-height: var(--portal-nav-height, 30px) !important;
        line-height: 1.35 !important;
        padding: 6px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        white-space: normal !important;
    }

    .ast-portal-footer-right {
        text-align: left !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* ===== AST final repair: portal top panel overflow and footer theme ===== */

/*
 * Причина поломки панели:
 * после добавления новых разделов .portal-links переносились на вторую строку,
 * а .portal-nav имеет малую фиксированную высоту. Поэтому ссылки залезали под панель раздела.
 */
.portal-nav {
    overflow: hidden !important;
}

.portal-left {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

.portal-brand {
    flex: 0 0 auto !important;
}

.portal-links {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: thin !important;
    white-space: nowrap !important;
    max-height: var(--portal-nav-height, 30px) !important;
}

.portal-links a {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

.portal-user {
    flex: 0 0 auto !important;
}

/*
 * Нижняя панель портала.
 * Она не должна брать старые portal_nav_color_from/to, потому что они у нас исторически тёмные.
 * Футер должен идти от текущей темы.
 */
.ast-portal-footer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99990 !important;

    height: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
    min-height: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
    line-height: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
    box-sizing: border-box !important;

    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;

    background: linear-gradient(90deg, #efe9ff 0%, #e9efff 100%) !important;
    color: #1f2a44 !important;
    border-top: 1px solid rgba(130, 100, 255, .30) !important;
    box-shadow: 0 -8px 24px rgba(90, 70, 180, .10) !important;

    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

/* Цвета футера по темам */
body.theme-ast_light .ast-portal-footer,
body.theme-ast_white .ast-portal-footer,
body.theme-ast_gray .ast-portal-footer {
    background: linear-gradient(90deg, #efe9ff 0%, #e9efff 100%) !important;
    color: #1f2a44 !important;
    border-top: 1px solid rgba(130, 100, 255, .30) !important;
}

body.theme-ast_blue .ast-portal-footer {
    background: linear-gradient(90deg, #e7f0ff 0%, #dce9ff 100%) !important;
    color: #12305c !important;
    border-top: 1px solid rgba(70, 120, 220, .28) !important;
}

body.theme-ast_green .ast-portal-footer {
    background: linear-gradient(90deg, #e8fff0 0%, #dcf8e8 100%) !important;
    color: #0f3d25 !important;
    border-top: 1px solid rgba(40, 150, 90, .25) !important;
}

body.theme-ast_dark .ast-portal-footer,
body.theme-noc_night .ast-portal-footer,
body.theme-ast_contrast .ast-portal-footer {
    background: linear-gradient(90deg, #170034 0%, #1e2f6f 100%) !important;
    color: #fff !important;
    border-top: 1px solid rgba(255, 255, 255, .18) !important;
}

.ast-portal-footer-left,
.ast-portal-footer-right {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.ast-portal-footer-left {
    flex: 0 1 auto !important;
}

.ast-portal-footer-right {
    flex: 1 1 auto !important;
    text-align: right !important;
    font-weight: 700 !important;
}

body {
    padding-bottom: var(--portal-footer-height, var(--portal-nav-height, 30px)) !important;
}

@media (max-width: 900px) {
    .portal-links {
        max-width: 100% !important;
    }

    .ast-portal-footer {
        position: static !important;
        height: auto !important;
        min-height: var(--portal-nav-height, 30px) !important;
        line-height: 1.35 !important;
        padding: 6px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        white-space: normal !important;
    }

    .ast-portal-footer-right {
        text-align: left !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* ===== AST portal compact nav + future mail indicator ===== */

/* Уплотняем общую панель портала */
.portal-nav {
    overflow: hidden !important;
}

.portal-left {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

.portal-brand {
    flex: 0 0 auto !important;
    margin-right: 4px !important;
}

.portal-links {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 3px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    scrollbar-width: thin !important;
    max-height: var(--portal-nav-height, 30px) !important;
}

.portal-links a {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding-left: 7px !important;
    padding-right: 7px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.portal-user {
    flex: 0 0 auto !important;
    gap: 6px !important;
}

/* === AST DISABLED DUPLICATED MAIL INDICATOR BLOCK 2026-04-26 ===
   Первый дубль .portal-mail-indicator удалён из активного CSS.
   Активным оставлен более поздний блок 'Mail icon in portal top panel'.
   Оригинал сохранён в: /var/www/ast-css-disabled-mail-indicator-duplicate.css
=== AST DISABLED DUPLICATED MAIL INDICATOR BLOCK END === */

/* === AST DISABLED DUPLICATED SECTION BUTTONS 2026-04-26 ===
   Старый отдельный блок .portal-work-panel-actions/.portal-section-actions .btn.secondary
   отключён. Единый блок ниже задаёт кнопки панели раздела через переменные темы.
   Оригинал сохранён в: /root/ast-css-disabled-section-buttons-duplicates-20260426_175606.css
=== AST DISABLED DUPLICATED SECTION BUTTONS END === */

/* Mail icon in portal top panel */
.portal-mail-indicator {
    width: calc(var(--portal-nav-height, 30px) - 8px);
    height: calc(var(--portal-nav-height, 30px) - 8px);
    min-width: calc(var(--portal-nav-height, 30px) - 8px);
    box-sizing: border-box;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none !important;
    font-size: 15px;
    line-height: 1;
    color: inherit;
    background: rgba(255, 255, 255, .22);
    border: 1px solid rgba(255, 255, 255, .24);
}

.portal-mail-indicator:hover {
    background: rgba(255, 255, 255, .34);
}

.portal-mail-icon {
    transform: translateY(-1px);
}

.portal-mail-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ff3b30;
    color: #fff;
    font-size: 10px;
    line-height: 15px;
    font-weight: 900;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(255,255,255,.8);
}

.portal-mail-indicator.has-unread {
    color: #fff !important;
    background: #ff8a00 !important;
    border-color: rgba(255, 255, 255, .55) !important;
    animation: ast-mail-pulse 1.25s infinite;
}

@keyframes ast-mail-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 138, 0, .55);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(255, 138, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 138, 0, 0);
    }
}

body.theme-ast_light .portal-mail-indicator,
body.theme-ast_white .portal-mail-indicator,
body.theme-ast_gray .portal-mail-indicator {
    background: rgba(107, 0, 255, .08);
    border-color: rgba(107, 0, 255, .18);
    color: #29006f;
}

/* === AST SECTION PANEL BUTTONS THEME NORMALIZER START 2026-04-26 === */
.portal-work-panel-actions .btn,
.portal-section-actions .btn {
    min-height: 30px !important;
    box-sizing: border-box !important;
    border-radius: 999px !important;
    padding: 0 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    appearance: none !important;
    border: 1px solid var(--ast-border) !important;
    background: var(--ast-button-bg) !important;
    color: var(--ast-button-text) !important;
    box-shadow: none !important;
}

.portal-work-panel-actions .btn.primary,
.portal-section-actions .btn.primary {
    background: var(--ast-button-bg) !important;
    color: var(--ast-button-text-on-accent, var(--ast-button-text)) !important;
    border-color: var(--ast-button-bg) !important;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--ast-button-bg) 20%, transparent) !important;
}

.portal-work-panel-actions .btn.secondary,
.portal-section-actions .btn.secondary,
.portal-work-panel-actions .btn:not(.primary),
.portal-section-actions .btn:not(.primary) {
    background: var(--ast-panel-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: none !important;
}

.portal-work-panel-actions .btn:hover,
.portal-section-actions .btn:hover {
    transform: translateY(-1px);
    background: var(--ast-button-hover) !important;
    color: var(--ast-button-text-on-accent, var(--ast-button-text)) !important;
    border-color: var(--ast-button-hover) !important;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--ast-button-hover) 18%, transparent) !important;
}
/* === AST SECTION PANEL BUTTONS THEME NORMALIZER END 2026-04-26 === */

/* Old custom settings buttons must not become orange */
.labels-btn,
.panel-btn,
.footer-settings-btn {
    min-height: 30px !important;
    box-sizing: border-box !important;
    border-radius: 999px !important;
    padding: 0 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    border: 1px solid rgba(107, 0, 255, .25) !important;
    background: rgba(107, 0, 255, .10) !important;
    color: #5a00c8 !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    box-shadow: none !important;
    appearance: none !important;
}

.labels-btn:not(.secondary),
.panel-btn:not(.secondary),
.footer-settings-btn:not(.secondary) {
    background: #6b00ff !important;
    color: #fff !important;
    border-color: #6b00ff !important;
    box-shadow: 0 8px 18px rgba(107, 0, 255, .18) !important;
}

.labels-btn.secondary,
.panel-btn.secondary,
.footer-settings-btn.secondary {
    background: rgba(107, 0, 255, .10) !important;
    color: #5a00c8 !important;
    border-color: rgba(107, 0, 255, .25) !important;
}

/* =====================================================================
   AST final theme-driven button unification.
   Цвета НЕ задаются жёстко. Берём цвета активной темы:
   --ast-blue-main / --ast-blue-dark / --ast-button-bg / --ast-button-text.
   ===================================================================== */

body :is(
    a.btn,
    button.btn,
    input[type="submit"].btn,
    input[type="button"].btn,
    .labels-btn,
    .panel-btn,
    .footer-settings-btn
) {
    min-height: 30px !important;
    box-sizing: border-box !important;
    border-radius: 999px !important;
    padding: 0 14px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;

    background: color-mix(
        in srgb,
        var(--ast-button-bg, var(--ast-card-bg, #ffffff)) 88%,
        var(--ast-blue-main, #3c75ff) 12%
    ) !important;

    color: var(--ast-blue-main, #3c75ff) !important;

    border: 1px solid color-mix(
        in srgb,
        var(--ast-blue-main, #3c75ff) 42%,
        transparent
    ) !important;

    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-decoration: none !important;

    cursor: pointer !important;
    appearance: none !important;

    box-shadow: none !important;

    transition:
        background .15s ease,
        color .15s ease,
        border-color .15s ease,
        box-shadow .15s ease,
        transform .12s ease !important;
}

body :is(
    a.btn,
    button.btn,
    input[type="submit"].btn,
    input[type="button"].btn,
    .labels-btn,
    .panel-btn,
    .footer-settings-btn
):hover {
    background: color-mix(
        in srgb,
        var(--ast-button-hover, var(--ast-button-bg, #edf4ff)) 78%,
        var(--ast-blue-main, #3c75ff) 22%
    ) !important;

    border-color: color-mix(
        in srgb,
        var(--ast-blue-main, #3c75ff) 58%,
        transparent
    ) !important;

    color: var(--ast-blue-dark, var(--ast-blue-main, #3c75ff)) !important;

    box-shadow: 0 9px 22px color-mix(
        in srgb,
        var(--ast-shadow, rgba(60, 117, 255, .12)) 92%,
        transparent
    ) !important;

    transform: translateY(-1px) !important;
}

body :is(
    a.btn.primary,
    button.btn.primary,
    input[type="submit"].btn.primary,
    input[type="button"].btn.primary,
    .labels-btn:not(.secondary),
    .panel-btn:not(.secondary),
    .footer-settings-btn:not(.secondary)
) {
    background: linear-gradient(
        180deg,
        var(--ast-blue-main, #3c75ff) 0%,
        var(--ast-blue-dark, #2f63de) 100%
    ) !important;

    border-color: color-mix(
        in srgb,
        var(--ast-blue-main, #3c75ff) 70%,
        transparent
    ) !important;

    color: #ffffff !important;

    box-shadow: 0 8px 22px color-mix(
        in srgb,
        var(--ast-blue-main, #3c75ff) 34%,
        transparent
    ) !important;
}

body :is(
    a.btn.primary,
    button.btn.primary,
    input[type="submit"].btn.primary,
    input[type="button"].btn.primary,
    .labels-btn:not(.secondary),
    .panel-btn:not(.secondary),
    .footer-settings-btn:not(.secondary)
):hover {
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--ast-blue-main, #3c75ff) 88%, #ffffff 12%) 0%,
        var(--ast-blue-dark, #2f63de) 100%
    ) !important;

    color: #ffffff !important;
}

/* Вторичные кнопки явно остаются светлыми, но по цветам темы */
body :is(
    a.btn.secondary,
    button.btn.secondary,
    input[type="submit"].btn.secondary,
    input[type="button"].btn.secondary,
    .labels-btn.secondary,
    .panel-btn.secondary,
    .footer-settings-btn.secondary
) {
    background: color-mix(
        in srgb,
        var(--ast-button-bg, var(--ast-card-bg, #ffffff)) 90%,
        var(--ast-blue-main, #3c75ff) 10%
    ) !important;

    color: var(--ast-blue-main, #3c75ff) !important;

    border-color: color-mix(
        in srgb,
        var(--ast-blue-main, #3c75ff) 42%,
        transparent
    ) !important;

    box-shadow: none !important;
}

/* Тёмные темы: текст обычных кнопок берём из темы, чтобы не было слабого контраста */
body.theme-ast_dark :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary),
body.theme-noc_night :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary) {
    color: var(--ast-button-text, #ecfeff) !important;
}

/* Верхняя навигация и почтовый значок не являются обычными кнопками */
.portal-nav .portal-links a,
.portal-nav .portal-brand,
.portal-nav .portal-logout,
.portal-nav .portal-mail-indicator {
    box-shadow: none;
}

/* Компактные кнопки внутри таблиц */
body :is(.labels-table, .panel-table, .portal-simple-table) :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn) {
    min-height: 26px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
}

/* === AST THEME SURFACE NORMALIZER BEGIN === */

/*
 * Центральная нормализация цветов портала.
 * Смысл: страницы не должны сами решать, какого цвета карточка, поле, таблица или кнопка.
 * Они должны брать цвета из переменных активной темы.
 */

/* Базовые токены для светлой темы */
body.theme-ast_light {
    --ast-page-bg: #f5f7ff;
    --ast-card-bg: rgba(255, 255, 255, .92);
    --ast-panel-bg: rgba(255, 255, 255, .78);
    --ast-input-bg: #ffffff;
    --ast-input-text: #1f2a44;
    --ast-text: #1f2a44;
    --ast-title: #25005f;
    --ast-muted: #6d7893;
    --ast-border: #d8c7ff;
    --ast-shadow: rgba(90, 70, 180, .10);
    --ast-button-bg: #ffffff;
    --ast-button-hover: #f0eaff;
    --ast-button-text: #25005f;
    --ast-blue-main: #6b00ff;
    --ast-blue-dark: #5200c8;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(107, 0, 255, .08);
    --ast-table-row-border: rgba(107, 0, 255, .16);
}

/* Голубая */
body.theme-ast_blue {
    --ast-page-bg: #f0f6ff;
    --ast-card-bg: rgba(255, 255, 255, .92);
    --ast-panel-bg: rgba(255, 255, 255, .80);
    --ast-input-bg: #ffffff;
    --ast-input-text: #17345f;
    --ast-text: #17345f;
    --ast-title: #12305c;
    --ast-muted: #486996;
    --ast-border: #bfd4ff;
    --ast-shadow: rgba(60, 117, 255, .12);
    --ast-button-bg: #ffffff;
    --ast-button-hover: #e7f0ff;
    --ast-button-text: #17345f;
    --ast-blue-main: #3c75ff;
    --ast-blue-dark: #2f63de;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(60, 117, 255, .10);
    --ast-table-row-border: rgba(60, 117, 255, .16);
}

/* Белая минимальная */
body.theme-ast_white {
    --ast-page-bg: #f8fafc;
    --ast-card-bg: rgba(255, 255, 255, .95);
    --ast-panel-bg: rgba(255, 255, 255, .86);
    --ast-input-bg: #ffffff;
    --ast-input-text: #1e293b;
    --ast-text: #1e293b;
    --ast-title: #1e293b;
    --ast-muted: #64748b;
    --ast-border: #cbd5e1;
    --ast-shadow: rgba(15, 23, 42, .08);
    --ast-button-bg: #ffffff;
    --ast-button-hover: #f1f5f9;
    --ast-button-text: #1e293b;
    --ast-blue-main: #475569;
    --ast-blue-dark: #334155;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(51, 65, 85, .08);
    --ast-table-row-border: rgba(100, 116, 139, .18);
}

/* Зелёная */
body.theme-ast_green {
    --ast-page-bg: #f1fff6;
    --ast-card-bg: rgba(255, 255, 255, .92);
    --ast-panel-bg: rgba(255, 255, 255, .82);
    --ast-input-bg: #ffffff;
    --ast-input-text: #123d27;
    --ast-text: #123d27;
    --ast-title: #14532d;
    --ast-muted: #3f6f55;
    --ast-border: #a9e8bf;
    --ast-shadow: rgba(40, 169, 107, .10);
    --ast-button-bg: #ffffff;
    --ast-button-hover: #e8fff0;
    --ast-button-text: #14532d;
    --ast-blue-main: #28a96b;
    --ast-blue-dark: #15803d;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(40, 169, 107, .10);
    --ast-table-row-border: rgba(40, 169, 107, .16);
}

/* Серая инженерная */
body.theme-ast_gray {
    --ast-page-bg: #f1f5f9;
    --ast-card-bg: rgba(255, 255, 255, .92);
    --ast-panel-bg: rgba(255, 255, 255, .82);
    --ast-input-bg: #ffffff;
    --ast-input-text: #263445;
    --ast-text: #263445;
    --ast-title: #263445;
    --ast-muted: #5d6b7c;
    --ast-border: #cbd5e1;
    --ast-shadow: rgba(51, 65, 85, .10);
    --ast-button-bg: #ffffff;
    --ast-button-hover: #edf1f5;
    --ast-button-text: #263445;
    --ast-blue-main: #4c6385;
    --ast-blue-dark: #334155;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(76, 99, 133, .10);
    --ast-table-row-border: rgba(100, 116, 139, .18);
}

/* Контрастная */
body.theme-ast_contrast {
    --ast-page-bg: #07111f;
    --ast-card-bg: rgba(8, 18, 36, .94);
    --ast-panel-bg: rgba(12, 24, 48, .88);
    --ast-input-bg: #050b16;
    --ast-input-text: #f8fbff;
    --ast-text: #f8fbff;
    --ast-title: #ffffff;
    --ast-muted: #a8c1e8;
    --ast-border: rgba(122, 162, 255, .34);
    --ast-shadow: rgba(0, 0, 0, .32);
    --ast-button-bg: #0b1730;
    --ast-button-hover: #11244a;
    --ast-button-text: #ffffff;
    --ast-blue-main: #7aa2ff;
    --ast-blue-dark: #4f7dff;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(122, 162, 255, .16);
    --ast-table-row-border: rgba(122, 162, 255, .18);
}

/* Тёмная */
body.theme-ast_dark {
    --ast-page-bg: #050816;
    --ast-card-bg: rgba(9, 13, 31, .94);
    --ast-panel-bg: rgba(13, 19, 42, .88);
    --ast-input-bg: #070a18;
    --ast-input-text: #ecfeff;
    --ast-text: #e5edff;
    --ast-title: #ffffff;
    --ast-muted: #9caecb;
    --ast-border: rgba(122, 162, 255, .22);
    --ast-shadow: rgba(0, 0, 0, .35);
    --ast-button-bg: #101827;
    --ast-button-hover: #172338;
    --ast-button-text: #ecfeff;
    --ast-blue-main: #7aa2ff;
    --ast-blue-dark: #4f7dff;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(122, 162, 255, .14);
    --ast-table-row-border: rgba(122, 162, 255, .16);
}

/* NOC Night */
body.theme-noc_night {
    --ast-page-bg: #020617;
    --ast-card-bg: rgba(5, 10, 25, .94);
    --ast-panel-bg: rgba(8, 14, 30, .88);
    --ast-input-bg: #020617;
    --ast-input-text: #dffbff;
    --ast-text: #dffbff;
    --ast-title: #ecfeff;
    --ast-muted: #8bb3c7;
    --ast-border: rgba(34, 211, 238, .24);
    --ast-shadow: rgba(0, 0, 0, .38);
    --ast-button-bg: #061525;
    --ast-button-hover: #0b2436;
    --ast-button-text: #ecfeff;
    --ast-blue-main: #22d3ee;
    --ast-blue-dark: #0891b2;
    --ast-accent: var(--ast-blue-main);
    --ast-table-head-bg: rgba(34, 211, 238, .14);
    --ast-table-row-border: rgba(34, 211, 238, .16);
}

/* Общий фон страниц */
body[class*="theme-"] {
    background: var(--ast-page-bg) !important;
    color: var(--ast-text) !important;
}

/* Основные карточки и панели портала *
/* === AST DISABLED DUPLICATED THEME CARD SURFACE BLOCK 2026-04-26 ===
   Удалён ранний дубль широкого theme card surface блока: original lines 5424-5447.
   Активным оставлен поздний блок с теми же декларациями и расширенным списком классов: original lines 5691-5727.
   Оригинал сохранён в: /var/www/ast-css-disabled-theme-card-surface-duplicate-20260426_230219.css
=== AST DISABLED DUPLICATED THEME CARD SURFACE BLOCK END === */


/* Внутренние панели, подсказки, блоки */
body[class*="theme-"] :is(
    .portal-page-note,
    .portal-section-help-panel,
    .labels-add,
    .labels-group-title,
    .portal-work-panel-global,
    .portal-work-panel,
    .info-panel,
    .summary-card,
    .stat-card
) {
    background: var(--ast-panel-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Заголовки и приглушённый текст */
body[class*="theme-"] :is(
    h1,
    h2,
    h3,
    .card-title,
    .labels-group-title,
    .portal-page-kicker,
    .panel-muted strong
) {
    color: var(--ast-title) !important;
}

body[class*="theme-"] :is(
    .muted,
    .labels-muted,
    .panel-muted,
    .footer-settings-muted,
    .card-subtitle,
    .portal-page-kicker + .muted
) {
    color: var(--ast-muted) !important;
}

/* Поля ввода */
body[class*="theme-"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select,
    textarea
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text) !important;
    border-color: var(--ast-border) !important;
}

body[class*="theme-"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select,
    textarea
)::placeholder {
    color: color-mix(in srgb, var(--ast-muted) 78%, transparent) !important;
}

/* Таблицы */
body[class*="theme-"] :is(
    .labels-table,
    .panel-table,
    .portal-simple-table,
    table
) {
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

body[class*="theme-"] :is(
    .labels-table th,
    .panel-table th,
    .portal-simple-table th,
    table th
) {
    background: var(--ast-table-head-bg) !important;
    color: var(--ast-muted) !important;
    border-color: var(--ast-border) !important;
}

body[class*="theme-"] :is(
    .labels-table td,
    .panel-table td,
    .portal-simple-table td,
    table td
) {
    color: var(--ast-text) !important;
    border-color: var(--ast-table-row-border) !important;
}

body[class*="theme-"] :is(
    .labels-table code,
    .panel-table code,
    .portal-simple-table code,
    table code
) {
    color: var(--ast-title) !important;
}

/* Единый стиль кнопок через переменные темы *
/* === AST DISABLED DUPLICATED THEME BUTTON GROUP 2026-04-26 ===
   Удалён ранний дубль общей темы кнопок: original lines 5551-5610.
   Активной оставлена самая поздняя группа правил.
   Оригинал сохранён в: /var/www/ast-css-disabled-button-theme-duplicates-20260426_205747.css
=== AST DISABLED DUPLICATED THEME BUTTON GROUP END === */

/* === AST DISABLED DUPLICATED THEME BUTTON GROUP 2026-04-26 ===
   Удалён ранний дубль общей темы кнопок: original lines 5610-5773.
   Активной оставлена самая поздняя группа правил.
   Оригинал сохранён в: /var/www/ast-css-disabled-button-theme-duplicates-20260426_205747.css
=== AST DISABLED DUPLICATED THEME BUTTON GROUP END === */


body[class*="theme-"] :is(
    a.btn.primary,
    button.btn.primary,
    input[type="submit"].btn.primary,
    input[type="button"].btn.primary,
    .labels-btn:not(.secondary),
    .panel-btn:not(.secondary),
    .footer-settings-btn:not(.secondary)
) {
    background: linear-gradient(180deg, var(--ast-blue-main) 0%, var(--ast-blue-dark) 100%) !important;
    color: #fff !important;
    border-color: color-mix(in srgb, var(--ast-blue-main) 70%, transparent) !important;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--ast-blue-main) 34%, transparent) !important;
}

body[class*="theme-"] :is(
    a.btn.secondary,
    button.btn.secondary,
    input[type="submit"].btn.secondary,
    input[type="button"].btn.secondary,
    .labels-btn.secondary,
    .panel-btn.secondary,
    .footer-settings-btn.secondary
) {
    background: color-mix(in srgb, var(--ast-button-bg) 90%, var(--ast-blue-main) 10%) !important;
    color: var(--ast-blue-main) !important;
    border-color: color-mix(in srgb, var(--ast-blue-main) 42%, transparent) !important;
    box-shadow: none !important;
}

body.theme-ast_dark :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary),
body.theme-noc_night :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary),
body.theme-ast_contrast :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary) {
    color: var(--ast-button-text) !important;
}

body[class*="theme-"] :is(
    a.btn,
    button.btn,
    input[type="submit"].btn,
    input[type="button"].btn,
    .labels-btn,
    .panel-btn,
    .footer-settings-btn
):hover {
    background: color-mix(in srgb, var(--ast-button-hover) 78%, var(--ast-blue-main) 22%) !important;
    border-color: color-mix(in srgb, var(--ast-blue-main) 58%, transparent) !important;
    box-shadow: 0 9px 22px color-mix(in srgb, var(--ast-shadow) 92%, transparent) !important;
    transform: translateY(-1px) !important;
}

.portal-nav .portal-links a,
.portal-nav .portal-brand,
.portal-nav .portal-logout,
.portal-nav .portal-mail-indicator {
    transform: none;
    box-shadow: none;
}

/* === AST FINAL THEME-AWARE BUTTONS END === */


/* === AST FINAL PORTAL THEME COVERAGE BEGIN === */

/*
 * Финальный слой темы.
 * Не задаём один общий цвет. Все цвета берутся из активной темы.
 */

/* HTML тоже должен иметь фон темы, иначе появляются светлые боковые поля */
html:has(body.theme-ast_light) { background: #f5f7ff !important; }
html:has(body.theme-ast_blue) { background: #f0f6ff !important; }
html:has(body.theme-ast_white) { background: #f8fafc !important; }
html:has(body.theme-ast_green) { background: #f1fff6 !important; }
html:has(body.theme-ast_gray) { background: #f1f5f9 !important; }
html:has(body.theme-ast_contrast) { background: #07111f !important; }
html:has(body.theme-ast_dark) { background: #050816 !important; }
html:has(body.theme-noc_night) { background: #020617 !important; }

html,
body {
    min-height: 100% !important;
}

body[class*="theme-"] {
    min-height: 100vh !important;
    background: var(--ast-page-bg) !important;
    color: var(--ast-text) !important;
}

/* Внешние контейнеры страниц */
body[class*="theme-"] :is(
    main,
    .portal-page,
    .portal-page-app,
    .labels-page,
    .footer-settings-page,
    .portal-panel-settings-page,
    .settings-page,
    .map-settings-page,
    .map-settings-shell,
    .content,
    .page,
    .page-wrapper,
    .app-shell,
    .portal-shell
) {
    background: var(--ast-page-bg) !important;
    color: var(--ast-text) !important;
}

/* Старые настройки карты: отдельная страница settings.php */
body.map-settings-page-body :is(
    section,
    .card,
    .settings-card,
    .settings-section,
    .settings-block,
    .settings-panel,
    .panel,
    form > div
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Типовые карточки и секции портала */
body[class*="theme-"] :is(
    .portal-page-card,
    .labels-card,
    .footer-settings-card,
    .portal-panel-card,
    .portal-section-help-card,
    .labels-group,
    .portal-branding-card,
    .portal-role-card,
    .portal-assignment-card,
    .role-card,
    .assignment-card,
    .role-permission-card,
    .role-summary-card,
    .permission-card,
    .user-card,
    .group-card,
    .device-card,
    .log-source-card,
    .rules-card,
    .auth-card,
    .log-card,
    .filter-card,
    .stat-card,
    .summary-card,
    .portal-card,
    .settings-card,
    .settings-section,
    .settings-block,
    .settings-panel
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: 0 14px 40px color-mix(in srgb, var(--ast-shadow) 90%, transparent) !important;
}

/* Внутренние панели и подсказки */
body[class*="theme-"] :is(
    .portal-page-note,
    .portal-section-help-panel,
    .labels-add,
    .labels-group-title,
    .portal-work-panel-global,
    .portal-work-panel,
    .info-panel,
    .form-panel,
    .inner-panel,
    .toolbar-panel
) {
    background: var(--ast-panel-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Карточки ограничиваем по ширине, но фон вокруг — на всю страницу */
body[class*="theme-"] :is(
    .labels-card,
    .footer-settings-card,
    .portal-panel-card,
    .portal-page-card
) {
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Заголовки */
body[class*="theme-"] :is(
    h1,
    h2,
    h3,
    h4,
    .card-title,
    .labels-group-title,
    .portal-page-kicker,
    .panel-muted strong,
    label
) {
    color: var(--ast-title) !important;
}

/* Обычный и приглушённый текст */
body[class*="theme-"] :is(
    p,
    li,
    td,
    .muted,
    .labels-muted,
    .panel-muted,
    .footer-settings-muted,
    .card-subtitle,
    .description,
    .help-text
) {
    color: var(--ast-text) !important;
}

body[class*="theme-"] :is(
    .muted,
    .labels-muted,
    .panel-muted,
    .footer-settings-muted,
    .card-subtitle,
    small
) {
    color: var(--ast-muted) !important;
}

/* Поля ввода */
body[class*="theme-"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select,
    textarea
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text) !important;
    border-color: var(--ast-border) !important;
}

body[class*="theme-"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select,
    textarea
)::placeholder {
    color: color-mix(in srgb, var(--ast-muted) 78%, transparent) !important;
}

/* Таблицы */
body[class*="theme-"] table {
    background: transparent !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

body[class*="theme-"] :is(
    table th,
    .labels-table th,
    .panel-table th,
    .portal-simple-table th
) {
    background: var(--ast-table-head-bg) !important;
    color: var(--ast-muted) !important;
    border-color: var(--ast-border) !important;
}

body[class*="theme-"] :is(
    table td,
    .labels-table td,
    .panel-table td,
    .portal-simple-table td
) {
    background: transparent !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-table-row-border) !important;
}

body[class*="theme-"] :is(
    table code,
    .labels-table code,
    .panel-table code,
    .portal-simple-table code
) {
    color: var(--ast-title) !important;
}

/* Кнопки: цвет берётся из текущей темы */
body[class*="theme-"] :is(
    a.btn,
    button.btn,
    input[type="submit"].btn,
    input[type="button"].btn,
    .labels-btn,
    .panel-btn,
    .footer-settings-btn
) {
    min-height: 30px !important;
    box-sizing: border-box !important;
    border-radius: 999px !important;
    padding: 0 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    background: color-mix(in srgb, var(--ast-button-bg) 88%, var(--ast-blue-main) 12%) !important;
    color: var(--ast-blue-main) !important;
    border: 1px solid color-mix(in srgb, var(--ast-blue-main) 42%, transparent) !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    appearance: none !important;
    box-shadow: none !important;
}

body[class*="theme-"] :is(
    a.btn.primary,
    button.btn.primary,
    input[type="submit"].btn.primary,
    input[type="button"].btn.primary,
    .labels-btn:not(.secondary),
    .panel-btn:not(.secondary),
    .footer-settings-btn:not(.secondary)
) {
    background: linear-gradient(180deg, var(--ast-blue-main) 0%, var(--ast-blue-dark) 100%) !important;
    color: #fff !important;
    border-color: color-mix(in srgb, var(--ast-blue-main) 70%, transparent) !important;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--ast-blue-main) 34%, transparent) !important;
}

body[class*="theme-"] :is(
    a.btn.secondary,
    button.btn.secondary,
    input[type="submit"].btn.secondary,
    input[type="button"].btn.secondary,
    .labels-btn.secondary,
    .panel-btn.secondary,
    .footer-settings-btn.secondary
) {
    background: color-mix(in srgb, var(--ast-button-bg) 90%, var(--ast-blue-main) 10%) !important;
    color: var(--ast-blue-main) !important;
    border-color: color-mix(in srgb, var(--ast-blue-main) 42%, transparent) !important;
    box-shadow: none !important;
}

/* На тёмных темах вторичные кнопки должны быть читаемыми */
body.theme-ast_dark :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary),
body.theme-noc_night :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary),
body.theme-ast_contrast :is(a.btn, button.btn, input[type="submit"].btn, input[type="button"].btn):not(.primary) {
    color: var(--ast-button-text) !important;
}

/* Футер следует теме портала */
body[class*="theme-"] .ast-portal-footer {
    background: linear-gradient(
        90deg,
        var(--portal-nav-color-from) 0%,
        var(--portal-nav-color-to) 100%
    ) !important;
    color: var(--portal-nav-text) !important;
    border-top-color: var(--portal-nav-border) !important;
}

/* Верхняя навигация и значок почты не превращаются в обычные кнопки */
.portal-nav .portal-links a,
.portal-nav .portal-brand,
.portal-nav .portal-logout,
.portal-nav .portal-mail-indicator {
    transform: none;
    box-shadow: none;
}

/* === AST FINAL PORTAL THEME COVERAGE END === */


/* === AST FIX REMAINING OLD WHITE BLOCKS BEGIN === */

/*
 * 1. Старая страница /ast-map/settings.php.
 * У неё часть контейнеров была без общих классов портала, поэтому оставались белые блоки.
 */
body.map-settings-page-body[class*="theme-"] :is(
    main,
    main > div,
    main > section,
    main > form,
    main > form > div,
    main > form > section,
    .container,
    .container > div,
    .container > section,
    .settings-container,
    .settings-container > div,
    .settings-container > section,
    .settings-card,
    .settings-block,
    .settings-section,
    .settings-panel,
    .card,
    .card-body,
    .panel,
    .box,
    fieldset
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

body.map-settings-page-body[class*="theme-"] :is(
    main > form > div > div,
    main > form > section > div,
    .settings-grid,
    .settings-row,
    .settings-subsection,
    .settings-inner,
    .form-grid,
    .form-row
) {
    background: transparent !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

body.map-settings-page-body[class*="theme-"] :is(
    h1, h2, h3, h4, label, strong
) {
    color: var(--ast-title) !important;
}

body.map-settings-page-body[class*="theme-"] :is(
    p, span, div, small
) {
    border-color: var(--ast-border);
}

body.map-settings-page-body[class*="theme-"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select,
    textarea
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text) !important;
    border-color: var(--ast-border) !important;
}

/*
 * 2. Страница /ast-map/settings/.
 * Старые карточки пользователей, ролей, групп и прав были сделаны отдельными div-классами.
 */
body.portal-settings-page-body[class*="theme-"] :is(
    .users-grid > *,
    .roles-grid > *,
    .groups-grid > *,
    .permissions-grid > *,
    .assignments-grid > *,
    .role-cards > *,
    .user-cards > *,
    .group-cards > *,
    .permission-cards > *,
    .portal-users-grid > *,
    .portal-roles-grid > *,
    .portal-groups-grid > *,
    .portal-assignment-grid > *,
    .user-card,
    .user-edit-card,
    .portal-user-card,
    .role-card,
    .portal-role-card,
    .group-card,
    .portal-group-card,
    .permission-card,
    .portal-permission-card,
    .assignment-card,
    .portal-assignment-card,
    .role-permission-card,
    .role-summary-card,
    .user-role-card,
    .user-form-card,
    .settings-user-card,
    .settings-role-card,
    .settings-group-card
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: 0 14px 40px color-mix(in srgb, var(--ast-shadow) 85%, transparent) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .users-grid > * *,
    .roles-grid > * *,
    .groups-grid > * *,
    .permissions-grid > * *,
    .assignments-grid > * *,
    .role-cards > * *,
    .user-cards > * *,
    .group-cards > * *,
    .permission-cards > * *,
    .portal-users-grid > * *,
    .portal-roles-grid > * *,
    .portal-groups-grid > * *,
    .portal-assignment-grid > * *
) {
    border-color: var(--ast-border);
}

body.portal-settings-page-body[class*="theme-"] :is(
    .users-grid h1, .users-grid h2, .users-grid h3, .users-grid h4,
    .roles-grid h1, .roles-grid h2, .roles-grid h3, .roles-grid h4,
    .groups-grid h1, .groups-grid h2, .groups-grid h3, .groups-grid h4,
    .permissions-grid h1, .permissions-grid h2, .permissions-grid h3, .permissions-grid h4,
    .assignments-grid h1, .assignments-grid h2, .assignments-grid h3, .assignments-grid h4,
    .role-cards h1, .role-cards h2, .role-cards h3, .role-cards h4,
    .user-cards h1, .user-cards h2, .user-cards h3, .user-cards h4,
    .portal-users-grid h1, .portal-users-grid h2, .portal-users-grid h3, .portal-users-grid h4,
    .portal-roles-grid h1, .portal-roles-grid h2, .portal-roles-grid h3, .portal-roles-grid h4,
    .user-card h1, .user-card h2, .user-card h3, .user-card h4,
    .role-card h1, .role-card h2, .role-card h3, .role-card h4,
    .group-card h1, .group-card h2, .group-card h3, .group-card h4,
    .permission-card h1, .permission-card h2, .permission-card h3, .permission-card h4,
    .assignment-card h1, .assignment-card h2, .assignment-card h3, .assignment-card h4
) {
    color: var(--ast-title) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .users-grid input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .roles-grid input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .groups-grid input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .permissions-grid input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .assignments-grid input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .role-cards input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .user-cards input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .portal-users-grid input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .portal-roles-grid input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .user-card input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .role-card input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .group-card input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .permission-card input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .assignment-card input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .users-grid select,
    .roles-grid select,
    .groups-grid select,
    .permissions-grid select,
    .assignments-grid select,
    .role-cards select,
    .user-cards select,
    .portal-users-grid select,
    .portal-roles-grid select,
    .user-card select,
    .role-card select,
    .group-card select,
    .permission-card select,
    .assignment-card select
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text) !important;
    border-color: var(--ast-border) !important;
}

/* Белые информационные блоки внутри карточек прав */
body.portal-settings-page-body[class*="theme-"] :is(
    .role-description,
    .role-permissions,
    .user-permissions,
    .permission-list,
    .permission-chip-list,
    .role-info,
    .user-info,
    .group-info
) {
    background: var(--ast-panel-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* === AST FIX REMAINING OLD WHITE BLOCKS END === */

/* === AST LEGACY PAGE THEME OVERRIDES BEGIN === */

/*
 * Эти правила нужны для старых страниц, где часть блоков была сверстана
 * без общих классов портала и с собственными белыми фонами.
 * Цвета берём только из переменных текущей темы.
 */

/* ---------- /ast-map/settings.php: старая страница настроек карты ---------- */

body.map-settings-page-body[class*="theme-"] {
    background: var(--ast-page-bg) !important;
    color: var(--ast-text) !important;
}

/* Главная белая карточка старой страницы */
body.map-settings-page-body[class*="theme-"] :is(
    main,
    main > div,
    main > section,
    main > form,
    main form,
    form,
    fieldset,
    .container,
    .wrapper,
    .content,
    .page,
    .settings,
    .settings-page,
    .settings-container,
    .settings-wrapper,
    .settings-form,
    .settings-card,
    .settings-section,
    .settings-block,
    .settings-panel,
    .card,
    .box,
    .panel
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Внутренние строки/сетки внутри карточки не должны быть белыми */
body.map-settings-page-body[class*="theme-"] :is(
    main form div,
    main form section,
    main form article,
    .settings-grid,
    .settings-row,
    .settings-inner,
    .settings-subsection,
    .form-grid,
    .form-row,
    .grid,
    .row
) {
    background-color: transparent !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Если где-то фон задан inline или старым CSS через белый цвет */
body.map-settings-page-body[class*="theme-"] :is(
    [style*="background:#fff"],
    [style*="background: #fff"],
    [style*="background-color:#fff"],
    [style*="background-color: #fff"],
    [style*="background:#ffffff"],
    [style*="background: #ffffff"],
    [style*="background-color:#ffffff"],
    [style*="background-color: #ffffff"],
    [style*="background:white"],
    [style*="background: white"]
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Поля, подписи, заголовки */
body.map-settings-page-body[class*="theme-"] :is(
    h1, h2, h3, h4, label, strong
) {
    color: var(--ast-title) !important;
}

body.map-settings-page-body[class*="theme-"] :is(
    p, span, small, div
) {
    border-color: var(--ast-border);
}

body.map-settings-page-body[class*="theme-"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select,
    textarea
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text) !important;
    border-color: var(--ast-border) !important;
}

/* ---------- /ast-map/settings/: пользователи, роли, группы ---------- */

body.portal-settings-page-body[class*="theme-"] {
    background: var(--ast-page-bg) !important;
    color: var(--ast-text) !important;
}

/* Карточки пользователей, ролей, групп, назначений */
body.portal-settings-page-body[class*="theme-"] :is(
    div[class*="user"],
    section[class*="user"],
    article[class*="user"],
    form[class*="user"],

    div[class*="role"],
    section[class*="role"],
    article[class*="role"],
    form[class*="role"],

    div[class*="group"],
    section[class*="group"],
    article[class*="group"],
    form[class*="group"],

    div[class*="assign"],
    section[class*="assign"],
    article[class*="assign"],
    form[class*="assign"],

    div[class*="permission"],
    section[class*="permission"],
    article[class*="permission"],
    form[class*="permission"]
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Внутренние белые панели описаний ролей и прав */
body.portal-settings-page-body[class*="theme-"] :is(
    .role-description,
    .role-permissions,
    .selected-role-description,
    .user-permissions,
    .permission-list,
    .permission-box,
    .permission-chip-list,
    .role-info,
    .user-info,
    .group-info,
    .role-summary,
    .permission-summary,
    .description-box,
    .info-box,
    .help-box
) {
    background: var(--ast-panel-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Белые checkbox-строки в блоке “кто кому может назначать задачи” */
body.portal-settings-page-body[class*="theme-"] :is(
    label:has(input[type="checkbox"]),
    .checkbox-row,
    .checkbox-card,
    .assignment-row,
    .permission-chip,
    .role-chip,
    .group-chip,
    .badge,
    .pill
) {
    background: var(--ast-panel-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Если белый цвет пришёл inline/старым CSS */
body.portal-settings-page-body[class*="theme-"] :is(
    [style*="background:#fff"],
    [style*="background: #fff"],
    [style*="background-color:#fff"],
    [style*="background-color: #fff"],
    [style*="background:#ffffff"],
    [style*="background: #ffffff"],
    [style*="background-color:#ffffff"],
    [style*="background-color: #ffffff"],
    [style*="background:white"],
    [style*="background: white"]
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* Внутренние тексты */
body.portal-settings-page-body[class*="theme-"] :is(
    h1, h2, h3, h4, label, strong
) {
    color: var(--ast-title) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    p, span, small, div
) {
    border-color: var(--ast-border);
}

/* Поля в карточках пользователей/ролей */
body.portal-settings-page-body[class*="theme-"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select,
    textarea
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text) !important;
    border-color: var(--ast-border) !important;
}

/* Белые textarea/scroll-блоки с описанием ролей */
body.portal-settings-page-body[class*="theme-"] :is(
    textarea,
    .scroll-box,
    .permissions-scroll,
    .role-scroll
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text) !important;
    border-color: var(--ast-border) !important;
}


/* === AST SETTINGS PAGE THEME NORMALIZER START 2026-04-26 === */
/*
   Единая доводка старых страниц настроек под темы портала.
   Не меняет бизнес-логику страниц, только переопределяет старые светлые CSS-правила.
*/
body.portal-settings-page-body[class*="theme-"] {
    background: var(--ast-bg) !important;
    color: var(--ast-text) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .page,
    .portal-panel-settings-page,
    .labels-page,
    .footer-settings-page
) {
    color: var(--ast-text) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .section,
    .device-card,
    .link-card,
    .portal-panel-card,
    .labels-card,
    .labels-group,
    .labels-add,
    .footer-settings-card,
    .footer-preview
) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: 0 14px 40px var(--ast-shadow) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .device-card.hidden-card,
    .link-card.hidden-card,
    .labels-group-title,
    .panel-table th,
    .labels-table th
) {
    background: var(--ast-panel-bg, var(--ast-button-hover)) !important;
    color: var(--ast-title) !important;
    border-color: var(--ast-border) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .panel-table td,
    .labels-table td,
    .panel-table th,
    .labels-table th
) {
    border-color: var(--ast-border) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    h1,
    h2,
    h3,
    label,
    .check-row,
    .card-title,
    .panel-grid label,
    .panel-checks label,
    .footer-settings-card label,
    .labels-head h1,
    .portal-panel-card h1,
    .portal-panel-card h2,
    .footer-settings-card h1
) {
    color: var(--ast-title) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .hint,
    .muted,
    .card-subtitle,
    .panel-muted,
    .labels-muted,
    .footer-settings-muted
) {
    color: var(--ast-muted) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    input[type="number"],
    input[type="text"],
    input[type="password"],
    input[type="email"],
    select,
    textarea
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text, var(--ast-text)) !important;
    border-color: var(--ast-border) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    a,
    details.link-details summary,
    .small-link
) {
    color: var(--ast-button-text) !important;
}

body.portal-settings-page-body[class*="theme-"] hr {
    border-top-color: var(--ast-border) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .badge,
    .panel-btn.secondary,
    .labels-btn.secondary,
    .footer-settings-btn.secondary
) {
    background: var(--ast-panel-bg, var(--ast-button-hover)) !important;
    color: var(--ast-button-text) !important;
    border-color: var(--ast-border) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    button,
    .button-link,
    .panel-btn,
    .labels-btn,
    .footer-settings-btn
) {
    background: var(--ast-blue-main) !important;
    color: #fff !important;
    border-color: var(--ast-blue-main) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    button:hover,
    .button-link:hover,
    .panel-btn:hover,
    .labels-btn:hover,
    .footer-settings-btn:hover
) {
    background: var(--ast-blue-dark) !important;
    color: #fff !important;
}

body.portal-settings-page-body:is(.theme-ast_dark, .theme-noc_night) :is(
    .msg,
    .ok,
    .panel-notice,
    .labels-notice,
    .footer-settings-notice
) {
    background: rgba(34, 197, 94, .14) !important;
    color: #86efac !important;
    border-color: rgba(34, 197, 94, .38) !important;
}

body.portal-settings-page-body:is(.theme-ast_dark, .theme-noc_night) :is(
    .err,
    .off,
    .panel-error,
    .labels-error,
    .footer-settings-error
) {
    background: rgba(239, 68, 68, .14) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, .40) !important;
}

body.portal-settings-page-body:is(.theme-ast_dark, .theme-noc_night) .warn {
    background: rgba(245, 158, 11, .14) !important;
    color: #fcd34d !important;
    border-color: rgba(245, 158, 11, .40) !important;
}

body.portal-settings-page-body[class*="theme-"] :is(
    .labels-table code,
    .panel-table code
) {
    color: var(--ast-text) !important;
}
/* === AST SETTINGS PAGE THEME NORMALIZER END 2026-04-26 === */

/* === AST LEGACY PAGE THEME OVERRIDES END === */

/* === AST PORTAL NOTIFICATIONS START 2026-04-26 === */

.portal-notification-indicator.has-unread {
    animation: portal-notification-pulse 1.5s ease-in-out infinite;
}

@keyframes portal-notification-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, .45);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(245, 158, 11, 0);
    }
}

.ast-notifications-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 18px 56px;
}

.ast-notifications-card {
    background: var(--ast-card-bg);
    color: var(--ast-text);
    border: 1px solid var(--ast-border);
    border-radius: 22px;
    box-shadow: 0 14px 40px var(--ast-shadow);
    padding: 22px;
}

.ast-notifications-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.ast-notifications-head h1 {
    margin: 0 0 6px;
    color: var(--ast-title);
}

.ast-notifications-muted {
    color: var(--ast-muted);
    font-size: 13px;
    line-height: 1.45;
}

.ast-notifications-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ast-notifications-empty {
    padding: 18px;
    border-radius: 16px;
    background: var(--ast-panel-bg, var(--ast-button-hover));
    color: var(--ast-muted);
    border: 1px dashed var(--ast-border);
    font-weight: 800;
}

.ast-notifications-list {
    display: grid;
    gap: 12px;
}

.ast-notification-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--ast-border);
    background: var(--ast-panel-bg, var(--ast-card-bg));
}

.ast-notification-item.is-unread {
    border-color: var(--ast-blue-main);
}

.ast-notification-item.priority-urgent {
    border-color: rgba(239, 68, 68, .65);
}

.ast-notification-item.priority-high {
    border-color: rgba(245, 158, 11, .65);
}

.ast-notification-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ast-notification-title-row h2 {
    margin: 0;
    font-size: 17px;
    color: var(--ast-title);
}

.ast-notification-unread-dot {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 900;
    background: rgba(245, 158, 11, .18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, .36);
}

.ast-notification-message {
    margin-top: 8px;
    color: var(--ast-text);
    font-size: 13px;
    line-height: 1.5;
}

.ast-notification-meta {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--ast-muted);
    font-size: 12px;
}

.ast-notification-meta span {
    display: inline-flex;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid var(--ast-border);
    background: var(--ast-card-bg);
}

.ast-notification-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

@media (max-width: 760px) {
    .ast-notification-item {
        grid-template-columns: 1fr;
    }

    .ast-notification-side {
        justify-content: flex-start;
    }
}

/* === AST PORTAL NOTIFICATIONS END 2026-04-26 === */

/* === AST PORTAL NOTIFICATIONS THEME FIX START 2026-04-26 === */

/*
   Исправление:
   - в светлых темах убираем лишнюю подложку у колокольчика и конверта;
   - у уведомлений убираем фиксированный рыжий цвет;
   - все акценты берём из активной темы.
*/

body:not(.theme-ast_dark):not(.theme-noc_night) .portal-mail-indicator {
    background: transparent !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

body:not(.theme-ast_dark):not(.theme-noc_night) .portal-mail-indicator:hover {
    background: var(--portal-nav-active-bg, rgba(60, 117, 255, .12)) !important;
    border-color: var(--portal-nav-border, rgba(60, 117, 255, .22)) !important;
}

body:not(.theme-ast_dark):not(.theme-noc_night) .portal-mail-icon {
    filter: none !important;
}

.portal-notification-indicator.has-unread {
    animation: portal-notification-theme-pulse 1.5s ease-in-out infinite !important;
}

@keyframes portal-notification-theme-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--ast-blue-main) 42%, transparent);
    }
    50% {
        box-shadow: 0 0 0 5px color-mix(in srgb, var(--ast-blue-main) 0%, transparent);
    }
}

.ast-notification-item.is-unread,
.ast-notification-item.priority-high,
.ast-notification-item.priority-urgent {
    border-color: var(--ast-blue-main) !important;
}

.ast-notification-item.priority-urgent {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--ast-blue-main) 35%, transparent),
                0 14px 34px var(--ast-shadow) !important;
}

.ast-notification-unread-dot {
    background: color-mix(in srgb, var(--ast-blue-main) 14%, transparent) !important;
    color: var(--ast-button-text, var(--ast-blue-main)) !important;
    border-color: color-mix(in srgb, var(--ast-blue-main) 38%, transparent) !important;
}

.ast-notification-meta span {
    border-color: var(--ast-border) !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-muted) !important;
}

/* === AST PORTAL NOTIFICATIONS THEME FIX END 2026-04-26 === */

/* === AST CONTRAST THEME SOFT NAV START 2026-04-26 === */

/*
   Контрастная тема остаётся контрастной по читаемости,
   но верхняя и нижняя панели больше не выглядят как светлая вставка.
*/
body.theme-ast_contrast {
    --portal-nav-color-from: #12122f !important;
    --portal-nav-color-to: #1d1a46 !important;
    --portal-footer-color-from: #12122f !important;
    --portal-footer-color-to: #1d1a46 !important;
    --portal-nav-text: #f7f4ff !important;
    --portal-nav-muted: #c9c2ff !important;
    --portal-nav-active-bg: rgba(139, 122, 255, .28) !important;
    --portal-nav-border: rgba(167, 139, 250, .42) !important;
}

body.theme-ast_contrast .portal-nav {
    background: linear-gradient(
        90deg,
        #12122f 0%,
        #1d1a46 100%
    ) !important;
    border-bottom: 1px solid rgba(167, 139, 250, .42) !important;
    color: #f7f4ff !important;
}

body.theme-ast_contrast .portal-nav a,
body.theme-ast_contrast .portal-nav .portal-brand,
body.theme-ast_contrast .portal-nav .portal-brand-text,
body.theme-ast_contrast .portal-user-name,
body.theme-ast_contrast .portal-theme-control,
body.theme-ast_contrast .portal-theme-control span {
    color: #f7f4ff !important;
}

body.theme-ast_contrast .portal-links a.active,
body.theme-ast_contrast .portal-links a:hover,
body.theme-ast_contrast .portal-logout,
body.theme-ast_contrast .portal-mail-indicator,
body.theme-ast_contrast .portal-theme-control {
    background: rgba(139, 122, 255, .22) !important;
    border-color: rgba(167, 139, 250, .48) !important;
    color: #ffffff !important;
}

body.theme-ast_contrast .portal-theme-control select {
    background: #050816 !important;
    color: #ffffff !important;
    border-color: rgba(167, 139, 250, .60) !important;
}

body.theme-ast_contrast .portal-brand-mark {
    background: linear-gradient(135deg, #7c3aed 0%, #38bdf8 100%) !important;
    color: #ffffff !important;
}

body.theme-ast_contrast .ast-portal-footer {
    background: linear-gradient(
        90deg,
        #12122f 0%,
        #1d1a46 100%
    ) !important;
    border-top: 1px solid rgba(167, 139, 250, .42) !important;
    color: #f7f4ff !important;
}

body.theme-ast_contrast .ast-portal-footer,
body.theme-ast_contrast .ast-portal-footer * {
    color: #f7f4ff !important;
}

/* === AST CONTRAST THEME SOFT NAV END 2026-04-26 === */

/* === AST CONTRAST NOTIFICATIONS PAGE BACKGROUND FIX START 2026-04-26 === */

/*
   Только страница /notifications/ в контрастной теме.
   Карта и остальные разделы не затрагиваются.
*/
html:has(body.theme-ast_contrast.ast-notifications-page-body) {
    background: #050816 !important;
}

body.theme-ast_contrast.ast-notifications-page-body {
    background: #050816 !important;
    color: #f7f4ff !important;
}

body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-page {
    background: #050816 !important;
    min-height: calc(100vh - var(--portal-nav-height, 30px) - var(--ast-portal-footer-real-height, 30px) - 90px) !important;
}

body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-card {
    background: #0f1028 !important;
    border-color: rgba(167, 139, 250, .42) !important;
    box-shadow: none !important;
}

body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-empty {
    background: #11132e !important;
    border-color: rgba(167, 139, 250, .35) !important;
    color: #c9c2ff !important;
}

/* === AST CONTRAST NOTIFICATIONS PAGE BACKGROUND FIX END 2026-04-26 === */

/* === AST DEVICE PAGE PORTAL DESIGN START 2026-04-26 === */
/*
   Единый активный блок оформления карточки устройства.
   Обновлено 2026-04-27 без добавления нового CSS-дубля:
   - верх карточки устройства переведён на портальную блочную структуру;
   - SNMP-блок приведён к стилю настроек портала;
   - старый migrated inline-style блок удаляется из активного CSS.
*/

body.ast-device-page-body {
    margin: 0 !important;
    background: var(--ast-bg) !important;
    color: var(--ast-text) !important;
    min-height: 100vh;
}

html:has(body.ast-device-page-body) {
    background: var(--ast-bg) !important;
}

body.ast-device-page-body .ast-device-page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 22px 18px 56px;
    color: var(--ast-text);
}

body.ast-device-page-body .box,
body.ast-device-page-body .ast-device-card {
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--ast-text) !important;
    box-shadow: none !important;
}

body.ast-device-page-body h1,
body.ast-device-page-body h2,
body.ast-device-page-body h3 {
    color: var(--ast-title) !important;
}

body.ast-device-page-body h1 {
    margin: 0 0 5px !important;
    font-size: 27px !important;
    line-height: 1.12;
}

body.ast-device-page-body h2 {
    margin: 0 !important;
    font-size: 21px !important;
    line-height: 1.2 !important;
}

body.ast-device-page-body a {
    color: var(--ast-button-text) !important;
}

body.ast-device-page-body .muted,
body.ast-device-page-body .graph-meta,
body.ast-device-page-body .summary-card-title,
body.ast-device-page-body .summary-card-subtitle {
    color: var(--ast-muted) !important;
}

body.ast-device-page-body .ast-device-back {
    margin: 0 0 14px !important;
    display: flex !important;
    justify-content: flex-start !important;
}

body.ast-device-page-body .ast-device-section,
body.ast-device-page-body .snmp-card,
body.ast-device-page-body .graphs-card {
    margin-top: 18px !important;
    padding: 20px !important;
    border-radius: 22px !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 14px 40px color-mix(in srgb, var(--ast-shadow) 90%, transparent) !important;
}

body.ast-device-page-body .ast-device-overview-block {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px) !important;
    grid-template-areas:
        "head type"
        "info info";
    gap: 12px !important;
    border-bottom: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    box-shadow: 0 14px 40px color-mix(in srgb, var(--ast-shadow) 90%, transparent) !important;
}

body.ast-device-page-body .ast-device-section-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    padding-bottom: 10px !important;
    margin-bottom: 12px !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .ast-device-status-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 28px !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--ast-blue-main) 12%, var(--ast-panel-bg)) !important;
    border: 1px solid color-mix(in srgb, var(--ast-blue-main) 38%, transparent) !important;
    color: var(--ast-title) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: .03em !important;
}

body.ast-device-page-body .ast-device-status-online {
    border-color: rgba(34, 197, 94, .55) !important;
}

body.ast-device-page-body .ast-device-status-offline,
body.ast-device-page-body .ast-device-status-down {
    border-color: rgba(239, 68, 68, .62) !important;
}

body.ast-device-page-body .ast-device-info-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)) !important;
    gap: 9px !important;
}

body.ast-device-page-body .ast-device-info-item {
    min-width: 0 !important;
    padding: 9px 10px !important;
    border-radius: 13px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border: 1px solid var(--ast-border) !important;
    color: var(--ast-text) !important;
}

body.ast-device-page-body .ast-device-info-item-wide {
    grid-column: 1 / -1 !important;
}

body.ast-device-page-body .ast-device-info-item span {
    display: block !important;
    margin-bottom: 5px !important;
    color: var(--ast-muted) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: .035em !important;
}

body.ast-device-page-body .ast-device-info-item strong {
    display: block !important;
    min-width: 0 !important;
    color: var(--ast-title) !important;
    font-size: 14px !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
    overflow-wrap: anywhere !important;
}

body.ast-device-page-body .ast-device-type-panel {
    margin-top: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 9px !important;
    flex-wrap: wrap !important;
    padding: 10px !important;
    border-radius: 14px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .ast-device-panel-title {
    color: var(--ast-title) !important;
    font-size: 14px !important;
    font-weight: 900 !important;
    margin-bottom: 4px !important;
}

body.ast-device-page-body .type-form,
body.ast-device-page-body .type-form[style],
body.ast-device-page-body .ast-device-type-form {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    margin: 0 !important;
}

body.ast-device-page-body select,
body.ast-device-page-body input[type="text"],
body.ast-device-page-body input[type="number"],
body.ast-device-page-body textarea {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text, var(--ast-text)) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 9px !important;
    padding: 7px 9px !important;
}

body.ast-device-page-body .ast-device-type-select {
    min-width: 220px !important;
}

body.ast-device-page-body .ast-device-type-readonly {
    padding: 8px 12px !important;
    border-radius: 999px !important;
    border: 1px solid var(--ast-border) !important;
    background: var(--ast-input-bg, var(--ast-card-bg)) !important;
    color: var(--ast-title) !important;
    font-weight: 900 !important;
}

body.ast-device-page-body .btn,
body.ast-device-page-body button,
body.ast-device-page-body input[type="submit"] {
    border-radius: 999px !important;
    border: 1px solid var(--ast-blue-main) !important;
    background: var(--ast-blue-main) !important;
    color: #fff !important;
    font-weight: 800 !important;
    padding: 7px 13px !important;
    cursor: pointer;
    text-decoration: none !important;
}

body.ast-device-page-body .btn.secondary,
body.ast-device-page-body a.btn.secondary {
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    color: var(--ast-button-text) !important;
    border-color: var(--ast-border) !important;
}

body.ast-device-page-body .btn:hover,
body.ast-device-page-body button:hover,
body.ast-device-page-body input[type="submit"]:hover {
    background: var(--ast-blue-dark) !important;
    color: #fff !important;
}

body.ast-device-page-body .snmp-head {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    padding-bottom: 10px !important;
    margin-bottom: 12px !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .snmp-card > .row {
    display: grid !important;
    grid-template-columns: minmax(135px, 190px) minmax(0, 1fr) !important;
    gap: 6px !important;
    align-items: baseline !important;
    margin: 0 !important;
    padding: 8px 10px !important;
    border-radius: 12px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .snmp-card > .row strong,
body.ast-device-page-body .row strong {
    color: var(--ast-title) !important;
}

body.ast-device-page-body .snmp-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)) !important;
    gap: 9px !important;
    margin: 12px 0 !important;
}

body.ast-device-page-body .summary-card,
body.ast-device-page-body .snmp-group,
body.ast-device-page-body .graph-item,
body.ast-device-page-body .graph-controls {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 16px !important;
}

body.ast-device-page-body .summary-card {
    padding: 10px 11px !important;
    min-height: 62px !important;
}

body.ast-device-page-body .summary-card-value {
    color: var(--ast-title) !important;
    font-size: 20px !important;
    font-weight: 900 !important;
    line-height: 1.08 !important;
}

body.ast-device-page-body .summary-card-ok {
    border-color: rgba(34, 197, 94, .42) !important;
}

body.ast-device-page-body .summary-card-warning {
    border-color: rgba(245, 158, 11, .46) !important;
}

body.ast-device-page-body .summary-card-danger {
    border-color: rgba(239, 68, 68, .50) !important;
}

body.ast-device-page-body .summary-card-muted {
    border-color: var(--ast-border) !important;
    opacity: .88;
}

body.ast-device-page-body .summary-card-warning .summary-card-value {
    color: #f59e0b !important;
}

body.ast-device-page-body .summary-card-danger .summary-card-value,
body.ast-device-page-body .snmp-value-danger,
body.ast-device-page-body .snmp-status-error {
    color: #ef4444 !important;
    font-weight: 900 !important;
}

body.ast-device-page-body .snmp-status-ok {
    color: #22c55e !important;
    font-weight: 900 !important;
}

body.ast-device-page-body .snmp-group {
    overflow: hidden !important;
    margin-top: 10px !important;
    border-radius: 13px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: none !important;
}

body.ast-device-page-body .snmp-group-title,
body.ast-device-page-body .snmp-table th,
body.ast-device-page-body .graph-title,
body.ast-device-page-body .graph-controls summary {
    background: var(--ast-panel-bg, var(--ast-button-hover)) !important;
    color: var(--ast-title) !important;
    border-color: var(--ast-border) !important;
}

body.ast-device-page-body .snmp-group-title {
    padding: 10px 12px !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .snmp-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 0 !important;
    background: transparent !important;
    color: var(--ast-text) !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

body.ast-device-page-body .snmp-table th,
body.ast-device-page-body .snmp-table td {
    border-bottom: 1px solid var(--ast-border) !important;
    padding: 7px 9px !important;
    color: var(--ast-text) !important;
    text-align: left !important;
    vertical-align: top !important;
    font-size: 13px !important;
}

body.ast-device-page-body .graphs-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
    gap: 14px !important;
    margin-top: 14px !important;
}

body.ast-device-page-body .graph-item {
    padding: 12px !important;
    overflow: hidden !important;
}

body.ast-device-page-body .graph-title {
    padding: 8px 10px !important;
    margin: -12px -12px 10px !important;
    border-bottom: 1px solid var(--ast-border) !important;
    font-weight: 900 !important;
}

body.ast-device-page-body .graph-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    background: #fff !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 10px !important;
}

body.ast-device-page-body .graph-controls {
    margin-top: 12px !important;
    padding: 14px !important;
}

body.ast-device-page-body .graph-controls summary {
    cursor: pointer !important;
    font-weight: 900 !important;
}

body.ast-device-page-body .graph-checks {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 9px 14px !important;
    margin-top: 12px !important;
}

body.ast-device-page-body .graph-check {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-start !important;
    color: var(--ast-text) !important;
    font-size: 14px !important;
}

body.ast-device-page-body .graph-check input {
    margin-top: 2px !important;
}

body.ast-device-page-body .graph-hidden-note {
    color: var(--ast-muted) !important;
    font-weight: 800;
}

body.ast-device-page-body .notice-ok,
body.ast-device-page-body .notice-warn {
    padding: 10px 12px !important;
    border-radius: 10px !important;
    border: 1px solid var(--ast-border) !important;
    white-space: pre-wrap !important;
}

body.ast-device-page-body .notice-ok {
    background: rgba(34, 197, 94, .14) !important;
    color: #22c55e !important;
    border-color: rgba(34, 197, 94, .40) !important;
}

body.ast-device-page-body .notice-warn {
    background: rgba(245, 158, 11, .14) !important;
    color: #f59e0b !important;
    border-color: rgba(245, 158, 11, .40) !important;
}

body.ast-device-page-body .code-small {
    font-family: Consolas, "Liberation Mono", monospace !important;
    font-size: 13px !important;
}

body.ast-device-page-body .viewer-device-card-lock {
    display: none !important;
}

@media (max-width: 720px) {
    body.ast-device-page-body .ast-device-page {
        padding: 16px 10px 50px !important;
    }

    body.ast-device-page-body .ast-device-section,
    body.ast-device-page-body .graphs-card {
        padding: 16px !important;
        border-radius: 18px !important;
    }

    body.ast-device-page-body .ast-device-info-grid {
        grid-template-columns: 1fr !important;
    }

    body.ast-device-page-body .ast-device-type-panel,
    body.ast-device-page-body .ast-device-type-form {
        align-items: stretch !important;
        justify-content: stretch !important;
    }

    body.ast-device-page-body .ast-device-type-select,
    body.ast-device-page-body .ast-device-type-submit {
        width: 100% !important;
    }

    body.ast-device-page-body .snmp-card > .row {
        grid-template-columns: 1fr !important;
    }

    body.ast-device-page-body .graphs-grid {
        grid-template-columns: 1fr !important;
    }
}


/* === AST DEVICE TWO VISUAL BLOCKS COMPACT RULES START 2026-04-27 === */
/*
   CSS-only перестройка карточки устройства:
   визуально остаются 2 больших блока:
   1) обзор + тип + SNMP;
   2) графики Cacti.
   PHP-разметка не меняется, чтобы не получить HTTP 500.
*/

body.ast-device-page-body .ast-device-overview-block .ast-device-section-head {
    grid-area: head !important;
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: 0 !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-info-grid {
    grid-area: info !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-type-panel {
    grid-area: type !important;
    align-self: start !important;
    width: 100% !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-type-panel .muted {
    display: none !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-panel-title {
    margin-bottom: 4px !important;
    font-size: 12px !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-type-form {
    width: 100% !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-type-select {
    min-width: 0 !important;
    flex: 1 1 170px !important;
}

body.ast-device-page-body .ast-device-overview-block + .snmp-card {
    margin-top: 0 !important;
    padding-top: 16px !important;
    border-top: 0 !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    box-shadow: 0 18px 44px color-mix(in srgb, var(--ast-shadow) 72%, transparent) !important;
}

body.ast-device-page-body .ast-device-overview-block + .snmp-card::before {
    content: "" !important;
    display: block !important;
    height: 1px !important;
    margin: -16px 0 16px !important;
    background: var(--ast-border) !important;
}

body.ast-device-page-body .snmp-card > .row + .row {
    margin-top: 7px !important;
}

body.ast-device-page-body .snmp-group-title {
    padding: 8px 10px !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .snmp-table th {
    font-size: 12px !important;
    text-transform: none !important;
}

body.ast-device-page-body .snmp-table tr:last-child td {
    border-bottom: 0 !important;
}

body.ast-device-page-body .graphs-card {
    margin-top: 20px !important;
}

@media (max-width: 900px) {
    body.ast-device-page-body .ast-device-overview-block {
        grid-template-columns: 1fr !important;
        grid-template-areas:
            "head"
            "type"
            "info";
    }
}

/* === AST DEVICE TWO VISUAL BLOCKS COMPACT RULES END 2026-04-27 === */


/* === AST DEVICE PAGE PORTAL DESIGN END 2026-04-26 === */

/* === AST DEVICE PAGE DARK EXTRA BLOCKS FIX START 2026-04-26 === */

/*
   Исправляет:
   1) дополнительные блоки в device.php, которые не попали в первый нормализатор;
   2) пропавший текст выбранной темы в верхнем селекте;
   3) не трогает карту и остальные страницы.
*/

/* Возвращаем нормальный вид селекта темы в верхней панели.
   Первый нормализатор карточки был слишком общим и цеплял все select на странице. */
body.ast-device-page-body .portal-nav .portal-theme-control select {
    min-width: 150px !important;
    max-width: 210px !important;
    height: 24px !important;
    padding: 2px 24px 2px 10px !important;
    border-radius: 999px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    text-align: left !important;
    text-align-last: center !important;
}

body.ast-device-page-body:not(.theme-ast_dark):not(.theme-noc_night):not(.theme-ast_contrast) .portal-nav .portal-theme-control select {
    background: #ffffff !important;
    color: var(--ast-title) !important;
    -webkit-text-fill-color: var(--ast-title) !important;
    border-color: var(--ast-border) !important;
}

body.ast-device-page-body:is(.theme-ast_dark, .theme-noc_night, .theme-ast_contrast) .portal-nav .portal-theme-control select {
    background: #050816 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border-color: rgba(167, 139, 250, .55) !important;
}

body.ast-device-page-body .portal-nav .portal-theme-control select option {
    background: var(--ast-card-bg) !important;
    color: var(--ast-title) !important;
}

/* Дополнительные верхнеуровневые блоки карточки устройства.
   Например блок "Бейдж вендора", который живёт отдельно от основной .box. */
body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) {
    margin-top: 18px !important;
    padding: 18px !important;
    border-radius: 20px !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 14px 40px var(--ast-shadow) !important;
}

body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) h1,
body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) h2,
body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) h3,
body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) label,
body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) strong {
    color: var(--ast-title) !important;
}

/* Внутренности дополнительных блоков: селекты, подсказки, превью, картинки. */
body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) :is(
    div,
    p,
    span,
    small,
    label
) {
    color: var(--ast-text) !important;
}

body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) :is(
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    select,
    textarea
) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text, var(--ast-text)) !important;
    -webkit-text-fill-color: var(--ast-input-text, var(--ast-text)) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 10px !important;
}

body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) button,
body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) .btn {
    background: var(--ast-blue-main) !important;
    color: #ffffff !important;
    border-color: var(--ast-blue-main) !important;
    border-radius: 999px !important;
    font-weight: 800 !important;
}

body.ast-device-page-body .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) img {
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border-color: var(--ast-border) !important;
}

/* Тёмные темы: жёстко убираем светлую подложку у дополнительных блоков. */
body.ast-device-page-body:is(.theme-ast_dark, .theme-noc_night, .theme-ast_contrast) .ast-device-page > :is(div, section, article, form):not(.box):not(.ast-device-card) {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* === AST DEVICE PAGE DARK EXTRA BLOCKS FIX END 2026-04-26 === */

/* === AST MAP VIS NAVIGATION CONTROLS FIX START 2026-04-26 === */

/*
   Кнопки навигации рисует библиотека vis-network.
   Поднимаем их над фиксированным футером портала.
*/

#network .vis-navigation .vis-button.vis-up {
    bottom: calc(var(--ast-portal-footer-real-height, var(--portal-footer-height, 30px)) + 60px) !important;
}

#network .vis-navigation .vis-button.vis-down,
#network .vis-navigation .vis-button.vis-left,
#network .vis-navigation .vis-button.vis-right,
#network .vis-navigation .vis-button.vis-zoomIn,
#network .vis-navigation .vis-button.vis-zoomOut {
    bottom: calc(var(--ast-portal-footer-real-height, var(--portal-footer-height, 30px)) + 20px) !important;
}

#network .vis-navigation .vis-button.vis-zoomExtends {
    bottom: calc(var(--ast-portal-footer-real-height, var(--portal-footer-height, 30px)) + 60px) !important;
}

/* === AST MAP VIS NAVIGATION CONTROLS FIX END 2026-04-26 === */

/* === AST MAP SETTINGS BLOCK LAYOUT START 2026-04-26 === */

html:has(body.map-settings-page-body) {
    background: var(--ast-bg) !important;
}

body.map-settings-page-body {
    margin: 0 !important;
    background: var(--ast-bg) !important;
    color: var(--ast-text) !important;
    min-height: 100vh;
}

body.map-settings-page-body .map-settings-page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px 18px calc(var(--ast-portal-footer-real-height, var(--portal-footer-height, 30px)) + 58px) !important;
    box-sizing: border-box;
}

body.map-settings-page-body .map-settings-shell {
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
}

body.map-settings-page-body .map-settings-top-panel,
body.map-settings-page-body .top {
    display: none !important;
}

body.map-settings-page-body .map-settings-section {
    scroll-margin-top: calc(var(--portal-nav-height, 30px) + var(--map-toolbar-height, 40px) + 28px);
    margin: 0 0 18px !important;
    padding: 22px !important;
    border-radius: 22px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
    color: var(--ast-text) !important;
    box-shadow: 0 14px 40px var(--ast-shadow) !important;
}

body.map-settings-page-body .map-settings-section > h2 {
    margin: 0 0 6px !important;
    color: var(--ast-title) !important;
    font-size: 24px !important;
    line-height: 1.2;
}

body.map-settings-page-body .map-settings-section > .hint {
    margin: 0 0 16px !important;
    color: var(--ast-muted) !important;
}

body.map-settings-page-body .map-settings-form {
    margin-top: 16px;
}

body.map-settings-page-body .map-settings-block-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

body.map-settings-page-body .map-settings-block {
    grid-column: span 6;
    padding: 16px !important;
    border-radius: 18px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border: 1px solid var(--ast-border) !important;
    color: var(--ast-text) !important;
    box-shadow: none !important;
}

body.map-settings-page-body .map-settings-block-main,
body.map-settings-page-body .map-settings-block-wide {
    grid-column: span 12;
}

body.map-settings-page-body .map-settings-block-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--ast-border);
}

body.map-settings-page-body .map-settings-block h3 {
    margin: 0 0 4px !important;
    color: var(--ast-title) !important;
    font-size: 17px !important;
    line-height: 1.2;
}

body.map-settings-page-body .map-settings-block p {
    margin: 0 !important;
    color: var(--ast-muted) !important;
    font-size: 13px;
    line-height: 1.45;
}

body.map-settings-page-body .settings-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
    gap: 12px !important;
    margin: 0 !important;
}

body.map-settings-page-body .field,
body.map-settings-page-body .settings-grid > label {
    display: flex !important;
    flex-direction: column !important;
    gap: 7px !important;
    padding: 12px !important;
    border-radius: 14px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid color-mix(in srgb, var(--ast-border) 78%, transparent) !important;
    color: var(--ast-text) !important;
}

body.map-settings-page-body label {
    color: var(--ast-title) !important;
    font-weight: 800 !important;
}

body.map-settings-page-body .hint,
body.map-settings-page-body .muted,
body.map-settings-page-body .card-subtitle {
    color: var(--ast-muted) !important;
}

body.map-settings-page-body input[type="text"],
body.map-settings-page-body input[type="number"],
body.map-settings-page-body select,
body.map-settings-page-body textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text, var(--ast-text)) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 10px !important;
    padding: 8px 10px !important;
}

body.map-settings-page-body input[type="color"] {
    width: 100% !important;
    min-height: 40px !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 10px !important;
    background: var(--ast-input-bg) !important;
    padding: 4px !important;
}

body.map-settings-page-body .map-settings-checks {
    display: grid;
    gap: 9px;
    margin-bottom: 12px;
}

body.map-settings-page-body .checkbox-row,
body.map-settings-page-body .check-row {
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid color-mix(in srgb, var(--ast-border) 78%, transparent) !important;
    color: var(--ast-text) !important;
}

body.map-settings-page-body .checkbox-row input,
body.map-settings-page-body .check-row input {
    flex: 0 0 auto;
}

body.map-settings-page-body .actions {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    margin-top: 16px !important;
}

body.map-settings-page-body .actions.left {
    justify-content: flex-start !important;
}

body.map-settings-page-body button,
body.map-settings-page-body .button-link,
body.map-settings-page-body .small-link {
    border-radius: 999px !important;
    text-decoration: none !important;
    font-weight: 900 !important;
}

body.map-settings-page-body button,
body.map-settings-page-body .button-link {
    border: 1px solid var(--ast-blue-main) !important;
    background: var(--ast-blue-main) !important;
    color: #ffffff !important;
    padding: 9px 15px !important;
    box-shadow: 0 8px 22px var(--ast-shadow) !important;
}

body.map-settings-page-body .small-link {
    color: var(--ast-button-text) !important;
}

body.map-settings-page-body .cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
    gap: 14px !important;
}

body.map-settings-page-body .device-card,
body.map-settings-page-body .link-card {
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 18px !important;
    padding: 16px !important;
    box-shadow: none !important;
}

body.map-settings-page-body .hidden-card {
    opacity: .72;
}

body.map-settings-page-body .card-title {
    color: var(--ast-title) !important;
    font-weight: 900 !important;
}

body.map-settings-page-body .badges {
    display: flex !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

body.map-settings-page-body .badge {
    border-radius: 999px !important;
    padding: 3px 8px !important;
    border: 1px solid var(--ast-border) !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-muted) !important;
    font-weight: 800 !important;
}

body.map-settings-page-body .badge.ok {
    color: #22c55e !important;
    border-color: rgba(34, 197, 94, .42) !important;
}

body.map-settings-page-body .badge.off {
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, .42) !important;
}

body.map-settings-page-body .badge.warn {
    color: #f59e0b !important;
    border-color: rgba(245, 158, 11, .42) !important;
}

body.map-settings-page-body details.link-details {
    margin-top: 12px;
}

body.map-settings-page-body details.link-details summary {
    cursor: pointer;
    color: var(--ast-title) !important;
    font-weight: 900;
}

body.map-settings-page-body .msg,
body.map-settings-page-body .err {
    margin: 0 0 14px !important;
    border-radius: 16px !important;
    padding: 12px 14px !important;
    font-weight: 800 !important;
}

body.map-settings-page-body .msg {
    background: rgba(34, 197, 94, .14) !important;
    color: #22c55e !important;
    border: 1px solid rgba(34, 197, 94, .36) !important;
}

body.map-settings-page-body .err {
    background: rgba(239, 68, 68, .14) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, .36) !important;
}

body.map-settings-page-body hr {
    border: 0 !important;
    border-top: 1px solid var(--ast-border) !important;
    margin: 18px 0 !important;
}

@media (max-width: 900px) {
    body.map-settings-page-body .map-settings-block,
    body.map-settings-page-body .map-settings-block-main,
    body.map-settings-page-body .map-settings-block-wide {
        grid-column: span 12;
    }
}

/* === AST MAP SETTINGS BLOCK LAYOUT END 2026-04-26 === */

/* === AST MAP DISPLAY TILE V2 START 2026-04-26 === */

/*
   Полная плиточная структура блока "Отображение карты".
   Ширина плиток задаётся настройкой map_settings_tile_width_px.
   Высота меняется пропорционально ширине через aspect-ratio.
*/

body.map-settings-page-body .map-display-form-v2 {
    margin-top: 18px !important;
}

body.map-settings-page-body .map-display-tile-grid-v2 {
    --map-settings-tile-width: var(--map-settings-tile-width, 420px);
    display: grid !important;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, var(--map-settings-tile-width, 420px)), 1fr)
    ) !important;
    gap: 18px !important;
    align-items: stretch !important;
}

body.map-settings-page-body .map-display-tile {
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: 14px !important;
    min-height: 260px !important;
    aspect-ratio: 1.55 / 1;
    padding: 20px !important;
    border-radius: 22px !important;
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--ast-card-bg) 92%, var(--ast-blue-main) 8%),
            var(--ast-panel-bg, var(--ast-card-bg))
        ) !important;
    border: 1px solid color-mix(in srgb, var(--ast-border) 82%, var(--ast-blue-main) 18%) !important;
    color: var(--ast-text) !important;
    box-shadow: 0 14px 34px color-mix(in srgb, var(--ast-shadow) 82%, transparent) !important;
    overflow: hidden;
}

body.map-settings-page-body .map-display-tile::after {
    content: "";
    position: absolute;
    right: -46px;
    top: -46px;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ast-blue-main) 10%, transparent);
    pointer-events: none;
}

body.map-settings-page-body .map-display-tile-wide {
    grid-column: 1 / -1 !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
}

body.map-settings-page-body .map-display-tile-head {
    position: relative;
    z-index: 1;
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid color-mix(in srgb, var(--ast-border) 78%, transparent) !important;
}

body.map-settings-page-body .map-display-tile-kicker {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--ast-blue-main) 14%, transparent);
    color: var(--ast-button-text, var(--ast-blue-main));
    border: 1px solid color-mix(in srgb, var(--ast-blue-main) 34%, transparent);
    font-size: 13px;
    font-weight: 950;
}

body.map-settings-page-body .map-display-tile h3 {
    margin: 0 0 5px !important;
    color: var(--ast-title) !important;
    font-size: 18px !important;
    line-height: 1.2 !important;
}

body.map-settings-page-body .map-display-tile p {
    margin: 0 !important;
    color: var(--ast-muted) !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
}

body.map-settings-page-body .map-display-tile-body {
    position: relative;
    z-index: 1;
    display: grid !important;
    gap: 12px !important;
}

body.map-settings-page-body .map-display-tile .field,
body.map-settings-page-body .map-display-tile .checkbox-row,
body.map-settings-page-body .map-display-inner-grid .field {
    background: color-mix(in srgb, var(--ast-card-bg) 92%, transparent) !important;
    border-color: color-mix(in srgb, var(--ast-border) 76%, transparent) !important;
    box-shadow: none !important;
}

body.map-settings-page-body .map-display-inner-grid {
    position: relative;
    z-index: 1;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
}

body.map-settings-page-body .map-display-actions {
    margin-top: 20px !important;
    padding: 14px !important;
    border-radius: 20px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-actions button {
    min-width: 260px;
}

body.map-settings-page-body:is(.theme-ast_dark, .theme-noc_night, .theme-ast_contrast) .map-display-tile {
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--ast-card-bg) 90%, var(--ast-blue-main) 10%),
            var(--ast-panel-bg, var(--ast-card-bg))
        ) !important;
}

@media (max-width: 760px) {
    body.map-settings-page-body .map-display-tile-grid-v2 {
        grid-template-columns: 1fr !important;
    }

    body.map-settings-page-body .map-display-tile {
        aspect-ratio: auto !important;
        min-height: 0 !important;
    }

    body.map-settings-page-body .map-display-actions button {
        width: 100%;
        min-width: 0;
    }
}

/* === AST MAP DISPLAY TILE V2 END 2026-04-26 === */

/* === AST MAP DISPLAY TILE COMPACT THEME FIX START 2026-04-26 === */

/*
   Исправление плиток блока "Отображение карты":
   - убираем искусственную aspect-ratio высоту;
   - высота блока теперь зависит от содержимого;
   - убираем декоративные фиолетовые круги;
   - цвета берём из активной темы портала;
   - настройка ширины плиток влияет только на ширину колонок.
*/

body.map-settings-page-body .map-display-tile-grid-v2 {
    display: grid !important;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, var(--map-settings-tile-width, 420px)), 1fr)
    ) !important;
    gap: 12px !important;
    align-items: start !important;
}

body.map-settings-page-body .map-display-tile {
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 14px !important;
    border-radius: 18px !important;

    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--ast-shadow) 72%, transparent) !important;
}

body.map-settings-page-body .map-display-tile::after {
    display: none !important;
    content: none !important;
}

body.map-settings-page-body .map-display-tile-wide {
    grid-column: 1 / -1 !important;
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;
}

body.map-settings-page-body .map-display-tile-head {
    gap: 10px !important;
    padding-bottom: 9px !important;
    margin-bottom: 0 !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-tile-kicker {
    width: 30px !important;
    height: 30px !important;
    border-radius: 10px !important;
    background: var(--ast-panel-bg, var(--ast-button-hover)) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border: 1px solid var(--ast-border) !important;
    font-size: 12px !important;
}

body.map-settings-page-body .map-display-tile h3 {
    color: var(--ast-title) !important;
    font-size: 16px !important;
    margin: 0 0 3px !important;
}

body.map-settings-page-body .map-display-tile p {
    color: var(--ast-muted) !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
}

body.map-settings-page-body .map-display-tile-body {
    gap: 9px !important;
}

body.map-settings-page-body .map-display-tile .field,
body.map-settings-page-body .map-display-tile .checkbox-row,
body.map-settings-page-body .map-display-inner-grid .field {
    padding: 10px !important;
    border-radius: 13px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-tile label {
    color: var(--ast-title) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
}

body.map-settings-page-body .map-display-tile .hint {
    color: var(--ast-muted) !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
}

body.map-settings-page-body .map-display-tile input[type="text"],
body.map-settings-page-body .map-display-tile input[type="number"],
body.map-settings-page-body .map-display-tile select,
body.map-settings-page-body .map-display-tile textarea {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text, var(--ast-text)) !important;
    -webkit-text-fill-color: var(--ast-input-text, var(--ast-text)) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 10px !important;
    padding: 8px 10px !important;
}

body.map-settings-page-body .map-display-tile input[type="color"] {
    background: var(--ast-input-bg) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 10px !important;
    min-height: 34px !important;
    padding: 3px !important;
}

body.map-settings-page-body .map-display-inner-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 10px !important;
}

body.map-settings-page-body .map-display-actions {
    margin-top: 12px !important;
    padding: 12px !important;
    border-radius: 18px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--ast-shadow) 72%, transparent) !important;
}

/* Тёмные и контрастные темы — без светлых/фиолетовых подложек */
body.map-settings-page-body:is(.theme-ast_dark, .theme-noc_night, .theme-ast_contrast) .map-display-tile,
body.map-settings-page-body:is(.theme-ast_dark, .theme-noc_night, .theme-ast_contrast) .map-display-actions {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

body.map-settings-page-body:is(.theme-ast_dark, .theme-noc_night, .theme-ast_contrast) .map-display-tile .field,
body.map-settings-page-body:is(.theme-ast_dark, .theme-noc_night, .theme-ast_contrast) .map-display-tile .checkbox-row {
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

/* === AST MAP DISPLAY TILE COMPACT THEME FIX END 2026-04-26 === */

/* === AST MAP DISPLAY TILE FINAL COMPACT START 2026-04-26 === */

/*
   Финальная компактная версия блока "Отображение карты":
   - плитки не растягиваются на всю строку;
   - wide-классы больше не делают огромные баннеры;
   - высота строго по содержимому;
   - ширина берётся из настройки, минимум разрешён 50px;
   - цвета только из текущей темы.
*/

body.map-settings-page-body .map-display-tile-grid-v2 {
    display: grid !important;
    grid-template-columns: repeat(
        auto-fill,
        minmax(
            min(100%, var(--map-settings-tile-width, 260px)),
            var(--map-settings-tile-width, 260px)
        )
    ) !important;
    justify-content: start !important;
    align-items: start !important;
    gap: 10px !important;
}

body.map-settings-page-body .map-display-tile,
body.map-settings-page-body .map-display-tile-wide,
body.map-settings-page-body .map-display-tile-main {
    grid-column: auto !important;
    width: auto !important;
    max-width: var(--map-settings-tile-width, 260px) !important;
    min-width: min(100%, var(--map-settings-tile-width, 260px)) !important;
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;

    display: grid !important;
    gap: 8px !important;
    align-content: start !important;
    justify-content: stretch !important;

    padding: 10px !important;
    border-radius: 15px !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--ast-shadow) 62%, transparent) !important;
    overflow: visible !important;
}

body.map-settings-page-body .map-display-tile::after {
    display: none !important;
    content: none !important;
}

body.map-settings-page-body .map-display-tile-head {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding-bottom: 7px !important;
    margin: 0 !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-tile-kicker {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    border-radius: 8px !important;
    font-size: 11px !important;
    background: var(--ast-panel-bg, var(--ast-button-hover)) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-tile h3 {
    margin: 0 0 2px !important;
    font-size: 14px !important;
    line-height: 1.18 !important;
    color: var(--ast-title) !important;
}

body.map-settings-page-body .map-display-tile p {
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
    color: var(--ast-muted) !important;
}

body.map-settings-page-body .map-display-tile-body {
    display: grid !important;
    gap: 7px !important;
}

body.map-settings-page-body .map-display-tile .field,
body.map-settings-page-body .map-display-tile .checkbox-row,
body.map-settings-page-body .map-display-inner-grid .field {
    padding: 8px !important;
    border-radius: 11px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-inner-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
}

body.map-settings-page-body .map-display-tile label {
    font-size: 11px !important;
    line-height: 1.2 !important;
    color: var(--ast-title) !important;
    font-weight: 900 !important;
}

body.map-settings-page-body .map-display-tile .hint {
    font-size: 11px !important;
    line-height: 1.25 !important;
    color: var(--ast-muted) !important;
}

body.map-settings-page-body .map-display-tile input[type="text"],
body.map-settings-page-body .map-display-tile input[type="number"],
body.map-settings-page-body .map-display-tile select,
body.map-settings-page-body .map-display-tile textarea {
    min-height: 30px !important;
    padding: 6px 8px !important;
    border-radius: 9px !important;
    font-size: 12px !important;
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text, var(--ast-text)) !important;
    -webkit-text-fill-color: var(--ast-input-text, var(--ast-text)) !important;
    border: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-tile input[type="color"] {
    min-height: 30px !important;
    padding: 2px !important;
    border-radius: 9px !important;
    background: var(--ast-input-bg) !important;
    border: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-display-actions {
    justify-content: flex-start !important;
    margin-top: 10px !important;
    padding: 10px !important;
    border-radius: 15px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--ast-shadow) 62%, transparent) !important;
}

body.map-settings-page-body .map-display-actions button {
    min-width: 0 !important;
}

@media (max-width: 760px) {
    body.map-settings-page-body .map-display-tile-grid-v2 {
        grid-template-columns: 1fr !important;
    }

    body.map-settings-page-body .map-display-tile,
    body.map-settings-page-body .map-display-tile-wide,
    body.map-settings-page-body .map-display-tile-main {
        max-width: none !important;
        min-width: 0 !important;
    }
}

/* === AST MAP DISPLAY TILE FINAL COMPACT END 2026-04-26 === */

/* === AST MAP SETTINGS FINAL COMPACT GRID START 2026-04-26 === */

/*
   Финальная компактная раскладка /ast-map/settings.php:
   - плитки блока "Отображение карты" плотнее и меньше;
   - карточки устройств и связей ниже приведены к тому же стилю;
   - секции стали компактнее;
   - цвета берутся из активной темы портала.
*/

body.map-settings-page-body .map-settings-page {
    max-width: 1380px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
}

body.map-settings-page-body .map-settings-section {
    padding: 14px !important;
    border-radius: 18px !important;
    margin-bottom: 12px !important;
}

body.map-settings-page-body .map-settings-section > h2 {
    font-size: 21px !important;
    margin-bottom: 3px !important;
}

body.map-settings-page-body .map-settings-section > .hint {
    margin-bottom: 12px !important;
    font-size: 12px !important;
}

/* Плитки отображения карты — плотная раскладка по странице */
body.map-settings-page-body .map-display-tile-grid-v2 {
    display: grid !important;
    grid-template-columns: repeat(
        auto-fill,
        minmax(
            min(100%, var(--map-settings-tile-width, 220px)),
            var(--map-settings-tile-width, 220px)
        )
    ) !important;
    gap: 8px !important;
    justify-content: start !important;
    align-items: start !important;
}

body.map-settings-page-body .map-display-tile,
body.map-settings-page-body .map-display-tile-wide,
body.map-settings-page-body .map-display-tile-main {
    max-width: var(--map-settings-tile-width, 220px) !important;
    min-width: min(100%, var(--map-settings-tile-width, 220px)) !important;
    padding: 8px !important;
    border-radius: 13px !important;
    gap: 6px !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ast-shadow) 55%, transparent) !important;
}

body.map-settings-page-body .map-display-tile-head {
    gap: 7px !important;
    padding-bottom: 6px !important;
}

body.map-settings-page-body .map-display-tile-kicker {
    width: 23px !important;
    height: 23px !important;
    min-width: 23px !important;
    border-radius: 7px !important;
    font-size: 10px !important;
}

body.map-settings-page-body .map-display-tile h3 {
    font-size: 13px !important;
    line-height: 1.15 !important;
}

body.map-settings-page-body .map-display-tile p {
    font-size: 10.5px !important;
    line-height: 1.22 !important;
}

body.map-settings-page-body .map-display-tile .field,
body.map-settings-page-body .map-display-tile .checkbox-row,
body.map-settings-page-body .map-display-inner-grid .field {
    padding: 7px !important;
    border-radius: 10px !important;
}

body.map-settings-page-body .map-display-tile label {
    font-size: 10.5px !important;
}

body.map-settings-page-body .map-display-tile .hint {
    font-size: 10.5px !important;
    line-height: 1.22 !important;
}

body.map-settings-page-body .map-display-tile input[type="text"],
body.map-settings-page-body .map-display-tile input[type="number"],
body.map-settings-page-body .map-display-tile select,
body.map-settings-page-body .map-display-tile textarea {
    min-height: 28px !important;
    padding: 5px 7px !important;
    font-size: 11.5px !important;
    border-radius: 8px !important;
}

/* Длинные блоки внутри плиток тоже не растягиваем в огромные баннеры */
body.map-settings-page-body .map-display-inner-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
}

body.map-settings-page-body .map-display-actions {
    margin-top: 8px !important;
    padding: 8px !important;
    border-radius: 13px !important;
}

/* Нижние секции: устройства, связи, интеграции — тот же компактный стиль */
body.map-settings-page-body .cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
    gap: 8px !important;
    align-items: start !important;
}

body.map-settings-page-body .device-card,
body.map-settings-page-body .link-card {
    padding: 10px !important;
    border-radius: 13px !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ast-shadow) 55%, transparent) !important;
}

body.map-settings-page-body .card-head {
    gap: 8px !important;
    padding-bottom: 7px !important;
    margin-bottom: 7px !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .card-title {
    font-size: 13px !important;
    line-height: 1.2 !important;
}

body.map-settings-page-body .card-subtitle,
body.map-settings-page-body .device-card .muted,
body.map-settings-page-body .link-card .muted {
    font-size: 10.5px !important;
    line-height: 1.25 !important;
}

body.map-settings-page-body .badges {
    gap: 4px !important;
}

body.map-settings-page-body .badge {
    padding: 2px 6px !important;
    font-size: 10px !important;
}

body.map-settings-page-body .device-display-name-row {
    margin-top: 7px !important;
    display: grid !important;
    gap: 5px !important;
}

body.map-settings-page-body .device-options {
    display: grid !important;
    gap: 5px !important;
    margin-top: 7px !important;
}

body.map-settings-page-body .check-row,
body.map-settings-page-body .checkbox-row {
    padding: 7px 8px !important;
    border-radius: 10px !important;
}

body.map-settings-page-body .check-row label,
body.map-settings-page-body .checkbox-row {
    font-size: 11px !important;
}

body.map-settings-page-body .compact-row {
    margin-top: 7px !important;
}

/* Формы связей и добавления связи — тоже компактнее */
body.map-settings-page-body .link-grid,
body.map-settings-page-body .add-link-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
    gap: 7px !important;
}

body.map-settings-page-body .field,
body.map-settings-page-body .settings-grid > label {
    padding: 8px !important;
    border-radius: 10px !important;
}

body.map-settings-page-body label {
    font-size: 11px !important;
}

body.map-settings-page-body input[type="text"],
body.map-settings-page-body input[type="number"],
body.map-settings-page-body select,
body.map-settings-page-body textarea {
    min-height: 29px !important;
    padding: 5px 7px !important;
    font-size: 11.5px !important;
    border-radius: 8px !important;
}

body.map-settings-page-body details.link-details {
    margin-top: 8px !important;
}

body.map-settings-page-body details.link-details summary {
    font-size: 12px !important;
}

body.map-settings-page-body .actions {
    margin-top: 10px !important;
    gap: 8px !important;
}

body.map-settings-page-body button,
body.map-settings-page-body .button-link {
    padding: 7px 11px !important;
    font-size: 12px !important;
}

/* Интеграции — сделать не отдельным огромным блоком, а компактной карточкой */
body.map-settings-page-body #map-integrations .actions {
    justify-content: flex-start !important;
}

body.map-settings-page-body #map-integrations .button-link {
    display: inline-flex !important;
    width: auto !important;
}

/* На узком экране не ломаем читаемость */
@media (max-width: 760px) {
    body.map-settings-page-body .map-display-tile-grid-v2,
    body.map-settings-page-body .cards-grid,
    body.map-settings-page-body .link-grid,
    body.map-settings-page-body .add-link-grid {
        grid-template-columns: 1fr !important;
    }

    body.map-settings-page-body .map-display-tile,
    body.map-settings-page-body .map-display-tile-wide,
    body.map-settings-page-body .map-display-tile-main {
        max-width: none !important;
        min-width: 0 !important;
    }
}

/* === AST MAP SETTINGS FINAL COMPACT GRID END 2026-04-26 === */

/* === AST MAP SETTINGS MASONRY COMPACT LAYOUT START 2026-04-26 === */

/*
   Автоматическая компактная раскладка плиток.
   Решает проблему пустого места под короткими плитками в CSS Grid.

   Важно:
   - высота страницы становится меньше;
   - плитки идут сверху вниз по колонке, затем следующая колонка;
   - ширина колонок берётся из настройки map_settings_tile_width_px.
*/

/* Блок "Отображение карты" */
body.map-settings-page-body .map-display-tile-grid-v2 {
    display: block !important;
    column-width: var(--map-settings-tile-width, 220px) !important;
    column-gap: 8px !important;
    column-fill: balance !important;
}

body.map-settings-page-body .map-display-tile,
body.map-settings-page-body .map-display-tile-wide,
body.map-settings-page-body .map-display-tile-main {
    display: inline-block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin: 0 0 8px !important;
    vertical-align: top !important;
}

/* Нижние карточки устройств и связей — тоже компактнее по высоте */
body.map-settings-page-body .cards-grid {
    display: block !important;
    column-width: 280px !important;
    column-gap: 8px !important;
    column-fill: balance !important;
}

body.map-settings-page-body .device-card,
body.map-settings-page-body .link-card {
    display: inline-block !important;
    width: 100% !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin: 0 0 8px !important;
    vertical-align: top !important;
}

/* Добавление связи оставляем обычной сеткой: там форма должна читаться слева направо */
body.map-settings-page-body .add-link-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
    gap: 7px !important;
}

/* На узком экране возвращаем обычную одну колонку */
@media (max-width: 760px) {
    body.map-settings-page-body .map-display-tile-grid-v2,
    body.map-settings-page-body .cards-grid {
        column-width: auto !important;
        column-count: 1 !important;
    }
}

/* === AST MAP SETTINGS MASONRY COMPACT LAYOUT END 2026-04-26 === */

/* === AST MAP SETTINGS FINAL MASONRY TUNE START 2026-04-26 === */

/*
   Финальная подстройка settings.php:
   - кнопку "Открыть настройки паролей" убираем из секции, т.к. она перенесена в панель раздела;
   - нижние карточки делаем максимально компактными;
   - раскладку карточек устройств и связей делаем автоматической и плотной;
   - сохраняем стиль текущей темы портала.
*/

/* 1. Старую кнопку в секции Интеграции скрываем */
body.map-settings-page-body #map-integrations .actions,
body.map-settings-page-body #map-integrations .button-link {
    display: none !important;
}

/* 2. Секцию Интеграции делаем компактнее */
body.map-settings-page-body #map-integrations {
    padding-bottom: 10px !important;
}

body.map-settings-page-body #map-integrations > h2 {
    margin-bottom: 2px !important;
}

body.map-settings-page-body #map-integrations > .hint {
    margin-bottom: 0 !important;
}

/* 3. Верхние плитки ещё немного уменьшаем */
body.map-settings-page-body .map-display-tile-grid-v2 {
    column-gap: 6px !important;
}

body.map-settings-page-body .map-display-tile,
body.map-settings-page-body .map-display-tile-wide,
body.map-settings-page-body .map-display-tile-main {
    margin: 0 0 6px !important;
    padding: 7px !important;
    border-radius: 11px !important;
    box-shadow: 0 3px 10px color-mix(in srgb, var(--ast-shadow) 48%, transparent) !important;
}

body.map-settings-page-body .map-display-tile-head {
    gap: 6px !important;
    padding-bottom: 5px !important;
}

body.map-settings-page-body .map-display-tile-kicker {
    width: 21px !important;
    height: 21px !important;
    min-width: 21px !important;
    border-radius: 6px !important;
    font-size: 9px !important;
}

body.map-settings-page-body .map-display-tile h3 {
    font-size: 12px !important;
}

body.map-settings-page-body .map-display-tile p,
body.map-settings-page-body .map-display-tile .hint,
body.map-settings-page-body .map-display-tile label {
    font-size: 10px !important;
    line-height: 1.18 !important;
}

body.map-settings-page-body .map-display-tile .field,
body.map-settings-page-body .map-display-tile .checkbox-row,
body.map-settings-page-body .map-display-inner-grid .field {
    padding: 6px !important;
    border-radius: 9px !important;
}

body.map-settings-page-body .map-display-tile input[type="text"],
body.map-settings-page-body .map-display-tile input[type="number"],
body.map-settings-page-body .map-display-tile select,
body.map-settings-page-body .map-display-tile textarea {
    min-height: 26px !important;
    padding: 4px 6px !important;
    font-size: 11px !important;
}

/* 4. Нижние карточки устройств / связей — плотная masonry-раскладка */
body.map-settings-page-body .cards-grid {
    display: block !important;
    column-width: 210px !important;
    column-gap: 6px !important;
    column-fill: balance !important;
}

body.map-settings-page-body .device-card,
body.map-settings-page-body .link-card {
    display: inline-block !important;
    width: 100% !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    vertical-align: top !important;

    margin: 0 0 6px !important;
    padding: 7px !important;
    border-radius: 11px !important;

    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 3px 10px color-mix(in srgb, var(--ast-shadow) 48%, transparent) !important;
}

body.map-settings-page-body .card-head {
    gap: 6px !important;
    padding-bottom: 5px !important;
    margin-bottom: 5px !important;
}

body.map-settings-page-body .card-title {
    font-size: 12px !important;
    line-height: 1.15 !important;
}

body.map-settings-page-body .card-subtitle,
body.map-settings-page-body .device-card .muted,
body.map-settings-page-body .link-card .muted,
body.map-settings-page-body .device-card p,
body.map-settings-page-body .link-card p,
body.map-settings-page-body .device-card label,
body.map-settings-page-body .link-card label {
    font-size: 10px !important;
    line-height: 1.18 !important;
}

body.map-settings-page-body .badge {
    padding: 1px 5px !important;
    font-size: 9px !important;
    border-radius: 999px !important;
}

body.map-settings-page-body .device-display-name-row,
body.map-settings-page-body .device-options,
body.map-settings-page-body .compact-row {
    margin-top: 5px !important;
    gap: 4px !important;
}

body.map-settings-page-body .check-row,
body.map-settings-page-body .checkbox-row {
    padding: 5px 6px !important;
    border-radius: 8px !important;
}

body.map-settings-page-body .check-row label,
body.map-settings-page-body .checkbox-row {
    font-size: 10px !important;
}

body.map-settings-page-body .field,
body.map-settings-page-body .settings-grid > label {
    padding: 6px !important;
    border-radius: 8px !important;
}

body.map-settings-page-body input[type="text"],
body.map-settings-page-body input[type="number"],
body.map-settings-page-body select,
body.map-settings-page-body textarea {
    min-height: 26px !important;
    padding: 4px 6px !important;
    font-size: 11px !important;
    border-radius: 7px !important;
}

/* 5. Списки/формы связей тоже чуть уплотняем */
body.map-settings-page-body .link-grid,
body.map-settings-page-body .add-link-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    gap: 6px !important;
}

/* 6. Общие кнопки компактнее */
body.map-settings-page-body .actions {
    margin-top: 7px !important;
    gap: 6px !important;
}

body.map-settings-page-body button,
body.map-settings-page-body .button-link {
    padding: 6px 10px !important;
    font-size: 11px !important;
    border-radius: 999px !important;
}

/* 7. На мобильном — одна колонка */
@media (max-width: 760px) {
    body.map-settings-page-body .cards-grid,
    body.map-settings-page-body .map-display-tile-grid-v2 {
        column-width: auto !important;
        column-count: 1 !important;
    }
}

/* === AST MAP SETTINGS FINAL MASONRY TUNE END 2026-04-26 === */

/* === AST MAP SETTINGS GRID MASONRY THEME FIX START 2026-04-26 === */

/*
   Исправляет прежний column/masonry:
   - плитки сначала заполняют ширину экрана;
   - затем JS подбирает grid-row span для экономии высоты;
   - кнопки возвращены к цветам активной темы;
   - нижние карточки устройств и связей получают такую же раскладку.
*/

body.map-settings-page-body .map-display-tile-grid-v2 {
    display: grid !important;
    grid-template-columns: repeat(
        auto-fill,
        minmax(min(100%, var(--map-settings-tile-width, 220px)), 1fr)
    ) !important;
    grid-auto-rows: 6px !important;
    grid-auto-flow: dense !important;
    gap: 8px !important;
    align-items: start !important;
    justify-content: stretch !important;
    column-width: auto !important;
    column-count: auto !important;
}

body.map-settings-page-body .map-display-tile,
body.map-settings-page-body .map-display-tile-wide,
body.map-settings-page-body .map-display-tile-main {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
    grid-column: auto !important;

    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ast-shadow) 45%, transparent) !important;
}

/* Нижние карточки: сначала ширина, потом экономия высоты */
body.map-settings-page-body #map-devices .cards-grid,
body.map-settings-page-body #map-links .cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    grid-auto-rows: 6px !important;
    grid-auto-flow: dense !important;
    gap: 8px !important;
    align-items: start !important;
    justify-content: stretch !important;
    column-width: auto !important;
    column-count: auto !important;
}

body.map-settings-page-body #map-devices .device-card,
body.map-settings-page-body #map-links .link-card {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    break-inside: auto !important;
    page-break-inside: auto !important;

    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ast-shadow) 45%, transparent) !important;
}

/* Панель раздела: не даём старым generic-правилам settings.php ломать стиль кнопок */
body.map-settings-page-body .portal-work-panel-actions .btn,
body.map-settings-page-body .portal-work-panel-actions a.btn,
body.map-settings-page-body .portal-work-panel-actions button.btn {
    background: var(--ast-card-bg) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ast-shadow) 45%, transparent) !important;
    border-radius: 999px !important;
    padding: 7px 13px !important;
    font-size: 13px !important;
    font-weight: 900 !important;
}

body.map-settings-page-body .portal-work-panel-actions .btn:hover,
body.map-settings-page-body .portal-work-panel-actions a.btn:hover,
body.map-settings-page-body .portal-work-panel-actions button.btn:hover {
    background: var(--ast-button-hover, var(--ast-panel-bg)) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border-color: var(--ast-blue-main, var(--ast-border)) !important;
}

/* Кнопки внутри самой страницы настроек */
body.map-settings-page-body .map-settings-page button,
body.map-settings-page-body .map-settings-page .button-link,
body.map-settings-page-body .map-settings-page a.button-link {
    background: var(--ast-card-bg) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ast-shadow) 45%, transparent) !important;
    border-radius: 999px !important;
}

body.map-settings-page-body .map-settings-page button[type="submit"] {
    background: var(--ast-blue-main) !important;
    color: #ffffff !important;
    border-color: var(--ast-blue-main) !important;
}

body.map-settings-page-body .map-settings-page button:hover,
body.map-settings-page-body .map-settings-page .button-link:hover {
    background: var(--ast-button-hover, var(--ast-panel-bg)) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border-color: var(--ast-blue-main, var(--ast-border)) !important;
}

body.map-settings-page-body .map-settings-page button[type="submit"]:hover {
    background: var(--ast-blue-dark, var(--ast-blue-main)) !important;
    color: #ffffff !important;
}

/* Внутренние поля и чекбоксы — только цвета текущей темы */
body.map-settings-page-body .map-display-tile .field,
body.map-settings-page-body .map-display-tile .checkbox-row,
body.map-settings-page-body .device-card .field,
body.map-settings-page-body .device-card .check-row,
body.map-settings-page-body .link-card .field,
body.map-settings-page-body .link-card .check-row {
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
}

body.map-settings-page-body .map-display-tile h3,
body.map-settings-page-body .device-card .card-title,
body.map-settings-page-body .link-card .card-title,
body.map-settings-page-body .map-settings-section > h2 {
    color: var(--ast-title) !important;
}

body.map-settings-page-body .map-display-tile p,
body.map-settings-page-body .map-display-tile .hint,
body.map-settings-page-body .device-card .muted,
body.map-settings-page-body .link-card .muted,
body.map-settings-page-body .card-subtitle,
body.map-settings-page-body .map-settings-section > .hint {
    color: var(--ast-muted) !important;
}

/* На маленьких экранах — одна нормальная колонка */
@media (max-width: 760px) {
    body.map-settings-page-body .map-display-tile-grid-v2,
    body.map-settings-page-body #map-devices .cards-grid,
    body.map-settings-page-body #map-links .cards-grid {
        grid-template-columns: 1fr !important;
    }
}

/* === AST MAP SETTINGS GRID MASONRY THEME FIX END 2026-04-26 === */

/* === AST MAP SETTINGS LINKS WIDTH-FIRST FINAL START 2026-04-26 === */

/*
   Финальная логика:
   - все плитки сначала занимают ширину экрана;
   - затем JS уплотняет их по высоте через grid-row span;
   - секция "Связи между устройствами" работает так же;
   - цветовые настройки убраны, цвета берутся только из темы.
*/

body.map-settings-page-body .map-display-tile-grid-v2,
body.map-settings-page-body #map-devices .cards-grid,
body.map-settings-page-body #map-links .cards-grid,
body.map-settings-page-body #map-links .add-link-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important;
    grid-auto-rows: 6px !important;
    grid-auto-flow: dense !important;
    gap: 7px !important;
    align-items: start !important;
    justify-content: stretch !important;
    column-width: auto !important;
    column-count: auto !important;
}

body.map-settings-page-body .map-display-tile,
body.map-settings-page-body .map-display-tile-wide,
body.map-settings-page-body .map-display-tile-main,
body.map-settings-page-body #map-devices .device-card,
body.map-settings-page-body #map-links .link-card,
body.map-settings-page-body #map-links .add-link-grid .field {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    break-inside: auto !important;
    page-break-inside: auto !important;

    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 3px 10px color-mix(in srgb, var(--ast-shadow) 45%, transparent) !important;
}

/* Блок высоты панелей после удаления цветов */
body.map-settings-page-body #map-panel-style {
    background: var(--ast-card-bg) !important;
}

body.map-settings-page-body #map-panel-style input[type="color"] {
    display: none !important;
}

/* Связи: компактный закрытый details */
body.map-settings-page-body #map-links details.link-details {
    margin-top: 6px !important;
    border-top: 1px solid var(--ast-border) !important;
    padding-top: 6px !important;
}

body.map-settings-page-body #map-links details.link-details summary {
    list-style: none !important;
    cursor: pointer !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
}

body.map-settings-page-body #map-links details.link-details summary::before {
    content: "▸ ";
}

body.map-settings-page-body #map-links details.link-details[open] summary::before {
    content: "▾ ";
}

/* Возвращаем кнопки к тематическому виду */
body.map-settings-page-body .portal-work-panel-actions .btn,
body.map-settings-page-body .portal-work-panel-actions a.btn,
body.map-settings-page-body .portal-work-panel-actions button.btn {
    background: var(--ast-card-bg) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 3px 10px color-mix(in srgb, var(--ast-shadow) 45%, transparent) !important;
}

body.map-settings-page-body .portal-work-panel-actions .btn:hover,
body.map-settings-page-body .portal-work-panel-actions a.btn:hover,
body.map-settings-page-body .portal-work-panel-actions button.btn:hover {
    background: var(--ast-button-hover, var(--ast-panel-bg)) !important;
    border-color: var(--ast-blue-main, var(--ast-border)) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
}

body.map-settings-page-body .map-settings-page button,
body.map-settings-page-body .map-settings-page .button-link,
body.map-settings-page-body .map-settings-page a.button-link {
    background: var(--ast-card-bg) !important;
    color: var(--ast-button-text, var(--ast-title)) !important;
    border: 1px solid var(--ast-border) !important;
}

body.map-settings-page-body .map-settings-page button[type="submit"] {
    background: var(--ast-blue-main) !important;
    color: #ffffff !important;
    border-color: var(--ast-blue-main) !important;
}

body.map-settings-page-body .map-settings-page button[type="submit"]:hover {
    background: var(--ast-blue-dark, var(--ast-blue-main)) !important;
    color: #ffffff !important;
}

/* Убираем старые цветовые поля, если где-то остались в DOM */
body.map-settings-page-body :is(
    #portal_nav_color_from,
    #portal_nav_color_to,
    #map_toolbar_color_from,
    #map_toolbar_color_to
),
body.map-settings-page-body label:has(#portal_nav_color_from),
body.map-settings-page-body label:has(#portal_nav_color_to),
body.map-settings-page-body label:has(#map_toolbar_color_from),
body.map-settings-page-body label:has(#map_toolbar_color_to),
body.map-settings-page-body .field:has(#portal_nav_color_from),
body.map-settings-page-body .field:has(#portal_nav_color_to),
body.map-settings-page-body .field:has(#map_toolbar_color_from),
body.map-settings-page-body .field:has(#map_toolbar_color_to) {
    display: none !important;
}

/* Поля, подписи, подсказки строго от темы */
body.map-settings-page-body :is(.map-display-tile, .device-card, .link-card, .field) :is(h3, .card-title, label, strong) {
    color: var(--ast-title) !important;
}

body.map-settings-page-body :is(.map-display-tile, .device-card, .link-card, .field) :is(p, .hint, .muted, .card-subtitle) {
    color: var(--ast-muted) !important;
}

body.map-settings-page-body :is(input[type="text"], input[type="number"], select, textarea) {
    background: var(--ast-input-bg) !important;
    color: var(--ast-input-text, var(--ast-text)) !important;
    -webkit-text-fill-color: var(--ast-input-text, var(--ast-text)) !important;
    border-color: var(--ast-border) !important;
}

/* На узком экране одна колонка */
@media (max-width: 760px) {
    body.map-settings-page-body .map-display-tile-grid-v2,
    body.map-settings-page-body #map-devices .cards-grid,
    body.map-settings-page-body #map-links .cards-grid,
    body.map-settings-page-body #map-links .add-link-grid {
        grid-template-columns: 1fr !important;
    }
}

/* === AST MAP SETTINGS LINKS WIDTH-FIRST FINAL END 2026-04-26 === */











/* === AST MAP SETTINGS CLEAN AUTO LAYOUT RESTORE START 2026-04-26 === */

/*
   Чистое состояние после отката сломанной ручной компоновки.
   Ручная компоновка отключена.
   Плитки снова строятся автоматически: сначала по ширине, затем уплотнение по высоте.
*/

body.map-settings-page-body .map-display-tile-grid-v2 {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important;
    grid-auto-rows: 6px !important;
    grid-auto-flow: dense !important;
    gap: 7px !important;
    align-items: start !important;
    justify-content: stretch !important;
    column-width: auto !important;
    column-count: auto !important;
    min-height: 0 !important;
    outline: none !important;
}

body.map-settings-page-body .map-display-tile-grid-v2 .map-display-tile {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    transform: none !important;
    transform-origin: initial !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

body.map-settings-page-body .map-tile-resize-handle,
body.map-settings-page-body .map-tile-resize-height-handle,
body.map-settings-page-body .map-tile-drag-hint,
body.map-settings-page-body .map-tile-content-scale {
    display: none !important;
}

body.map-settings-page-body #map-devices .cards-grid,
body.map-settings-page-body #map-links .cards-grid,
body.map-settings-page-body #map-links .add-link-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important;
    grid-auto-rows: 6px !important;
    grid-auto-flow: dense !important;
    gap: 7px !important;
    align-items: start !important;
    justify-content: stretch !important;
    column-width: auto !important;
    column-count: auto !important;
}

body.map-settings-page-body #map-devices .device-card,
body.map-settings-page-body #map-links .link-card,
body.map-settings-page-body #map-links .add-link-grid .field {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    transform: none !important;
}

/* === AST MAP SETTINGS CLEAN AUTO LAYOUT RESTORE END 2026-04-26 === */




/* === AST CONTRAST THEME LIGHT ACCESSIBLE START 2026-04-26 === */

/*
   Контрастная тема — это не тёмная тема.
   Это светлая высококонтрастная тема:
   - почти белый фон;
   - почти чёрный текст;
   - явно видимые рамки;
   - акцентные кнопки;
   - без бледного текста на светлом фоне.
*/

html:has(body.theme-ast_contrast) {
    background: #f4f7ff !important;
}

body.theme-ast_contrast,
body.theme-ast_contrast.portal-page,
body.theme-ast_contrast.portal-page-app,
body.theme-ast_contrast.portal-settings-page-body,
body.theme-ast_contrast.ast-device-page-body,
body.theme-ast_contrast.ast-notifications-page-body,
body.theme-ast_contrast .portal-page,
body.theme-ast_contrast .portal-page-app,
body.theme-ast_contrast .portal-settings-wide,
body.theme-ast_contrast .portal-workarea,
body.theme-ast_contrast .portal-content,
body.theme-ast_contrast main {
    --ast-bg: #f4f7ff;
    --ast-bg-start: #ffffff;
    --ast-bg-end: #e9efff;
    --ast-map-bg: #f7f9ff;

    --ast-toolbar-from: #1d0038;
    --ast-toolbar-mid: #310065;
    --ast-toolbar-to: #4a0096;

    --ast-card-bg: #ffffff;
    --ast-panel-bg: #eef2ff;
    --ast-input-bg: #ffffff;

    --ast-border: #2b1b8f;
    --ast-text: #05050a;
    --ast-title: #000000;
    --ast-muted: #1f2937;

    --ast-blue: #3b00b8;
    --ast-blue-main: #5200cc;
    --ast-blue-dark: #2a0068;
    --ast-accent: #5200cc;

    --ast-button-bg: #25005f;
    --ast-button-text: #ffffff;
    --ast-button-hover: #3b008f;
    --ast-button-text-on-accent: #ffffff;

    --ast-shadow: rgba(0, 0, 0, .24);
    --ast-grid: rgba(43, 27, 143, .16);

    --ast-ok-bg: #e6fff3;
    --ast-ok-text: #00381f;
    --ast-ok-border: #007a49;

    --ast-warn-bg: #fff5d6;
    --ast-warn-text: #3f2500;
    --ast-warn-border: #9a6400;

    background-color: var(--ast-bg);
    color: var(--ast-text);
}

body.theme-ast_contrast {
    background:
        linear-gradient(135deg, var(--ast-bg-start), var(--ast-bg-end)) !important;
    color: var(--ast-text) !important;
}

/* Базовая читаемость */
body.theme-ast_contrast h1,
body.theme-ast_contrast h2,
body.theme-ast_contrast h3,
body.theme-ast_contrast h4,
body.theme-ast_contrast .title,
body.theme-ast_contrast .card-title,
body.theme-ast_contrast .portal-section-title {
    color: var(--ast-title) !important;
    text-shadow: none !important;
}

body.theme-ast_contrast p,
body.theme-ast_contrast small,
body.theme-ast_contrast label,
body.theme-ast_contrast .muted,
body.theme-ast_contrast .hint,
body.theme-ast_contrast .portal-section-subtitle {
    color: var(--ast-muted) !important;
    text-shadow: none !important;
}

/* Поля */
body.theme-ast_contrast input[type="text"],
body.theme-ast_contrast input[type="number"],
body.theme-ast_contrast input[type="password"],
body.theme-ast_contrast input[type="email"],
body.theme-ast_contrast input[type="url"],
body.theme-ast_contrast input:not([type]),
body.theme-ast_contrast select,
body.theme-ast_contrast textarea {
    background: var(--ast-input-bg) !important;
    background-color: var(--ast-input-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: none !important;
}

body.theme-ast_contrast input:focus,
body.theme-ast_contrast select:focus,
body.theme-ast_contrast textarea:focus {
    border-color: var(--ast-blue-main) !important;
    box-shadow: 0 0 0 2px rgba(82, 0, 204, .22) !important;
    outline: none !important;
}

body.theme-ast_contrast input::placeholder,
body.theme-ast_contrast textarea::placeholder {
    color: #374151 !important;
}

/* Кнопки */
body.theme-ast_contrast a.btn,
body.theme-ast_contrast button.btn,
body.theme-ast_contrast input[type="submit"].btn,
body.theme-ast_contrast input[type="button"].btn,
body.theme-ast_contrast .button-link,
body.theme-ast_contrast .portal-section-actions a,
body.theme-ast_contrast .portal-section-actions button {
    background: var(--ast-button-bg) !important;
    background-color: var(--ast-button-bg) !important;
    background-image: none !important;
    color: var(--ast-button-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: 0 6px 14px rgba(37, 0, 95, .18) !important;
    text-shadow: none !important;
}

body.theme-ast_contrast a.btn:hover,
body.theme-ast_contrast button.btn:hover,
body.theme-ast_contrast input[type="submit"].btn:hover,
body.theme-ast_contrast input[type="button"].btn:hover,
body.theme-ast_contrast .button-link:hover,
body.theme-ast_contrast .portal-section-actions a:hover,
body.theme-ast_contrast .portal-section-actions button:hover {
    background: var(--ast-button-hover) !important;
    background-color: var(--ast-button-hover) !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

/* Навигация и футер остаются тёмными как контрастная шапка */
body.theme-ast_contrast .portal-nav,
body.theme-ast_contrast .ast-portal-footer {
    background: linear-gradient(90deg, var(--ast-toolbar-from), var(--ast-toolbar-mid), var(--ast-toolbar-to)) !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

body.theme-ast_contrast .portal-nav a,
body.theme-ast_contrast .portal-nav span,
body.theme-ast_contrast .portal-nav label,
body.theme-ast_contrast .ast-portal-footer,
body.theme-ast_contrast .ast-portal-footer a,
body.theme-ast_contrast .ast-portal-footer span,
body.theme-ast_contrast .ast-portal-footer div {
    color: #ffffff !important;
}

/*
   Уведомления раньше имели отдельный тёмный фикс.
   Перекрываем его этой же светлой контрастной логикой,
   чтобы тема была единой во всём портале.
*/
body.theme-ast_contrast.ast-notifications-page-body,
body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-page {
    background:
        linear-gradient(135deg, var(--ast-bg-start), var(--ast-bg-end)) !important;
    color: var(--ast-text) !important;
}

body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-card,
body.theme-ast_contrast.ast-notifications-page-body .ast-notification-item,
body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-empty {
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border-color: var(--ast-border) !important;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .16) !important;
}

body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-head h1,
body.theme-ast_contrast.ast-notifications-page-body .ast-notification-title-row h2 {
    color: var(--ast-title) !important;
}

body.theme-ast_contrast.ast-notifications-page-body .ast-notifications-muted,
body.theme-ast_contrast.ast-notifications-page-body .ast-notification-message,
body.theme-ast_contrast.ast-notifications-page-body .ast-notification-meta {
    color: var(--ast-muted) !important;
}

body.theme-ast_contrast input[type="checkbox"] {
    accent-color: var(--ast-blue-main) !important;
}

/* === AST CONTRAST THEME LIGHT ACCESSIBLE END 2026-04-26 === */

/* === AST CONTRAST STANDARD PORTAL PAGES START 2026-04-26 === */

/*
   Единый контрастный стиль для обычных разделов портала.
   Уведомления не трогаем: у них есть отдельный рабочий стиль.
   Этот блок работает только на страницах, которым добавлен класс:
   ast-contrast-standard-page.
*/

body.theme-ast_contrast.ast-contrast-standard-page {
    background:
        linear-gradient(135deg, var(--ast-bg-start, #ffffff), var(--ast-bg-end, #e9efff)) !important;
    color: var(--ast-text, #05050a) !important;
}

/* Основные контейнеры разделов */
body.theme-ast_contrast.ast-contrast-standard-page .portal-page,
body.theme-ast_contrast.ast-contrast-standard-page .portal-page-app,
body.theme-ast_contrast.ast-contrast-standard-page .portal-page-card,
body.theme-ast_contrast.ast-contrast-standard-page .portal-settings-wide,
body.theme-ast_contrast.ast-contrast-standard-page .portal-settings-block,
body.theme-ast_contrast.ast-contrast-standard-page .portal-work-panel,
body.theme-ast_contrast.ast-contrast-standard-page .portal-work-panel-global,
body.theme-ast_contrast.ast-contrast-standard-page .footer-settings-card,
body.theme-ast_contrast.ast-contrast-standard-page .ui-labels-card,
body.theme-ast_contrast.ast-contrast-standard-page .logs-card,
body.theme-ast_contrast.ast-contrast-standard-page .log-card,
body.theme-ast_contrast.ast-contrast-standard-page .mail-card,
body.theme-ast_contrast.ast-contrast-standard-page .ticket-card,
body.theme-ast_contrast.ast-contrast-standard-page .report-card,
body.theme-ast_contrast.ast-contrast-standard-page .incident-card,
body.theme-ast_contrast.ast-contrast-standard-page .maintenance-card,
body.theme-ast_contrast.ast-contrast-standard-page .playbook-card,
body.theme-ast_contrast.ast-contrast-standard-page .device-card,
body.theme-ast_contrast.ast-contrast-standard-page .add-device-card,
body.theme-ast_contrast.ast-contrast-standard-page .info-panel,
body.theme-ast_contrast.ast-contrast-standard-page .core-load-panel,
body.theme-ast_contrast.ast-contrast-standard-page .problems-panel,
body.theme-ast_contrast.ast-contrast-standard-page .portal-user-card,
body.theme-ast_contrast.ast-contrast-standard-page .assignment-card,
body.theme-ast_contrast.ast-contrast-standard-page .role-permission-card,
body.theme-ast_contrast.ast-contrast-standard-page .portal-branding-preview > div {
    background: var(--ast-card-bg, #ffffff) !important;
    color: var(--ast-text, #05050a) !important;
    border-color: var(--ast-border, #2b1b8f) !important;
    box-shadow: 0 12px 26px var(--ast-shadow, rgba(0,0,0,.16)) !important;
}

/* Если внутри есть вложенные панели/подсказки */
body.theme-ast_contrast.ast-contrast-standard-page .portal-page-note,
body.theme-ast_contrast.ast-contrast-standard-page .compact-note,
body.theme-ast_contrast.ast-contrast-standard-page .notice-ok,
body.theme-ast_contrast.ast-contrast-standard-page .notice-warn,
body.theme-ast_contrast.ast-contrast-standard-page .role-description,
body.theme-ast_contrast.ast-contrast-standard-page .permission-pills,
body.theme-ast_contrast.ast-contrast-standard-page .permission-pill,
body.theme-ast_contrast.ast-contrast-standard-page .permission-pills span {
    background: var(--ast-panel-bg, #eef2ff) !important;
    color: var(--ast-text, #05050a) !important;
    border-color: var(--ast-border, #2b1b8f) !important;
}

/* Заголовки */
body.theme-ast_contrast.ast-contrast-standard-page h1,
body.theme-ast_contrast.ast-contrast-standard-page h2,
body.theme-ast_contrast.ast-contrast-standard-page h3,
body.theme-ast_contrast.ast-contrast-standard-page h4,
body.theme-ast_contrast.ast-contrast-standard-page .title,
body.theme-ast_contrast.ast-contrast-standard-page .subtitle,
body.theme-ast_contrast.ast-contrast-standard-page .card-title,
body.theme-ast_contrast.ast-contrast-standard-page .portal-page-kicker,
body.theme-ast_contrast.ast-contrast-standard-page .portal-section-title,
body.theme-ast_contrast.ast-contrast-standard-page .portal-work-panel-title,
body.theme-ast_contrast.ast-contrast-standard-page .device-name,
body.theme-ast_contrast.ast-contrast-standard-page .portal-user-login,
body.theme-ast_contrast.ast-contrast-standard-page .assignment-card-title,
body.theme-ast_contrast.ast-contrast-standard-page .role-permission-card-title {
    color: var(--ast-title, #000000) !important;
    text-shadow: none !important;
}

/* Обычный и вторичный текст */
body.theme-ast_contrast.ast-contrast-standard-page p,
body.theme-ast_contrast.ast-contrast-standard-page small,
body.theme-ast_contrast.ast-contrast-standard-page label,
body.theme-ast_contrast.ast-contrast-standard-page label > span,
body.theme-ast_contrast.ast-contrast-standard-page .muted,
body.theme-ast_contrast.ast-contrast-standard-page .hint,
body.theme-ast_contrast.ast-contrast-standard-page .card-subtitle,
body.theme-ast_contrast.ast-contrast-standard-page .portal-page-note,
body.theme-ast_contrast.ast-contrast-standard-page .compact-note,
body.theme-ast_contrast.ast-contrast-standard-page .portal-section-subtitle,
body.theme-ast_contrast.ast-contrast-standard-page .portal-work-panel-subtitle,
body.theme-ast_contrast.ast-contrast-standard-page .portal-user-subtitle,
body.theme-ast_contrast.ast-contrast-standard-page .assignment-card-subtitle,
body.theme-ast_contrast.ast-contrast-standard-page .role-permission-card-description {
    color: var(--ast-muted, #1f2937) !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

/* Формы */
body.theme-ast_contrast.ast-contrast-standard-page input[type="text"],
body.theme-ast_contrast.ast-contrast-standard-page input[type="number"],
body.theme-ast_contrast.ast-contrast-standard-page input[type="password"],
body.theme-ast_contrast.ast-contrast-standard-page input[type="email"],
body.theme-ast_contrast.ast-contrast-standard-page input[type="url"],
body.theme-ast_contrast.ast-contrast-standard-page input:not([type]),
body.theme-ast_contrast.ast-contrast-standard-page select,
body.theme-ast_contrast.ast-contrast-standard-page textarea {
    background: var(--ast-input-bg, #ffffff) !important;
    background-color: var(--ast-input-bg, #ffffff) !important;
    color: var(--ast-text, #05050a) !important;
    border-color: var(--ast-border, #2b1b8f) !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

body.theme-ast_contrast.ast-contrast-standard-page input:focus,
body.theme-ast_contrast.ast-contrast-standard-page select:focus,
body.theme-ast_contrast.ast-contrast-standard-page textarea:focus {
    border-color: var(--ast-blue-main, #5200cc) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ast-blue-main, #5200cc) 22%, transparent) !important;
    outline: none !important;
}

body.theme-ast_contrast.ast-contrast-standard-page input::placeholder,
body.theme-ast_contrast.ast-contrast-standard-page textarea::placeholder {
    color: var(--ast-muted, #1f2937) !important;
    opacity: .78 !important;
}

/* Кнопки */
body.theme-ast_contrast.ast-contrast-standard-page button,
body.theme-ast_contrast.ast-contrast-standard-page .btn,
body.theme-ast_contrast.ast-contrast-standard-page a.btn,
body.theme-ast_contrast.ast-contrast-standard-page input[type="submit"],
body.theme-ast_contrast.ast-contrast-standard-page input[type="button"],
body.theme-ast_contrast.ast-contrast-standard-page .button-link,
body.theme-ast_contrast.ast-contrast-standard-page .portal-section-actions a,
body.theme-ast_contrast.ast-contrast-standard-page .portal-section-actions button,
body.theme-ast_contrast.ast-contrast-standard-page .actions button,
body.theme-ast_contrast.ast-contrast-standard-page .actions a,
body.theme-ast_contrast.ast-contrast-standard-page .form-actions button,
body.theme-ast_contrast.ast-contrast-standard-page .form-actions a {
    background: var(--ast-button-bg, #25005f) !important;
    background-color: var(--ast-button-bg, #25005f) !important;
    background-image: none !important;
    color: var(--ast-button-text, #ffffff) !important;
    border-color: var(--ast-border, #2b1b8f) !important;
    box-shadow: 0 6px 14px color-mix(in srgb, var(--ast-button-bg, #25005f) 22%, transparent) !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

body.theme-ast_contrast.ast-contrast-standard-page button:hover,
body.theme-ast_contrast.ast-contrast-standard-page .btn:hover,
body.theme-ast_contrast.ast-contrast-standard-page a.btn:hover,
body.theme-ast_contrast.ast-contrast-standard-page input[type="submit"]:hover,
body.theme-ast_contrast.ast-contrast-standard-page input[type="button"]:hover,
body.theme-ast_contrast.ast-contrast-standard-page .button-link:hover,
body.theme-ast_contrast.ast-contrast-standard-page .portal-section-actions a:hover,
body.theme-ast_contrast.ast-contrast-standard-page .portal-section-actions button:hover {
    background: var(--ast-button-hover, #3b008f) !important;
    background-color: var(--ast-button-hover, #3b008f) !important;
    color: var(--ast-button-text-on-accent, #ffffff) !important;
    border-color: var(--ast-title, #000000) !important;
}

/* Таблицы логов/событий/авторизаций */
body.theme-ast_contrast.ast-contrast-standard-page table,
body.theme-ast_contrast.ast-contrast-standard-page thead,
body.theme-ast_contrast.ast-contrast-standard-page tbody,
body.theme-ast_contrast.ast-contrast-standard-page tr,
body.theme-ast_contrast.ast-contrast-standard-page td,
body.theme-ast_contrast.ast-contrast-standard-page th {
    color: var(--ast-text, #05050a) !important;
    border-color: var(--ast-border, #2b1b8f) !important;
}

body.theme-ast_contrast.ast-contrast-standard-page th {
    background: var(--ast-panel-bg, #eef2ff) !important;
    color: var(--ast-title, #000000) !important;
}

body.theme-ast_contrast.ast-contrast-standard-page td {
    background: var(--ast-card-bg, #ffffff) !important;
}

/* Чекбоксы */
body.theme-ast_contrast.ast-contrast-standard-page input[type="checkbox"] {
    accent-color: var(--ast-blue-main, #5200cc) !important;
}

/* Чтобы футер и навигация оставались читаемыми */
body.theme-ast_contrast.ast-contrast-standard-page .portal-nav,
body.theme-ast_contrast.ast-contrast-standard-page .ast-portal-footer {
    background: linear-gradient(90deg, var(--ast-toolbar-from, #1d0038), var(--ast-toolbar-mid, #310065), var(--ast-toolbar-to, #4a0096)) !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

body.theme-ast_contrast.ast-contrast-standard-page .portal-nav a,
body.theme-ast_contrast.ast-contrast-standard-page .portal-nav span,
body.theme-ast_contrast.ast-contrast-standard-page .portal-nav label,
body.theme-ast_contrast.ast-contrast-standard-page .ast-portal-footer,
body.theme-ast_contrast.ast-contrast-standard-page .ast-portal-footer a,
body.theme-ast_contrast.ast-contrast-standard-page .ast-portal-footer span,
body.theme-ast_contrast.ast-contrast-standard-page .ast-portal-footer div {
    color: #ffffff !important;
}

/* === AST CONTRAST STANDARD PORTAL PAGES END 2026-04-26 === */

/* === AST CONTRAST TARGETED SETTINGS DEVICE FOOTER START 2026-04-26 === */

/*
   Точечная доводка контрастной темы.
   Страницы:
   - /settings/ui-labels.php
   - /settings/portal-panel.php
   - /settings/footer.php
   - /device.php

   Не трогаем /notifications/ — он уже был рабочим эталоном.
*/

/* Верхняя панель: селектор темы и кнопка выхода не должны становиться белым-на-белом */
body.theme-ast_contrast .portal-nav select,
body.theme-ast_contrast .portal-nav .theme-select,
body.theme-ast_contrast .portal-nav input,
body.theme-ast_contrast .portal-nav button,
body.theme-ast_contrast .portal-nav .btn,
body.theme-ast_contrast .portal-nav a.btn {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
    border: 2px solid #25005f !important;
    box-shadow: none !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

body.theme-ast_contrast .portal-nav select option {
    background: #ffffff !important;
    color: #000000 !important;
}

/* Общая база именно для этих страниц */
body.theme-ast_contrast.ast-contrast-standard-page :is(
    .ui-labels-card,
    .footer-settings-card,
    .portal-panel-card,
    .portal-page-card,
    .portal-settings-wide,
    .device-card,
    .box,
    .section,
    .card,
    fieldset
) {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #2b1b8f !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .20) !important;
}

/* Заголовки и пояснения */
body.theme-ast_contrast.ast-contrast-standard-page :is(
    h1, h2, h3, h4,
    .portal-page-kicker,
    .portal-page-title,
    .portal-section-title,
    .card-title,
    .device-name,
    legend
) {
    color: #000000 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

body.theme-ast_contrast.ast-contrast-standard-page :is(
    p, small, label, label > span,
    .hint, .muted, .portal-page-note,
    .portal-section-subtitle,
    .card-subtitle,
    .help-text,
    .description
) {
    color: #1f2937 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

/* Поля: обычные, readonly и disabled должны быть читаемыми */
body.theme-ast_contrast.ast-contrast-standard-page :is(
    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="email"],
    input[type="url"],
    input:not([type]),
    select,
    textarea
) {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
    border: 2px solid #5200cc !important;
    box-shadow: none !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

body.theme-ast_contrast.ast-contrast-standard-page :is(
    input[readonly],
    input[disabled],
    select[disabled],
    textarea[readonly],
    textarea[disabled]
) {
    background: #eef2ff !important;
    background-color: #eef2ff !important;
    color: #000000 !important;
    border-color: #2b1b8f !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #000000 !important;
}

body.theme-ast_contrast.ast-contrast-standard-page input::placeholder,
body.theme-ast_contrast.ast-contrast-standard-page textarea::placeholder {
    color: #374151 !important;
    opacity: 1 !important;
}

/* Таблицы на странице подписей интерфейса */
body.theme-ast_contrast.ast-contrast-standard-page table {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #2b1b8f !important;
    border-collapse: collapse !important;
}

body.theme-ast_contrast.ast-contrast-standard-page :is(th, td) {
    color: #000000 !important;
    border: 1px solid #2b1b8f !important;
}

body.theme-ast_contrast.ast-contrast-standard-page th {
    background: #e4e8ff !important;
    color: #000000 !important;
    font-weight: 900 !important;
}

body.theme-ast_contrast.ast-contrast-standard-page td {
    background: #ffffff !important;
}

body.theme-ast_contrast.ast-contrast-standard-page tr:nth-child(even) td {
    background: #f3f5ff !important;
}

/* Кнопки внутри этих страниц */
body.theme-ast_contrast.ast-contrast-standard-page :is(
    button,
    .btn,
    a.btn,
    input[type="submit"],
    input[type="button"],
    .button-link
) {
    background: #25005f !important;
    background-color: #25005f !important;
    background-image: none !important;
    color: #ffffff !important;
    border: 2px solid #25005f !important;
    box-shadow: 0 8px 18px rgba(37, 0, 95, .22) !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

body.theme-ast_contrast.ast-contrast-standard-page :is(
    button:hover,
    .btn:hover,
    a.btn:hover,
    input[type="submit"]:hover,
    input[type="button"]:hover,
    .button-link:hover
) {
    background: #3b008f !important;
    background-color: #3b008f !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

/* Карточка устройства: внутренние блоки SNMP/Cacti/бейджей */
body.theme-ast_contrast.ast-device-page-body.ast-contrast-standard-page :is(
    .device-section,
    .device-panel,
    .device-info,
    .snmp-card,
    .cacti-card,
    .vendor-badge-card,
    .portal-section-panel,
    .portal-work-panel
) {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #2b1b8f !important;
}

body.theme-ast_contrast.ast-device-page-body.ast-contrast-standard-page :is(
    .device-section *,
    .device-panel *,
    .device-info *,
    .snmp-card *,
    .cacti-card *,
    .vendor-badge-card *
) {
    color: inherit;
}

/* Бейджи/плашки */
body.theme-ast_contrast.ast-contrast-standard-page :is(
    .badge,
    .pill,
    .permission-pill,
    .permission-pills span,
    .status-badge,
    .tag
) {
    background: #eef2ff !important;
    color: #000000 !important;
    border: 1px solid #2b1b8f !important;
}

/* Чекбоксы */
body.theme-ast_contrast.ast-contrast-standard-page input[type="checkbox"] {
    accent-color: #5200cc !important;
}

/* === AST CONTRAST TARGETED SETTINGS DEVICE FOOTER END 2026-04-26 === */

/* === AST DEVICE PAGE INLINE STYLE CLEANUP START 2026-04-26 === */
.ast-device-save-notice {
    padding: 10px 12px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ast-card-bg) 84%, var(--ast-blue-main) 16%);
    border: 1px solid color-mix(in srgb, var(--ast-border) 70%, var(--ast-blue-main) 30%);
    color: var(--ast-text);
}

.ast-device-type-select {
    padding: 6px 8px;
    border: 1px solid var(--ast-border);
    border-radius: 7px;
    background: var(--ast-input-bg, var(--ast-card-bg));
    color: var(--ast-input-text, var(--ast-text));
}

.ast-device-type-select:focus {
    outline: 2px solid color-mix(in srgb, var(--ast-blue-main) 40%, transparent);
    outline-offset: 1px;
}

.ast-device-type-submit {
    padding: 6px 10px;
    cursor: pointer;
}
/* === AST DEVICE PAGE INLINE STYLE CLEANUP END 2026-04-26 === */


/* === AST PORTAL LOGOUT THEME SAFE OVERRIDE START 2026-04-26 === */
/*
   Кнопка "Выйти" в верхней панели портала не должна наследовать случайные
   фиолетовые стили обычных кнопок или active-bg старых блоков.
   Правило намеренно точечное: только .portal-nav .portal-logout.
*/
.portal-nav .portal-logout {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: calc(var(--portal-nav-height, 30px) - 7px) !important;
    padding: 3px 10px !important;
    border-radius: 999px !important;
    box-sizing: border-box !important;

    background: color-mix(in srgb, var(--portal-nav-text, var(--ast-text)) 9%, transparent) !important;
    color: var(--portal-nav-text, var(--ast-text)) !important;
    border: 1px solid color-mix(in srgb, var(--portal-nav-border, var(--ast-border)) 75%, transparent) !important;

    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.portal-nav .portal-logout:hover {
    background: color-mix(in srgb, var(--portal-nav-text, var(--ast-text)) 15%, transparent) !important;
    color: var(--portal-nav-text, var(--ast-text)) !important;
    border-color: color-mix(in srgb, var(--portal-nav-border, var(--ast-border)) 95%, transparent) !important;
    box-shadow: none !important;
    transform: none !important;
}
/* === AST PORTAL LOGOUT THEME SAFE OVERRIDE END 2026-04-26 === */

/* === AST DEVICE ICON ADMIN THEME CLEANUP START 2026-04-26 === */
.ast-device-icon-admin {
    margin: 20px 0;
    padding: 16px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-panel-bg);
    color: var(--ast-text);
}

.ast-device-icon-preview-img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    background: var(--ast-card-bg);
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    padding: 8px;
}

.ast-device-icon-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    background: var(--ast-input-bg, var(--ast-card-bg));
    color: var(--ast-input-text, var(--ast-text));
}

.ast-device-icon-save-btn {
    padding: 8px 14px;
    cursor: pointer;
}

.ast-device-icon-msg {
    font-size: 13px;
    color: var(--ast-muted);
}

.ast-device-icon-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--ast-muted);
}
/* === AST DEVICE ICON ADMIN THEME CLEANUP END 2026-04-26 === */

/* === AST DEVICE ICON ADMIN LAYOUT CLEANUP START 2026-04-26 === */
.ast-device-icon-title {
    margin: 0 0 12px 0;
}

.ast-device-icon-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.ast-device-icon-controls {
    min-width: 320px;
    flex: 1;
}

.ast-device-icon-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}
/* === AST DEVICE ICON ADMIN LAYOUT CLEANUP END 2026-04-26 === */


/* Old device.php inline style migration block removed from active CSS on 2026-04-27. Saved to: /var/www/ast-device-card-redesign-nodup-step1-20260427_002752/removed-old-device-inline-migration.css */


/* === AST SETTINGS FOOTER LOCAL STYLE MIGRATION START 20260426_185411 ===
   Перенесено из /public/settings/footer.php.
   На этом шаге правила не нормализуются, только убираются из PHP.
*/
.footer-settings-page {
            max-width: 980px;
            margin: 0 auto;
            padding: 26px;
        }

        .footer-settings-card {
            background: var(--ast-card-bg, #fff);
            border: 1px solid rgba(140, 100, 255, .25);
            border-radius: 22px;
            padding: 22px;
            box-shadow: 0 14px 40px rgba(80, 60, 180, .08);
        }

        .footer-settings-card h1 {
            margin: 0 0 8px;
            color: var(--ast-title, #27005d);
        }

        .footer-settings-muted {
            color: var(--ast-muted, #6b7390);
            font-size: 13px;
            margin-bottom: 18px;
        }

        .footer-settings-grid {
            display: grid;
            grid-template-columns: 1fr 180px;
            gap: 14px;
        }

        .footer-settings-card label {
            display: grid;
            gap: 6px;
            font-weight: 700;
            color: var(--ast-title, #273264);
            margin-bottom: 14px;
        }

        .footer-settings-card input[type="text"] {
            width: 100%;
            box-sizing: border-box;
            border: 1px solid rgba(140, 100, 255, .28);
            border-radius: 10px;
            padding: 9px 11px;
            background: var(--ast-input-bg, #fff);
            color: var(--ast-text, #1f2a44);
        }

        .footer-settings-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 18px;
        }

        .footer-settings-btn {
            border: 0;
            border-radius: 999px;
            padding: 10px 16px;
            background: var(--ast-accent, #6b00ff);
            color: #fff;
            font-weight: 800;
            text-decoration: none;
            cursor: pointer;
        }

        .footer-settings-btn.secondary {
            background: rgba(107, 0, 255, .10);
            color: var(--ast-accent, #5a00c8);
            border: 1px solid rgba(107, 0, 255, .25);
        }

        .footer-settings-notice,
        .footer-settings-error {
            margin: 12px 0;
            padding: 10px 12px;
            border-radius: 12px;
            font-weight: 700;
        }

        .footer-settings-notice {
            background: #eaffef;
            color: #087224;
            border: 1px solid #b9efc4;
        }

        .footer-settings-error {
            background: #fff1f1;
            color: #b00020;
            border: 1px solid #ffd0d0;
        }

        .footer-preview {
            margin-top: 16px;
            border-radius: 12px;
            border: 1px solid rgba(140, 100, 255, .25);
            overflow: hidden;
        }

        .footer-preview .portal-footer {
            position: static;
        }
/* === AST SETTINGS FOOTER LOCAL STYLE MIGRATION END 20260426_185411 === */

/* === AST SETTINGS PORTAL PANEL LOCAL STYLE MIGRATION START 20260426_185713 ===
   Перенесено из /public/settings/portal-panel.php.
   На этом шаге правила CSS не нормализуются, только убираются из PHP.
*/
.portal-panel-settings-page {
            max-width: 1120px;
            margin: 0 auto;
            padding: 26px;
        }

        .portal-panel-card {
            background: var(--ast-card-bg, #fff);
            border: 1px solid rgba(140, 100, 255, .25);
            border-radius: 22px;
            padding: 22px;
            box-shadow: 0 14px 40px rgba(80, 60, 180, .08);
            margin-bottom: 18px;
        }

        .portal-panel-card h1,
        .portal-panel-card h2 {
            margin: 0 0 10px;
            color: var(--ast-title, #27005d);
        }

        .panel-muted {
            color: var(--ast-muted, #6b7390);
            font-size: 13px;
            margin-bottom: 16px;
        }

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

        .panel-grid label,
        .panel-checks label {
            display: grid;
            gap: 6px;
            font-weight: 700;
            color: var(--ast-title, #273264);
            margin-bottom: 12px;
        }

        .panel-checks {
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
            margin: 8px 0;
        }

        .panel-checks label {
            display: flex;
            align-items: center;
            gap: 7px;
        }

        .portal-panel-card input[type="text"],
        .portal-panel-card input[type="number"] {
            width: 100%;
            box-sizing: border-box;
            border: 1px solid rgba(140, 100, 255, .28);
            border-radius: 10px;
            padding: 8px 10px;
            background: var(--ast-input-bg, #fff);
            color: var(--ast-text, #1f2a44);
        }

        .panel-table {
            width: 100%;
            border-collapse: collapse;
        }

        .panel-table th,
        .panel-table td {
            border-top: 1px solid rgba(140, 100, 255, .16);
            padding: 8px;
            font-size: 13px;
            vertical-align: middle;
        }

        .panel-table th {
            text-align: left;
            color: var(--ast-muted, #6b7390);
            font-size: 11px;
            text-transform: uppercase;
            background: rgba(245, 242, 255, .65);
        }

        .panel-table code {
            font-size: 12px;
        }

        .panel-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 16px;
        }

        .panel-btn {
            border: 0;
            border-radius: 999px;
            padding: 10px 16px;
            background: var(--ast-accent, #6b00ff);
            color: #fff;
            font-weight: 800;
            text-decoration: none;
            cursor: pointer;
        }

        .panel-btn.secondary {
            background: rgba(107, 0, 255, .10);
            color: var(--ast-accent, #5a00c8);
            border: 1px solid rgba(107, 0, 255, .25);
        }

        .panel-notice,
        .panel-error {
            margin: 12px 0;
            padding: 10px 12px;
            border-radius: 12px;
            font-weight: 700;
        }

        .panel-notice {
            background: #eaffef;
            color: #087224;
            border: 1px solid #b9efc4;
        }

        .panel-error {
            background: #fff1f1;
            color: #b00020;
            border: 1px solid #ffd0d0;
        }
/* === AST SETTINGS PORTAL PANEL LOCAL STYLE MIGRATION END 20260426_185713 === */

/* === AST SETTINGS UI LABELS LOCAL STYLE MIGRATION START 20260426_185855 ===
   Перенесено из /public/settings/ui-labels.php.
   На этом шаге правила CSS не нормализуются, только убираются из PHP.
*/
.labels-page {
            max-width: 1240px;
            margin: 0 auto;
            padding: 24px;
        }

        .labels-card {
            background: var(--ast-card-bg, #fff);
            border: 1px solid rgba(140, 100, 255, .25);
            border-radius: 22px;
            padding: 22px;
            box-shadow: 0 14px 40px rgba(80, 60, 180, .08);
        }

        .labels-head {
            display: flex;
            justify-content: space-between;
            gap: 16px;
            align-items: flex-start;
            margin-bottom: 18px;
        }

        .labels-head h1 {
            margin: 0 0 6px;
            color: var(--ast-title, #27005d);
        }

        .labels-muted {
            color: var(--ast-muted, #6b7390);
            font-size: 13px;
        }

        .labels-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .labels-btn {
            border: 0;
            border-radius: 999px;
            padding: 10px 16px;
            background: var(--ast-accent, #6b00ff);
            color: #fff;
            font-weight: 700;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
        }

        .labels-btn.secondary {
            background: rgba(107, 0, 255, .10);
            color: var(--ast-accent, #5a00c8);
            border: 1px solid rgba(107, 0, 255, .25);
        }

        .labels-notice,
        .labels-error {
            margin: 10px 0;
            padding: 10px 12px;
            border-radius: 12px;
            font-weight: 700;
        }

        .labels-notice {
            background: #eaffef;
            color: #087224;
            border: 1px solid #b9efc4;
        }

        .labels-error {
            background: #fff1f1;
            color: #b00020;
            border: 1px solid #ffd0d0;
        }

        .labels-group {
            margin-top: 22px;
            border: 1px solid rgba(140, 100, 255, .22);
            border-radius: 18px;
            overflow: hidden;
        }

        .labels-group-title {
            padding: 12px 14px;
            background: rgba(107, 0, 255, .08);
            font-weight: 800;
            color: var(--ast-title, #27005d);
        }

        .labels-table {
            width: 100%;
            border-collapse: collapse;
        }

        .labels-table th,
        .labels-table td {
            padding: 9px 10px;
            border-top: 1px solid rgba(140, 100, 255, .16);
            vertical-align: top;
            font-size: 13px;
        }

        .labels-table th {
            text-align: left;
            color: var(--ast-muted, #6b7390);
            font-size: 11px;
            text-transform: uppercase;
            background: rgba(245, 242, 255, .65);
        }

        .labels-table code {
            font-size: 12px;
            color: #23356f;
            word-break: break-word;
        }

        .labels-table input[type="text"] {
            width: 100%;
            box-sizing: border-box;
            border: 1px solid rgba(140, 100, 255, .28);
            border-radius: 9px;
            padding: 7px 9px;
            background: var(--ast-input-bg, #fff);
            color: var(--ast-text, #1f2a44);
        }

        .labels-add {
            margin-top: 24px;
            padding: 16px;
            border: 1px dashed rgba(107, 0, 255, .35);
            border-radius: 18px;
            background: rgba(107, 0, 255, .04);
        }

        .labels-add-grid {
            display: grid;
            grid-template-columns: 180px 1fr 1fr;
            gap: 10px;
            margin-bottom: 10px;
        }

        @media (max-width: 900px) {
            .labels-head,
            .labels-add-grid {
                display: block;
            }

            .labels-add-grid input,
            .labels-add-grid select {
                margin-bottom: 8px;
                width: 100%;
            }
        }
/* === AST SETTINGS UI LABELS LOCAL STYLE MIGRATION END 20260426_185855 === */

/* === AST ADD DEVICE LOCAL STYLE MIGRATION START 20260426_191231 ===
   Перенесено из /public/add-device.php.
   Селекторы ограничены body.add-device-page-body, чтобы не затронуть другие страницы.
   На этом шаге визуальная нормализация не выполняется.
*/
body.add-device-page-body .add-device-page-card {
    width: min(1120px, calc(100vw - 92px));
    max-width: none;
}

body.add-device-page-body .add-device-hint {
    margin: 4px 0 18px;
    color: var(--ast-muted, #6f86a3);
    font-size: 13px;
    line-height: 1.45;
}

body.add-device-page-body .add-device-form {
    display: grid;
    gap: 18px;
}

body.add-device-page-body .add-device-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

body.add-device-page-body .add-device-grid .full {
    grid-column: 1 / -1;
}

body.add-device-page-body .add-device-form label {
    display: block;
    margin-bottom: 6px;
    color: var(--ast-text, #244264);
    font-weight: 850;
    font-size: 13px;
}

body.add-device-page-body .add-device-form input,
body.add-device-page-body .add-device-form select,
body.add-device-page-body .add-device-form textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 34px;
    border: 1px solid color-mix(in srgb, var(--ast-blue-main, #3c75ff) 24%, transparent);
    border-radius: 12px;
    padding: 7px 10px;
    background: var(--ast-input-bg, rgba(255,255,255,.96));
    color: var(--ast-text, #244264);
    font-size: 13px;
    outline: none;
}

body.add-device-page-body .add-device-form textarea {
    min-height: 76px;
    resize: vertical;
}

body.add-device-page-body .add-device-form input:focus,
body.add-device-page-body .add-device-form select:focus,
body.add-device-page-body .add-device-form textarea:focus {
    border-color: var(--ast-blue-main, #3c75ff);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ast-blue-main, #3c75ff) 18%, transparent);
}

body.add-device-page-body .add-device-link-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px !important;
}

body.add-device-page-body .add-device-link-check input {
    width: auto;
    min-height: auto;
}

body.add-device-page-body .add-device-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2px;
}

body.add-device-page-body .notice-error {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(239, 68, 68, .28);
    background: rgba(255, 245, 245, .92);
    color: #991b1b;
    font-weight: 800;
}

@media (max-width: 900px) {
    body.add-device-page-body .add-device-page-card {
        width: calc(100vw - 24px);
    }

    body.add-device-page-body .add-device-grid {
        grid-template-columns: 1fr;
    }
}
/* === AST ADD DEVICE LOCAL STYLE MIGRATION END 20260426_191231 === */

/* === AST LOGS RULES LOCAL STYLE MIGRATION START 20260426_192102 ===
   Перенесено из /public/logs/rules.php.
   Селекторы ограничены body.logs-rules-page-body, чтобы не затронуть другие страницы логов и портала.
   На этом шаге правила CSS не нормализуются.
*/
body.logs-rules-page-body .portal-page-card.portal-logs-page {
            width: min(1240px, calc(100vw - 92px));
            max-width: none;
}

body.logs-rules-page-body .portal-section-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin: 12px 0 14px;
            padding: 8px 10px;
            border: 1px solid rgba(122, 92, 255, .20);
            border-radius: 18px;
            background: rgba(246, 244, 255, .88);
            box-shadow: 0 8px 26px rgba(43, 26, 96, .08);
}

body.logs-rules-page-body .portal-section-title {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 220px;
}

body.logs-rules-page-body .portal-section-title strong {
            color: #2a0068;
            font-size: 14px;
}

body.logs-rules-page-body .portal-section-title span {
            color: #5b6380;
            font-size: 12px;
}

body.logs-rules-page-body .portal-section-actions {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            justify-content: flex-end;
}

body.logs-rules-page-body .portal-settings-block + .portal-settings-block {
            margin-top: 16px;
}

body.logs-rules-page-body .log-rules-top {
            display: grid;
            grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.3fr);
            gap: 14px;
            margin-bottom: 16px;
}

body.logs-rules-page-body .log-compact-form {
            display: grid;
            grid-template-columns: 1fr 130px 130px 110px;
            gap: 8px;
            align-items: end;
}

body.logs-rules-page-body .log-compact-form label {
            margin: 0;
}

body.logs-rules-page-body .log-compact-form .wide {
            grid-column: span 2;
}

body.logs-rules-page-body .log-compact-form .full {
            grid-column: 1 / -1;
}

body.logs-rules-page-body .log-compact-form input,
body.logs-rules-page-body .log-compact-form select,
body.logs-rules-page-body .log-compact-form textarea,
body.logs-rules-page-body .rules-row input,
body.logs-rules-page-body .rules-row select {
            width: 100%;
            box-sizing: border-box;
            min-height: 28px;
            padding: 4px 7px;
            font-size: 12px;
}

body.logs-rules-page-body .rules-table {
            display: grid;
            gap: 6px;
            overflow-x: auto;
            padding-bottom: 4px;
}

body.logs-rules-page-body .rules-grid {
            display: grid;
            grid-template-columns: 48px minmax(220px, 1.35fr) 74px 108px 130px minmax(220px, 1fr) 68px 70px;
            gap: 6px;
            align-items: center;
            min-width: 1030px;
}

body.logs-rules-page-body .rules-head {
            padding: 0 8px;
            color: #5b6380;
            font-size: 11px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: .02em;
}

body.logs-rules-page-body .rules-row {
            padding: 6px 8px;
            border: 1px solid rgba(122, 92, 255, .18);
            border-radius: 14px;
            background: rgba(255, 255, 255, .78);
}

body.logs-rules-page-body .rules-row.disabled-rule {
            opacity: .54;
}

body.logs-rules-page-body .rule-id {
            color: #2a0068;
            font-weight: 900;
            font-size: 12px;
}

body.logs-rules-page-body .rule-check {
            display: flex;
            align-items: center;
            gap: 4px;
            white-space: nowrap;
            font-size: 12px;
            color: #253054;
}

body.logs-rules-page-body .rule-check input {
            width: auto;
            min-height: auto;
            padding: 0;
}

body.logs-rules-page-body .rules-row .btn {
            min-height: 28px;
            padding: 4px 8px;
            font-size: 12px;
            white-space: nowrap;
}

body.logs-rules-page-body .log-rule-note {
            color: #5b6380;
            font-size: 12px;
            margin: 4px 0 10px;
}

body.logs-rules-page-body .portal-help-panel {
            display: none;
            margin: 0 0 16px;
            padding: 14px 16px;
            border: 1px solid rgba(122, 92, 255, .22);
            border-radius: 18px;
            background: rgba(255, 255, 255, .88);
            box-shadow: 0 10px 30px rgba(43, 26, 96, .08);
}

body.logs-rules-page-body .portal-help-panel.open {
            display: block;
}

body.logs-rules-page-body .portal-help-panel h2 {
            margin-top: 0;
}

body.logs-rules-page-body .portal-help-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(260px, 1fr));
            gap: 12px;
}

body.logs-rules-page-body .portal-help-card {
            padding: 12px;
            border: 1px solid rgba(122, 92, 255, .16);
            border-radius: 14px;
            background: rgba(248, 247, 255, .72);
}

body.logs-rules-page-body .portal-help-card h3 {
            margin: 0 0 8px;
            color: #2a0068;
            font-size: 14px;
}

body.logs-rules-page-body .portal-help-card p,
body.logs-rules-page-body .portal-help-card li {
            color: #253054;
            font-size: 13px;
            line-height: 1.45;
}

body.logs-rules-page-body .portal-help-card ul {
            margin: 8px 0 0;
            padding-left: 18px;
}

body.logs-rules-page-body .portal-help-card code {
            padding: 1px 5px;
            border-radius: 6px;
            background: rgba(122, 92, 255, .10);
            color: #2a0068;
            font-size: 12px;
}

body.logs-rules-page-body .portal-help-warning {
            margin-top: 12px;
            padding: 10px 12px;
            border: 1px solid rgba(239, 68, 68, .25);
            border-radius: 14px;
            background: rgba(255, 245, 245, .86);
            color: #7f1d1d;
            font-size: 13px;
}

body.logs-rules-page-body .log-stat-grid {
            margin: 10px 0 14px;
}

@media (max-width: 980px) {
body.logs-rules-page-body .portal-page-card.portal-logs-page {
                width: calc(100vw - 24px);
}

body.logs-rules-page-body .portal-section-toolbar,
body.logs-rules-page-body .log-rules-top {
                grid-template-columns: 1fr;
}

body.logs-rules-page-body .portal-section-toolbar {
                align-items: stretch;
                flex-direction: column;
}

body.logs-rules-page-body .portal-section-actions {
                justify-content: flex-start;
}

body.logs-rules-page-body .log-compact-form {
                grid-template-columns: 1fr;
}

body.logs-rules-page-body .log-compact-form .wide,
body.logs-rules-page-body .log-compact-form .full {
                grid-column: auto;
}

}
/* === AST LOGS RULES LOCAL STYLE MIGRATION END 20260426_192102 === */

/* === AST LOGS RULES INPUT RADIUS NORMALIZER START 2026-04-26 === */
/*
   Выравнивает поля на странице /logs/rules.php под общий стиль портала.
   Правило ограничено body.logs-rules-page-body и не трогает /logs/auth.php.
*/
body.logs-rules-page-body .log-compact-form input:not([type="checkbox"]):not([type="radio"]),
body.logs-rules-page-body .log-compact-form select,
body.logs-rules-page-body .log-compact-form textarea,
body.logs-rules-page-body .rules-row input:not([type="checkbox"]):not([type="radio"]),
body.logs-rules-page-body .rules-row select,
body.logs-rules-page-body .rules-row textarea {
    border-radius: 10px !important;
    border: 1px solid color-mix(in srgb, var(--ast-blue-main, #3c75ff) 24%, transparent) !important;
    background: var(--ast-input-bg, var(--ast-card-bg, #ffffff)) !important;
    color: var(--ast-input-text, var(--ast-text, #1f2a44)) !important;
    outline: none !important;
}

body.logs-rules-page-body .log-compact-form input:not([type="checkbox"]):not([type="radio"]):focus,
body.logs-rules-page-body .log-compact-form select:focus,
body.logs-rules-page-body .log-compact-form textarea:focus,
body.logs-rules-page-body .rules-row input:not([type="checkbox"]):not([type="radio"]):focus,
body.logs-rules-page-body .rules-row select:focus,
body.logs-rules-page-body .rules-row textarea:focus {
    border-color: var(--ast-blue-main, #3c75ff) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ast-blue-main, #3c75ff) 18%, transparent) !important;
}
/* === AST LOGS RULES INPUT RADIUS NORMALIZER END 2026-04-26 === */

/* === AST LOGS AUTH LOCAL STYLE MIGRATION START 20260426_192744 ===
   Перенесено из /public/logs/auth.php.
   Селекторы ограничены body.portal-auth-page-body, чтобы не затронуть другие страницы логов.
   На этом шаге правила CSS не нормализуются.
*/
body.portal-auth-page-body .auth-page-card {
            width: min(1220px, calc(100vw - 96px));
            max-width: none;
            overflow: hidden;
}

body.portal-auth-page-body .auth-filter-grid {
            display: grid;
            grid-template-columns: repeat(5, minmax(0, 1fr));
            gap: 10px;
            align-items: end;
}

body.portal-auth-page-body .auth-filter-grid label {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
            color: var(--ast-muted, #6f86a3);
            font-size: 11px;
            font-weight: 850;
}

body.portal-auth-page-body .auth-filter-grid input,
body.portal-auth-page-body .auth-filter-grid select {
            width: 100%;
            min-width: 0;
            min-height: 31px;
            box-sizing: border-box;
            border-radius: 10px;
}

body.portal-auth-page-body .auth-filter-actions {
            grid-column: 1 / -1;
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            margin-top: 2px;
}

body.portal-auth-page-body .auth-live-filter {
            display: grid;
            grid-template-columns: minmax(260px, 1fr) auto;
            gap: 10px;
            align-items: center;
            margin: 8px 0 10px;
}

body.portal-auth-page-body .auth-live-filter input {
            width: 100%;
            min-height: 32px;
            box-sizing: border-box;
}

body.portal-auth-page-body .auth-live-counter {
            color: var(--ast-muted, #6f86a3);
            font-size: 11px;
            font-weight: 850;
            white-space: nowrap;
}

body.portal-auth-page-body .auth-table-wrap {
            width: 100%;
            overflow-x: auto;
            padding-bottom: 2px;
}

body.portal-auth-page-body .auth-dense-table {
            width: 100%;
            min-width: 1040px;
            border-collapse: separate;
            border-spacing: 0 3px;
            font-size: 11px;
}

body.portal-auth-page-body .auth-dense-table th {
            padding: 4px 7px;
            color: var(--ast-muted, #6f86a3);
            font-size: 9px;
            font-weight: 900;
            text-align: left;
            text-transform: uppercase;
            background: color-mix(in srgb, var(--ast-card-bg, #fff) 88%, var(--ast-blue-main, #3c75ff) 12%);
            border-top: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-bottom: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
}

body.portal-auth-page-body .auth-dense-table th:first-child {
            border-left: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 12px 0 0 12px;
}

body.portal-auth-page-body .auth-dense-table th:last-child {
            border-right: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 0 12px 12px 0;
}

body.portal-auth-page-body .auth-dense-table td {
            height: 24px;
            max-width: 180px;
            padding: 3px 7px;
            color: var(--ast-text, #244264);
            background: var(--ast-panel-bg, rgba(255,255,255,.74));
            border-top: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-bottom: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.1;
}

body.portal-auth-page-body .auth-dense-table td:first-child {
            border-left: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 12px 0 0 12px;
}

body.portal-auth-page-body .auth-dense-table td:last-child {
            border-right: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 0 12px 12px 0;
}

body.portal-auth-page-body .auth-pill {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 56px;
            height: 18px;
            padding: 0 6px;
            border-radius: 999px;
            font-size: 9px;
            font-weight: 900;
}

body.portal-auth-page-body .auth-pill.success,
body.portal-auth-page-body .auth-pill.active {
            background: rgba(34, 197, 94, .14);
            color: #166534;
}

body.portal-auth-page-body .auth-pill.failed {
            background: rgba(239, 68, 68, .14);
            color: #991b1b;
}

body.portal-auth-page-body .auth-pill.closed {
            background: rgba(100, 116, 139, .14);
            color: #475569;
}

body.portal-auth-page-body .auth-pill.unknown {
            background: rgba(100, 116, 139, .12);
            color: #475569;
}

body.portal-auth-page-body .auth-muted-small {
            display: inline;
            margin-left: 4px;
            color: var(--ast-muted, #6f86a3);
            font-size: 9px;
            line-height: 1;
}

body.portal-auth-page-body .auth-split-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(260px, 1fr));
            gap: 12px;
            margin: 16px 0 18px;
}

body.portal-auth-page-body .auth-split-card {
            padding: 14px;
            border: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 16px;
            background: var(--ast-panel-bg, rgba(255,255,255,.76));
}

body.portal-auth-page-body .auth-split-card h3 {
            margin: 0 0 8px;
            color: var(--ast-title, #1e2f6f);
            font-size: 15px;
}

body.portal-auth-page-body .auth-split-card p {
            margin: 0;
            color: var(--ast-text, #244264);
            font-size: 13px;
            line-height: 1.45;
}

@media (max-width: 1200px) {
body.portal-auth-page-body .auth-filter-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.portal-auth-page-body .auth-split-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
}

}

@media (max-width: 760px) {
body.portal-auth-page-body .auth-page-card {
                width: calc(100vw - 24px);
}

body.portal-auth-page-body .auth-filter-grid,
body.portal-auth-page-body .auth-split-grid {
                grid-template-columns: 1fr;
}

body.portal-auth-page-body .auth-filter-actions,
body.portal-auth-page-body .auth-live-filter {
                grid-template-columns: 1fr;
                justify-content: flex-start;
}

}
/* === AST LOGS AUTH LOCAL STYLE MIGRATION END 20260426_192744 === */

/* === AST LOGS INDEX LOCAL STYLE MIGRATION START 20260426_193153 ===
   Перенесено из /public/logs/index.php.
   Селекторы ограничены body.logs-index-page-body, чтобы не затронуть Авторизации и Правила анализа.
   На этом шаге правила CSS не нормализуются.
*/
body.logs-index-page-body .logs-page-card {
            width: min(1220px, calc(100vw - 96px));
            max-width: none;
            overflow: hidden;
}

body.logs-index-page-body .logs-filter-grid {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 10px;
            align-items: end;
}

body.logs-index-page-body .logs-filter-grid label {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
            color: var(--ast-muted, #6f86a3);
            font-size: 11px;
            font-weight: 850;
}

body.logs-index-page-body .logs-filter-grid input,
body.logs-index-page-body .logs-filter-grid select {
            width: 100%;
            min-width: 0;
            min-height: 31px;
            box-sizing: border-box;
            border-radius: 10px;
}

body.logs-index-page-body .logs-filter-actions {
            grid-column: 1 / -1;
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            margin-top: 2px;
}

body.logs-index-page-body .logs-mini-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(260px, 1fr));
            gap: 12px;
            margin: 14px 0 0;
}

body.logs-index-page-body .logs-mini-card {
            padding: 10px 12px;
            border: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 14px;
            background: var(--ast-panel-bg, rgba(255,255,255,.74));
}

body.logs-index-page-body .logs-mini-card h3 {
            margin: 0 0 8px;
            color: var(--ast-title, #1e2f6f);
            font-size: 13px;
}

body.logs-index-page-body .logs-mini-list {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
}

body.logs-index-page-body .logs-mini-item {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            min-height: 21px;
            padding: 0 7px;
            border-radius: 999px;
            background: color-mix(in srgb, var(--ast-blue-main, #3c75ff) 10%, transparent);
            color: var(--ast-title, #1e2f6f);
            font-size: 10px;
            font-weight: 900;
}

body.logs-index-page-body .logs-live-filter {
            display: grid;
            grid-template-columns: minmax(260px, 1fr) auto;
            gap: 10px;
            align-items: center;
            margin: 8px 0 10px;
}

body.logs-index-page-body .logs-live-filter input {
            width: 100%;
            min-height: 32px;
            box-sizing: border-box;
}

body.logs-index-page-body .logs-live-counter {
            color: var(--ast-muted, #6f86a3);
            font-size: 12px;
            font-weight: 850;
            white-space: nowrap;
}

body.logs-index-page-body .logs-table-wrap {
            width: 100%;
            overflow-x: auto;
            padding-bottom: 2px;
}

body.logs-index-page-body .logs-dense-table {
            width: 100%;
            min-width: 980px;
            border-collapse: separate;
            border-spacing: 0 3px;
            font-size: 11px;
}

body.logs-index-page-body .logs-dense-table th {
            padding: 4px 7px;
            color: var(--ast-muted, #6f86a3);
            font-size: 9px;
            font-weight: 900;
            text-align: left;
            text-transform: uppercase;
            background: color-mix(in srgb, var(--ast-card-bg, #fff) 88%, var(--ast-blue-main, #3c75ff) 12%);
            border-top: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-bottom: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
}

body.logs-index-page-body .logs-dense-table th:first-child {
            border-left: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 12px 0 0 12px;
}

body.logs-index-page-body .logs-dense-table th:last-child {
            border-right: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 0 12px 12px 0;
}

body.logs-index-page-body .logs-dense-table td {
            height: 24px;
            max-width: 260px;
            padding: 3px 7px;
            color: var(--ast-text, #244264);
            background: var(--ast-panel-bg, rgba(255,255,255,.74));
            border-top: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-bottom: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.1;
}

body.logs-index-page-body .logs-dense-table td:first-child {
            border-left: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 12px 0 0 12px;
}

body.logs-index-page-body .logs-dense-table td:last-child {
            border-right: 1px solid color-mix(in srgb, var(--ast-border, #dbe8ff) 82%, transparent);
            border-radius: 0 12px 12px 0;
}

body.logs-index-page-body .logs-pill {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 58px;
            height: 18px;
            padding: 0 6px;
            border-radius: 999px;
            font-size: 9px;
            font-weight: 900;
}

body.logs-index-page-body .logs-pill.critical {
            background: rgba(239, 68, 68, .18);
            color: #991b1b;
}

body.logs-index-page-body .logs-pill.error {
            background: rgba(249, 115, 22, .16);
            color: #9a3412;
}

body.logs-index-page-body .logs-pill.warning {
            background: rgba(245, 158, 11, .18);
            color: #92400e;
}

body.logs-index-page-body .logs-pill.notice,
body.logs-index-page-body .logs-pill.info {
            background: rgba(59, 130, 246, .12);
            color: #1d4ed8;
}

body.logs-index-page-body .logs-pill.debug,
body.logs-index-page-body .logs-pill.unknown {
            background: rgba(100, 116, 139, .12);
            color: #475569;
}

body.logs-index-page-body .logs-category-pill {
            display: inline-flex;
            max-width: 120px;
            height: 18px;
            align-items: center;
            padding: 0 6px;
            border-radius: 999px;
            background: color-mix(in srgb, var(--ast-blue-main, #3c75ff) 12%, transparent);
            color: var(--ast-title, #1e2f6f);
            font-size: 9px;
            font-weight: 900;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
}

body.logs-index-page-body .logs-muted-small {
            display: inline;
            margin-left: 4px;
            color: var(--ast-muted, #6f86a3);
            font-size: 9px;
            line-height: 1;
}

body.logs-index-page-body .logs-message-cell {
            max-width: 460px;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

@media (max-width: 1000px) {
body.logs-index-page-body .logs-filter-grid,
body.logs-index-page-body .logs-mini-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
}

}

@media (max-width: 760px) {
body.logs-index-page-body .logs-page-card {
                width: calc(100vw - 24px);
}

body.logs-index-page-body .logs-filter-grid,
body.logs-index-page-body .logs-mini-grid,
body.logs-index-page-body .logs-live-filter {
                grid-template-columns: 1fr;
}

body.logs-index-page-body .logs-filter-actions {
                justify-content: flex-start;
                flex-wrap: wrap;
}

}
/* === AST LOGS INDEX LOCAL STYLE MIGRATION END 20260426_193153 === */

/* === AST PORTAL NAV RIGHT CONTROLS NORMALIZER START 2026-04-26 === */
/*
   Глобальный стиль правой части верхней панели портала.
   Единый эталон: как визуально подтверждено на /settings/.
   Правый контейнер получает surface-фон темы, а внутренние элементы прозрачные.
   Цвета берутся из переменных темы, без жёсткого цвета.
*/

.portal-nav .portal-user {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;

    padding: 2px 8px !important;
    min-height: var(--portal-nav-height, 30px) !important;
    box-sizing: border-box !important;

    background: var(--ast-card-bg, #ffffff) !important;
    border: 1px solid color-mix(in srgb, var(--portal-nav-border, var(--ast-border, #c7d2fe)) 72%, transparent) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}

.portal-nav .portal-user-name,
.portal-nav .portal-theme-control,
.portal-nav .portal-logout,
.portal-nav .portal-mail-indicator,
.portal-nav .portal-notification-indicator,
.portal-nav .portal-icon-button {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    filter: none !important;

    color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    -webkit-text-fill-color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    text-shadow: none !important;

    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    text-decoration: none !important;
}

.portal-nav .portal-user-name,
.portal-nav .portal-logout {
    padding: 0 2px !important;
}

.portal-nav .portal-theme-control {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 !important;
    min-height: 0 !important;
}

.portal-nav .portal-theme-control span {
    color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    -webkit-text-fill-color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
}

.portal-nav .portal-theme-control select,
.portal-nav .portal-theme-control .theme-select {
    width: auto !important;
    min-width: 0 !important;
    max-width: 132px !important;
    min-height: 0 !important;
    height: auto !important;

    padding: 0 14px 0 0 !important;
    margin: 0 !important;

    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;

    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;

    color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    -webkit-text-fill-color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;

    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;

    appearance: auto !important;
    -webkit-appearance: menulist !important;
}

.portal-nav .portal-theme-control select option {
    background: var(--ast-card-bg, #ffffff) !important;
    color: var(--ast-text, #1f2a44) !important;
}

.portal-nav .portal-mail-indicator,
.portal-nav .portal-notification-indicator,
.portal-nav .portal-icon-button {
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
}

.portal-nav .portal-user-name:hover,
.portal-nav .portal-logout:hover,
.portal-nav .portal-theme-control:hover,
.portal-nav .portal-mail-indicator:hover,
.portal-nav .portal-notification-indicator:hover,
.portal-nav .portal-icon-button:hover {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
}
/* === AST PORTAL NAV RIGHT CONTROLS NORMALIZER END 2026-04-26 === */

/* === AST NOTIFICATIONS PORTAL NAV RIGHT UNIFIED START 2026-04-26 === */
/*
   Страхующий слой для /notifications/, чтобы страница не отличалась от общего эталона.
   Единый эталон: как визуально подтверждено на /settings/.
   Правый контейнер получает surface-фон темы, а внутренние элементы прозрачные.
   Цвета берутся из переменных темы, без жёсткого цвета.
*/

body.ast-notifications-page-body .portal-nav .portal-user {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;

    padding: 2px 8px !important;
    min-height: var(--portal-nav-height, 30px) !important;
    box-sizing: border-box !important;

    background: var(--ast-card-bg, #ffffff) !important;
    border: 1px solid color-mix(in srgb, var(--portal-nav-border, var(--ast-border, #c7d2fe)) 72%, transparent) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}

body.ast-notifications-page-body .portal-nav .portal-user-name,
body.ast-notifications-page-body .portal-nav .portal-theme-control,
body.ast-notifications-page-body .portal-nav .portal-logout,
body.ast-notifications-page-body .portal-nav .portal-mail-indicator,
body.ast-notifications-page-body .portal-nav .portal-notification-indicator,
body.ast-notifications-page-body .portal-nav .portal-icon-button {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    filter: none !important;

    color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    -webkit-text-fill-color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    text-shadow: none !important;

    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    text-decoration: none !important;
}

body.ast-notifications-page-body .portal-nav .portal-user-name,
body.ast-notifications-page-body .portal-nav .portal-logout {
    padding: 0 2px !important;
}

body.ast-notifications-page-body .portal-nav .portal-theme-control {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 !important;
    min-height: 0 !important;
}

body.ast-notifications-page-body .portal-nav .portal-theme-control span {
    color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    -webkit-text-fill-color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
}

body.ast-notifications-page-body .portal-nav .portal-theme-control select,
body.ast-notifications-page-body .portal-nav .portal-theme-control .theme-select {
    width: auto !important;
    min-width: 0 !important;
    max-width: 132px !important;
    min-height: 0 !important;
    height: auto !important;

    padding: 0 14px 0 0 !important;
    margin: 0 !important;

    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;

    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;

    color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;
    -webkit-text-fill-color: var(--portal-nav-text, var(--ast-text, #183b72)) !important;

    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;

    appearance: auto !important;
    -webkit-appearance: menulist !important;
}

body.ast-notifications-page-body .portal-nav .portal-theme-control select option {
    background: var(--ast-card-bg, #ffffff) !important;
    color: var(--ast-text, #1f2a44) !important;
}

body.ast-notifications-page-body .portal-nav .portal-mail-indicator,
body.ast-notifications-page-body .portal-nav .portal-notification-indicator,
body.ast-notifications-page-body .portal-nav .portal-icon-button {
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
}

body.ast-notifications-page-body .portal-nav .portal-user-name:hover,
body.ast-notifications-page-body .portal-nav .portal-logout:hover,
body.ast-notifications-page-body .portal-nav .portal-theme-control:hover,
body.ast-notifications-page-body .portal-nav .portal-mail-indicator:hover,
body.ast-notifications-page-body .portal-nav .portal-notification-indicator:hover,
body.ast-notifications-page-body .portal-nav .portal-icon-button:hover {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
}
/* === AST NOTIFICATIONS PORTAL NAV RIGHT UNIFIED END 2026-04-26 === */

/* === AST DEVICE TWO BIG BLOCKS FORCE START 2026-04-27 === */
/*
   Упрощённый принудительный редизайн карточки устройства.
   Делает 2 больших визуальных блока:
   1) обзор + тип + бейдж + SNMP;
   2) графики Cacti.
*/

body.ast-device-page-body .ast-device-main-block-js {
    margin-top: 0 !important;
    padding: 18px !important;
    border-radius: 22px !important;
    background: var(--ast-card-bg) !important;
    color: var(--ast-text) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 14px 40px color-mix(in srgb, var(--ast-shadow) 90%, transparent) !important;
}

body.ast-device-page-body .ast-device-main-block-js > .ast-device-overview-block,
body.ast-device-page-body .ast-device-main-block-js > .snmp-card {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.ast-device-page-body .ast-device-main-block-js > .snmp-card {
    margin-top: 16px !important;
    padding-top: 16px !important;
    border-top: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .ast-device-overview-block {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 360px) !important;
    grid-template-areas:
        "head side"
        "info info";
    gap: 12px !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-section-head {
    grid-area: head !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

body.ast-device-page-body .ast-device-overview-block .ast-device-section-head > div:first-child {
    min-width: 0 !important;
}

body.ast-device-page-body .ast-device-head-side-js {
    grid-area: side !important;
    display: grid !important;
    gap: 8px !important;
    align-items: start !important;
    justify-items: stretch !important;
}

body.ast-device-page-body .ast-device-head-side-js .ast-device-status-pill {
    justify-self: end !important;
    width: auto !important;
}

body.ast-device-page-body .ast-device-type-panel,
body.ast-device-page-body .ast-device-type-panel-compact-js {
    margin: 0 !important;
    padding: 10px !important;
    border-radius: 14px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: none !important;
}

body.ast-device-page-body .ast-device-type-panel .muted {
    display: none !important;
}

body.ast-device-page-body .ast-device-panel-title {
    margin-bottom: 5px !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
}

body.ast-device-page-body .ast-device-type-form {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

body.ast-device-page-body .ast-device-type-select {
    min-width: 0 !important;
    flex: 1 1 170px !important;
}

body.ast-device-page-body .ast-device-info-grid {
    grid-area: info !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)) !important;
    gap: 9px !important;
    margin: 0 !important;
}

body.ast-device-page-body .ast-device-info-item {
    min-width: 0 !important;
    padding: 9px 10px !important;
    border-radius: 13px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: none !important;
}

body.ast-device-page-body .ast-device-info-item span {
    margin-bottom: 4px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
}

body.ast-device-page-body .ast-device-info-item strong {
    font-size: 13px !important;
    line-height: 1.2 !important;
}

body.ast-device-page-body .ast-device-badge-compact-js {
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10px !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}

body.ast-device-page-body .snmp-head {
    margin: 0 0 12px !important;
    padding: 0 0 10px !important;
    border-bottom: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .snmp-card > .row {
    display: grid !important;
    grid-template-columns: minmax(135px, 190px) minmax(0, 1fr) !important;
    gap: 6px !important;
    align-items: baseline !important;
    margin: 0 0 7px !important;
    padding: 8px 10px !important;
    border-radius: 12px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border: 1px solid var(--ast-border) !important;
}

body.ast-device-page-body .snmp-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)) !important;
    gap: 9px !important;
    margin: 12px 0 !important;
}

body.ast-device-page-body .summary-card {
    padding: 10px 11px !important;
    min-height: 60px !important;
    border-radius: 13px !important;
    box-shadow: none !important;
}

body.ast-device-page-body .summary-card-title {
    font-size: 11px !important;
    line-height: 1.1 !important;
}

body.ast-device-page-body .summary-card-value {
    font-size: 19px !important;
    line-height: 1.08 !important;
}

body.ast-device-page-body .summary-card-subtitle {
    margin-top: 4px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
}

body.ast-device-page-body .snmp-group {
    margin-top: 9px !important;
    border-radius: 13px !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

body.ast-device-page-body .snmp-group-title {
    padding: 8px 10px !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
}

body.ast-device-page-body .snmp-table {
    margin: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
}

body.ast-device-page-body .snmp-table th,
body.ast-device-page-body .snmp-table td {
    padding: 7px 9px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
}

body.ast-device-page-body .snmp-table th {
    font-size: 12px !important;
}

body.ast-device-page-body .snmp-table tr:last-child td {
    border-bottom: 0 !important;
}

body.ast-device-page-body .graphs-card {
    margin-top: 20px !important;
    padding: 18px !important;
    border-radius: 22px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
    box-shadow: 0 14px 40px color-mix(in srgb, var(--ast-shadow) 90%, transparent) !important;
}

@media (max-width: 900px) {
    body.ast-device-page-body .ast-device-overview-block {
        grid-template-columns: 1fr !important;
        grid-template-areas:
            "head"
            "side"
            "info";
    }

    body.ast-device-page-body .ast-device-head-side-js .ast-device-status-pill {
        justify-self: start !important;
    }
}

/* === AST DEVICE TWO BIG BLOCKS FORCE END 2026-04-27 === */

/* ===== AST device card compact real layout without JS =====
   Compact left-grouped layout:
   - overview tile on the left;
   - compact mini-cards grouped left;
   - type card under technical name;
   - vendor badge under comment;
   - SNMP tile compact on the right. */

body.ast-device-page-body .ast-device-top-card,
body.ast-device-page-body .ast-device-top-card *,
body.ast-device-page-body .ast-device-top-card *::before,
body.ast-device-page-body .ast-device-top-card *::after {
    box-sizing: border-box !important;
}

body.ast-device-page-body .ast-device-top-card {
    padding: 14px !important;
    margin: 0 0 14px !important;
    background: var(--ast-card-bg) !important;
    border: 1px solid var(--ast-border) !important;
    border-radius: 18px !important;
    box-shadow: var(--ast-shadow) !important;
}

body.ast-device-page-body .ast-device-top-grid {
    display: grid !important;
    grid-template-columns: minmax(560px, 720px) minmax(330px, 380px) !important;
    gap: 12px !important;
    align-items: start !important;
    justify-content: start !important;
}

body.ast-device-page-body .ast-device-tile {
    min-width: 0 !important;
    padding: 12px !important;
    border-radius: 15px !important;
    border: 1px solid var(--ast-border) !important;
    background: var(--ast-panel-bg, var(--ast-card-bg)) !important;
    box-shadow: none !important;
}

body.ast-device-page-body .ast-device-tile-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 10px !important;
    min-width: 0 !important;
    margin: 0 0 10px !important;
}

body.ast-device-page-body .ast-device-title-wrap {
    min-width: 0 !important;
    max-width: 420px !important;
}

body.ast-device-page-body .ast-device-top-card h1 {
    margin: 0 0 4px !important;
    font-size: clamp(24px, 2vw, 31px) !important;
    line-height: 1.08 !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
}

body.ast-device-page-body .ast-device-top-card h2 {
    margin: 0 !important;
    font-size: 17px !important;
    line-height: 1.15 !important;
}

body.ast-device-page-body .ast-device-top-card .portal-page-kicker {
    margin: 0 0 3px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
    letter-spacing: .08em !important;
}

body.ast-device-page-body .ast-device-top-card .muted {
    font-size: 12px !important;
    line-height: 1.25 !important;
}

body.ast-device-page-body .ast-device-top-card .ast-device-status-pill {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: 7px 12px !important;
    white-space: nowrap !important;
}

body.ast-device-page-body .ast-device-inline-type-card {
    margin-top: 10px !important;
    width: min(100%, 340px) !important;
    padding: 9px 10px !important;
    border-radius: 12px !important;
    border: 1px solid var(--ast-border) !important;
    background: var(--ast-card-bg, var(--ast-panel-bg)) !important;
    box-shadow: none !important;
}

body.ast-device-page-body .ast-device-overview-body {
    display: block !important;
    min-width: 0 !important;
}

body.ast-device-page-body .ast-device-mini-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(150px, 170px)) !important;
    gap: 8px !important;
    justify-content: start !important;
    align-items: stretch !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

body.ast-device-page-body .ast-device-mini-card,
body.ast-device-page-body .ast-device-side-card,
body.ast-device-page-body .ast-device-summary-card,
body.ast-device-page-body .ast-snmp-profile-grid .ast-device-mini-card {
    min-width: 0 !important;
    max-width: 100% !important;
    border-radius: 12px !important;
    border: 1px solid var(--ast-border) !important;
    background: var(--ast-card-bg, var(--ast-panel-bg)) !important;
    box-shadow: none !important;
}

body.ast-device-page-body .ast-device-mini-card {
    padding: 8px 10px !important;
}

body.ast-device-page-body .ast-device-mini-card-wide {
    grid-column: 1 / -1 !important;
}

body.ast-device-page-body .ast-device-mini-card span {
    display: block !important;
    margin: 0 0 4px !important;
    color: var(--ast-muted) !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-transform: uppercase !important;
}

body.ast-device-page-body .ast-device-mini-card strong {
    display: block !important;
    min-width: 0 !important;
    color: var(--ast-title) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
}

body.ast-device-page-body .ast-device-side-card {
    padding: 10px !important;
}

body.ast-device-page-body .ast-device-badge-below-grid {
    margin-top: 10px !important;
    width: min(100%, 348px) !important;
}

body.ast-device-page-body .ast-device-panel-title {
    margin: 0 0 8px !important;
    color: var(--ast-title) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}

body.ast-device-page-body .ast-device-type-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    align-items: end !important;
    margin: 0 !important;
}

body.ast-device-page-body .ast-device-type-select,
body.ast-device-page-body .ast-device-type-submit {
    min-height: 34px !important;
    height: 34px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

/* Vendor badge under comment */
body.ast-device-page-body .ast-device-badge-card .ast-device-icon-admin {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-title {
    margin: 0 0 8px !important;
    color: var(--ast-title) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    gap: 8px !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
    width: 38px !important;
    height: 38px !important;
    object-fit: contain !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-controls {
    min-width: 0 !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-select {
    width: 100% !important;
    min-height: 32px !important;
    height: 32px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-actions {
    margin-top: 7px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-save-btn {
    min-height: 32px !important;
    height: 32px !important;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-hint {
    margin-top: 6px !important;
    color: var(--ast-muted) !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
}

/* SNMP tile */
body.ast-device-page-body .ast-snmp-profile-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(145px, 1fr)) !important;
    gap: 8px !important;
    margin: 0 0 8px !important;
}

body.ast-device-page-body .ast-device-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(90px, 1fr)) !important;
    gap: 8px !important;
    margin: 0 0 8px !important;
}

body.ast-device-page-body .ast-device-summary-card {
    padding: 8px 9px !important;
}

body.ast-device-page-body .ast-device-summary-card .summary-card-title,
body.ast-device-page-body .ast-device-summary-card .summary-card-subtitle {
    color: var(--ast-muted) !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
}

body.ast-device-page-body .ast-device-summary-card .summary-card-value {
    color: var(--ast-title) !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    line-height: 1.15 !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
}

body.ast-device-page-body .ast-snmp-values-details {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

body.ast-device-page-body .ast-snmp-values-details > summary {
    display: inline-flex !important;
    cursor: pointer !important;
    padding: 7px 10px !important;
    border-radius: 12px !important;
    background: var(--ast-card-bg, var(--ast-panel-bg)) !important;
    border: 1px solid var(--ast-border) !important;
    color: var(--ast-title) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
}

body.ast-device-page-body .ast-snmp-values-details .snmp-group {
    margin-top: 8px !important;
    border-radius: 13px !important;
    background: var(--ast-card-bg, var(--ast-panel-bg)) !important;
    border: 1px solid var(--ast-border) !important;
    overflow: hidden !important;
}

body.ast-device-page-body .ast-snmp-values-details .snmp-group-title {
    padding: 7px 9px !important;
    color: var(--ast-title) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    background: var(--ast-panel-bg, var(--ast-button-hover)) !important;
}

body.ast-device-page-body .ast-snmp-values-details .snmp-table {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
}

body.ast-device-page-body .ast-snmp-values-details .snmp-table th,
body.ast-device-page-body .ast-snmp-values-details .snmp-table td {
    padding: 6px 8px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    vertical-align: top !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
}

body.ast-device-page-body .ast-snmp-values-details .snmp-table th {
    background: var(--ast-panel-bg, var(--ast-button-hover)) !important;
}

body.ast-device-page-body .graphs-card {
    margin-top: 0 !important;
}

@media (max-width: 1180px) {
    body.ast-device-page-body .ast-device-top-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 760px) {
    body.ast-device-page-body .ast-device-mini-grid,
    body.ast-device-page-body .ast-snmp-profile-grid,
    body.ast-device-page-body .ast-device-summary-grid,
    body.ast-device-page-body .ast-device-type-form,
    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
        grid-template-columns: 1fr !important;
    }

    body.ast-device-page-body .ast-device-badge-below-grid,
    body.ast-device-page-body .ast-device-inline-type-card,
    body.ast-device-page-body .ast-device-title-wrap {
        max-width: none !important;
        width: 100% !important;
    }

    body.ast-device-page-body .ast-device-mini-card-wide {
        grid-column: auto !important;
    }

    body.ast-device-page-body .ast-device-tile-head {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

/* ===== AST device card percentage layout override =====
   Основные размеры в процентах:
   - левая плитка компактная;
   - правая плитка рядом с фиксированным gap;
   - внутренние мини-плитки выровнены по ширине. */

body.ast-device-page-body .ast-device-top-grid {
    width: 78% !important;
    display: grid !important;
    grid-template-columns: 62% 36% !important;
    column-gap: 12px !important;
    row-gap: 12px !important;
    justify-content: start !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-overview-tile,
body.ast-device-page-body .ast-device-snmp-tile {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* Левая плитка: всё группируется слева, но ширины внутри выровнены */
body.ast-device-page-body .ast-device-overview-body {
    width: 58% !important;
    display: block !important;
    min-width: 0 !important;
}

body.ast-device-page-body .ast-device-title-wrap {
    width: 58% !important;
    max-width: none !important;
    min-width: 0 !important;
}

body.ast-device-page-body .ast-device-inline-type-card {
    width: 100% !important;
    max-width: none !important;
    margin-top: 10px !important;
}

body.ast-device-page-body .ast-device-mini-grid {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    justify-content: start !important;
    align-items: stretch !important;
}

body.ast-device-page-body .ast-device-mini-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

body.ast-device-page-body .ast-device-mini-card-wide {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

/* Бейдж под комментарием, по ширине как левая группа */
body.ast-device-page-body .ast-device-badge-below-grid {
    width: 100% !important;
    max-width: none !important;
    margin-top: 10px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
    display: grid !important;
    grid-template-columns: 14% 86% !important;
    gap: 8px !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
    width: 100% !important;
    max-width: 42px !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
}

/* Правая SNMP-плитка: компактнее, внутренности не растягивать лишне */
body.ast-device-page-body .ast-snmp-profile-grid {
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.ast-device-page-body .ast-device-summary-grid {
    width: 74% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    justify-content: start !important;
}

body.ast-device-page-body .ast-device-summary-card {
    width: 100% !important;
    min-width: 0 !important;
}

/* На средних экранах верхний блок остаётся в две колонки дольше */
@media (max-width: 1180px) {
    body.ast-device-page-body .ast-device-top-grid {
        width: 92% !important;
        grid-template-columns: 60% 38% !important;
        column-gap: 12px !important;
    }

    body.ast-device-page-body .ast-device-overview-body,
    body.ast-device-page-body .ast-device-title-wrap {
        width: 64% !important;
    }
}

/* На узких экранах — одна колонка */
@media (max-width: 860px) {
    body.ast-device-page-body .ast-device-top-grid {
        width: 100% !important;
        grid-template-columns: 1fr !important;
    }

    body.ast-device-page-body .ast-device-overview-body,
    body.ast-device-page-body .ast-device-title-wrap,
    body.ast-device-page-body .ast-device-summary-grid {
        width: 100% !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
        grid-template-columns: 42px minmax(0, 1fr) !important;
    }
}

@media (max-width: 560px) {
    body.ast-device-page-body .ast-device-mini-grid,
    body.ast-device-page-body .ast-snmp-profile-grid,
    body.ast-device-page-body .ast-device-summary-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== AST device card MAX COMPACT override =====
   Финальная компактная доводка:
   - основные размеры в процентах;
   - плитки группируются слева;
   - фиксированный gap между overview и SNMP;
   - минимум пустого пространства. */

body.ast-device-page-body .ast-device-top-card {
    padding: 10px !important;
    margin-bottom: 10px !important;
    border-radius: 16px !important;
}

body.ast-device-page-body .ast-device-top-grid {
    width: 68% !important;
    grid-template-columns: 61% 37% !important;
    column-gap: 10px !important;
    row-gap: 10px !important;
    justify-content: start !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-tile {
    padding: 9px !important;
    border-radius: 13px !important;
}

/* Заголовок и статус */
body.ast-device-page-body .ast-device-tile-head {
    gap: 8px !important;
    margin-bottom: 8px !important;
}

body.ast-device-page-body .ast-device-title-wrap {
    width: 54% !important;
    max-width: none !important;
}

body.ast-device-page-body .ast-device-top-card h1 {
    margin-bottom: 3px !important;
    font-size: clamp(22px, 1.75vw, 28px) !important;
    line-height: 1.05 !important;
}

body.ast-device-page-body .ast-device-top-card h2 {
    font-size: 16px !important;
    line-height: 1.1 !important;
}

body.ast-device-page-body .ast-device-top-card .portal-page-kicker {
    margin-bottom: 2px !important;
    font-size: 10px !important;
    line-height: 1.05 !important;
}

body.ast-device-page-body .ast-device-top-card .muted {
    font-size: 11px !important;
    line-height: 1.15 !important;
}

body.ast-device-page-body .ast-device-top-card .ast-device-status-pill {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

/* Тип устройства под техническим именем */
body.ast-device-page-body .ast-device-inline-type-card {
    width: 100% !important;
    margin-top: 8px !important;
    padding: 7px 8px !important;
    border-radius: 11px !important;
}

body.ast-device-page-body .ast-device-panel-title {
    margin-bottom: 6px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
}

body.ast-device-page-body .ast-device-type-form {
    gap: 6px !important;
}

body.ast-device-page-body .ast-device-type-select,
body.ast-device-page-body .ast-device-type-submit {
    min-height: 30px !important;
    height: 30px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    font-size: 12px !important;
}

/* Левая группа плиток */
body.ast-device-page-body .ast-device-overview-body {
    width: 52% !important;
}

body.ast-device-page-body .ast-device-mini-grid {
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
}

body.ast-device-page-body .ast-device-mini-card {
    padding: 6px 8px !important;
    border-radius: 10px !important;
    min-height: 48px !important;
}

body.ast-device-page-body .ast-device-mini-card span {
    margin-bottom: 3px !important;
    font-size: 9px !important;
    line-height: 1.05 !important;
}

body.ast-device-page-body .ast-device-mini-card strong {
    font-size: 11px !important;
    line-height: 1.15 !important;
}

/* Бейдж под комментарием */
body.ast-device-page-body .ast-device-badge-below-grid {
    width: 100% !important;
    margin-top: 8px !important;
    padding: 8px !important;
    border-radius: 11px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-title {
    margin-bottom: 6px !important;
    font-size: 12px !important;
    line-height: 1.1 !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
    grid-template-columns: 12% 88% !important;
    gap: 6px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
    max-width: 34px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-select {
    min-height: 30px !important;
    height: 30px !important;
    font-size: 12px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-actions {
    margin-top: 6px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-save-btn {
    min-height: 30px !important;
    height: 30px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    font-size: 12px !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-hint {
    margin-top: 5px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
}

/* Правая SNMP-плитка */
body.ast-device-page-body .ast-device-snmp-tile {
    padding: 9px !important;
}

body.ast-device-page-body .ast-snmp-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    margin-bottom: 6px !important;
}

body.ast-device-page-body .ast-device-summary-grid {
    width: 68% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    margin-bottom: 6px !important;
}

body.ast-device-page-body .ast-device-summary-card {
    padding: 6px 8px !important;
    border-radius: 10px !important;
    min-height: 48px !important;
}

body.ast-device-page-body .ast-device-summary-card .summary-card-title,
body.ast-device-page-body .ast-device-summary-card .summary-card-subtitle {
    font-size: 9px !important;
    line-height: 1.05 !important;
}

body.ast-device-page-body .ast-device-summary-card .summary-card-value {
    font-size: 13px !important;
    line-height: 1.1 !important;
}

body.ast-device-page-body .ast-snmp-values-details > summary {
    padding: 6px 9px !important;
    border-radius: 10px !important;
    font-size: 11px !important;
}

/* Графики ближе к верхнему блоку */
body.ast-device-page-body .graphs-card {
    margin-top: 8px !important;
}

/* Средний экран */
@media (max-width: 1180px) {
    body.ast-device-page-body .ast-device-top-grid {
        width: 84% !important;
        grid-template-columns: 60% 38% !important;
        column-gap: 10px !important;
    }

    body.ast-device-page-body .ast-device-overview-body,
    body.ast-device-page-body .ast-device-title-wrap {
        width: 58% !important;
    }
}

/* Узкий экран */
@media (max-width: 860px) {
    body.ast-device-page-body .ast-device-top-grid {
        width: 100% !important;
        grid-template-columns: 1fr !important;
    }

    body.ast-device-page-body .ast-device-overview-body,
    body.ast-device-page-body .ast-device-title-wrap,
    body.ast-device-page-body .ast-device-summary-grid {
        width: 100% !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
        grid-template-columns: 34px minmax(0, 1fr) !important;
    }
}

@media (max-width: 560px) {
    body.ast-device-page-body .ast-device-mini-grid,
    body.ast-device-page-body .ast-snmp-profile-grid,
    body.ast-device-page-body .ast-device-summary-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== AST device card compact inner tiles =====
   Сначала плотно укладываем мини-плитки внутри больших плиток,
   потом уменьшаем сами большие плитки.
   Размеры основных блоков — в процентах, gap — в rem. */

body.ast-device-page-body .ast-device-top-card {
    padding: 0.65rem !important;
    margin-bottom: 0.65rem !important;
}

/* Внешняя пара плиток: компактно слева, без растягивания на всю страницу */
body.ast-device-page-body .ast-device-top-grid {
    width: 64% !important;
    display: grid !important;
    grid-template-columns: 58% 40% !important;
    column-gap: 0.7rem !important;
    row-gap: 0.7rem !important;
    justify-content: start !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-overview-tile,
body.ast-device-page-body .ast-device-snmp-tile {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0.55rem !important;
    border-radius: 0.8rem !important;
}

/* Внутренности левой плитки больше НЕ зажимаем в 52-54% */
body.ast-device-page-body .ast-device-title-wrap,
body.ast-device-page-body .ast-device-overview-body,
body.ast-device-page-body .ast-device-inline-type-card,
body.ast-device-page-body .ast-device-badge-below-grid {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* Шапка компактнее */
body.ast-device-page-body .ast-device-tile-head {
    gap: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}

body.ast-device-page-body .ast-device-top-card h1 {
    margin-bottom: 0.15rem !important;
    font-size: clamp(1.35rem, 1.75vw, 1.75rem) !important;
    line-height: 1.03 !important;
}

body.ast-device-page-body .ast-device-top-card h2 {
    font-size: 1rem !important;
    line-height: 1.08 !important;
}

body.ast-device-page-body .ast-device-top-card .portal-page-kicker {
    margin-bottom: 0.1rem !important;
    font-size: 0.62rem !important;
    line-height: 1.02 !important;
}

body.ast-device-page-body .ast-device-top-card .muted {
    font-size: 0.72rem !important;
    line-height: 1.12 !important;
}

body.ast-device-page-body .ast-device-top-card .ast-device-status-pill {
    padding: 0.34rem 0.6rem !important;
    font-size: 0.78rem !important;
    line-height: 1 !important;
}

/* Тип устройства — компактно под техническим именем */
body.ast-device-page-body .ast-device-inline-type-card {
    margin-top: 0.45rem !important;
    padding: 0.42rem 0.5rem !important;
    border-radius: 0.65rem !important;
}

body.ast-device-page-body .ast-device-panel-title {
    margin-bottom: 0.32rem !important;
    font-size: 0.7rem !important;
    line-height: 1.05 !important;
}

body.ast-device-page-body .ast-device-type-form {
    display: grid !important;
    grid-template-columns: 68% 30% !important;
    gap: 0.35rem !important;
    align-items: center !important;
    margin: 0 !important;
}

body.ast-device-page-body .ast-device-type-select,
body.ast-device-page-body .ast-device-type-submit {
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
    font-size: 0.76rem !important;
}

/* Главное: мини-плитки левого блока раскладываем плотной сеткой 3 колонки */
body.ast-device-page-body .ast-device-mini-grid {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.38rem !important;
    justify-content: stretch !important;
    align-items: stretch !important;
    margin-top: 0.45rem !important;
}

body.ast-device-page-body .ast-device-mini-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    padding: 0.4rem 0.48rem !important;
    border-radius: 0.62rem !important;
}

body.ast-device-page-body .ast-device-mini-card-wide {
    grid-column: 1 / -1 !important;
}

body.ast-device-page-body .ast-device-mini-card span {
    margin-bottom: 0.14rem !important;
    font-size: 0.55rem !important;
    line-height: 1.02 !important;
}

body.ast-device-page-body .ast-device-mini-card strong {
    font-size: 0.76rem !important;
    line-height: 1.08 !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
}

/* Бейдж — под комментарием, компактно */
body.ast-device-page-body .ast-device-badge-below-grid {
    margin-top: 0.45rem !important;
    padding: 0.42rem !important;
    border-radius: 0.65rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-title {
    margin-bottom: 0.32rem !important;
    font-size: 0.74rem !important;
    line-height: 1.05 !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
    display: grid !important;
    grid-template-columns: 10% 88% !important;
    gap: 0.35rem !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
    width: 100% !important;
    max-width: 1.9rem !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-select {
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    font-size: 0.76rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-actions {
    margin-top: 0.32rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-save-btn {
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    font-size: 0.76rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-hint {
    margin-top: 0.28rem !important;
    font-size: 0.62rem !important;
    line-height: 1.08 !important;
}

/* SNMP: профиль плотный, сводка в 3 колонки */
body.ast-device-page-body .ast-snmp-profile-grid {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.38rem !important;
    margin-bottom: 0.38rem !important;
}

body.ast-device-page-body .ast-device-summary-grid {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.38rem !important;
    margin-bottom: 0.38rem !important;
}

body.ast-device-page-body .ast-device-summary-card {
    min-height: 0 !important;
    padding: 0.4rem 0.48rem !important;
    border-radius: 0.62rem !important;
}

body.ast-device-page-body .ast-device-summary-card .summary-card-title,
body.ast-device-page-body .ast-device-summary-card .summary-card-subtitle {
    font-size: 0.55rem !important;
    line-height: 1.02 !important;
}

body.ast-device-page-body .ast-device-summary-card .summary-card-value {
    font-size: 0.8rem !important;
    line-height: 1.08 !important;
}

body.ast-device-page-body .ast-snmp-values-details > summary {
    padding: 0.36rem 0.55rem !important;
    font-size: 0.72rem !important;
    border-radius: 0.62rem !important;
}

/* Средний экран */
@media (max-width: 1180px) {
    body.ast-device-page-body .ast-device-top-grid {
        width: 82% !important;
        grid-template-columns: 58% 40% !important;
    }
}

/* Узкий экран */
@media (max-width: 860px) {
    body.ast-device-page-body .ast-device-top-grid {
        width: 100% !important;
        grid-template-columns: 1fr !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
        grid-template-columns: 1.9rem minmax(0, 1fr) !important;
    }
}

@media (max-width: 620px) {
    body.ast-device-page-body .ast-device-mini-grid,
    body.ast-device-page-body .ast-snmp-profile-grid,
    body.ast-device-page-body .ast-device-summary-grid,
    body.ast-device-page-body .ast-device-type-form {
        grid-template-columns: 1fr !important;
    }
}

/* ===== AST device status colored pill override =====
   ONLINE: green fill + darker green border
   OFFLINE: red fill + darker red border
   UNKNOWN: neutral fill */

body.ast-device-page-body .ast-device-status-pill {
    border-width: 1px !important;
    border-style: solid !important;
    font-weight: 800 !important;
    letter-spacing: 0.01em !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.20) !important;
}

/* ONLINE */
body.ast-device-page-body .ast-device-status-online {
    color: #0f5132 !important;
    background: linear-gradient(180deg, #d8ffea 0%, #c2f7da 100%) !important;
    border-color: #34c77b !important;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.24),
        0 0 0 1px rgba(52,199,123,0.12) !important;
}

/* OFFLINE */
body.ast-device-page-body .ast-device-status-offline {
    color: #8c1d35 !important;
    background: linear-gradient(180deg, #ffdce2 0%, #ffc6d0 100%) !important;
    border-color: #f15b78 !important;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.22),
        0 0 0 1px rgba(241,91,120,0.14) !important;
}

/* UNKNOWN / fallback */
body.ast-device-page-body .ast-device-status-unknown {
    color: #5f5a78 !important;
    background: linear-gradient(180deg, #f5f2ff 0%, #ebe6ff 100%) !important;
    border-color: #b8a8ff !important;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.22),
        0 0 0 1px rgba(184,168,255,0.12) !important;
}

/* ===== AST SNMP details online/offline indicator =====
   Маленький индикатор рядом с "Подробные SNMP-значения".
   Цвет зависит от статуса устройства. */

body.ast-device-page-body .ast-snmp-values-details > summary {
    align-items: center !important;
    gap: 0.45rem !important;
}

body.ast-device-page-body .ast-snmp-values-details > summary::after {
    content: "" !important;
    display: inline-block !important;
    flex: 0 0 auto !important;
    width: 0.62rem !important;
    height: 0.62rem !important;
    border-radius: 999px !important;
    border: 1px solid #9b8cff !important;
    background: #ebe6ff !important;
    box-shadow: 0 0 0 2px rgba(155, 140, 255, 0.12) !important;
}

/* ONLINE — зелёная точка с более тёмным ободком */
body.ast-device-page-body .ast-snmp-values-status-online > summary::after {
    border-color: #159957 !important;
    background: #35d07f !important;
    box-shadow:
        0 0 0 2px rgba(53, 208, 127, 0.16),
        0 0 8px rgba(53, 208, 127, 0.28) !important;
}

/* OFFLINE / DOWN — красная точка с более тёмным ободком */
body.ast-device-page-body .ast-snmp-values-status-offline > summary::after,
body.ast-device-page-body .ast-snmp-values-status-down > summary::after {
    border-color: #b4233c !important;
    background: #ff5c78 !important;
    box-shadow:
        0 0 0 2px rgba(255, 92, 120, 0.16),
        0 0 8px rgba(255, 92, 120, 0.26) !important;
}

/* ===== AST SNMP details close button ===== */
body.ast-device-page-body .ast-snmp-details-actions {
    margin-top: 0.55rem !important;
    display: flex !important;
    justify-content: flex-start !important;
}

body.ast-device-page-body .ast-snmp-details-close {
    min-height: 2rem !important;
    height: 2rem !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 999px !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
}

/* ===== AST device vendor badge bigger override =====
   Увеличиваем бейдж вендора внутри плитки за счёт сокращения поля выбора. */

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
    display: grid !important;
    grid-template-columns: 4.6rem minmax(0, 1fr) !important;
    gap: 0.55rem !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview,
body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-box {
    width: 4.6rem !important;
    height: 4.6rem !important;
    min-width: 4.6rem !important;
    min-height: 4.6rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
    width: 4.25rem !important;
    max-width: 4.25rem !important;
    height: 4.25rem !important;
    max-height: 4.25rem !important;
    object-fit: contain !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-controls {
    min-width: 0 !important;
    max-width: 100% !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-select {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    font-size: 0.76rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-save-btn {
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    font-size: 0.76rem !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

/* На совсем узких экранах не ломаем плитку */
@media (max-width: 560px) {
    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
        grid-template-columns: 3.8rem minmax(0, 1fr) !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview,
    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-box {
        width: 3.8rem !important;
        height: 3.8rem !important;
        min-width: 3.8rem !important;
        min-height: 3.8rem !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
        width: 3.45rem !important;
        max-width: 3.45rem !important;
        height: 3.45rem !important;
        max-height: 3.45rem !important;
    }
}

/* ===== AST device vendor badge EVEN BIGGER override =====
   Бейдж крупнее, поле выбора короче. */

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
    display: grid !important;
    grid-template-columns: 6rem minmax(0, 1fr) !important;
    gap: 0.65rem !important;
    align-items: start !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview,
body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-box {
    width: 6rem !important;
    height: 6rem !important;
    min-width: 6rem !important;
    min-height: 6rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
    width: 5.55rem !important;
    max-width: 5.55rem !important;
    height: 5.55rem !important;
    max-height: 5.55rem !important;
    object-fit: contain !important;
}

/* Сокращаем именно поле выбора бейджа */
body.ast-device-page-body .ast-device-badge-card .ast-device-icon-select {
    width: 72% !important;
    max-width: 72% !important;
    min-width: 8rem !important;
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    font-size: 0.76rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-actions {
    margin-top: 0.35rem !important;
}

body.ast-device-page-body .ast-device-badge-card .ast-device-icon-save-btn {
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    font-size: 0.76rem !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

/* Подсказку оставляем компактной, чтобы крупный бейдж не раздувал плитку */
body.ast-device-page-body .ast-device-badge-card .ast-device-icon-hint {
    max-width: 72% !important;
    margin-top: 0.3rem !important;
    font-size: 0.62rem !important;
    line-height: 1.08 !important;
}

/* На узких экранах уменьшаем, чтобы не ломалось */
@media (max-width: 560px) {
    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-layout {
        grid-template-columns: 4.4rem minmax(0, 1fr) !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview,
    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-box {
        width: 4.4rem !important;
        height: 4.4rem !important;
        min-width: 4.4rem !important;
        min-height: 4.4rem !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-preview-img {
        width: 4rem !important;
        max-width: 4rem !important;
        height: 4rem !important;
        max-height: 4rem !important;
    }

    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-select,
    body.ast-device-page-body .ast-device-badge-card .ast-device-icon-hint {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* AST DEVICE DIAGNOSTICS CSS START 2026-04-27 */
body.ast-device-page-body .ast-device-diagnostics-card {
    margin-top: 18px;
}

body.ast-device-page-body .ast-device-diagnostics-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

body.ast-device-page-body .ast-device-diagnostics-head h2 {
    margin: 0 0 5px;
}

body.ast-device-page-body .ast-device-diagnostics-subtitle {
    margin: 0;
}

body.ast-device-page-body .ast-device-diagnostics-profile {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--ast-border);
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

body.ast-device-page-body .ast-device-diagnostics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 12px;
}

body.ast-device-page-body .ast-device-diagnostics-widget {
    border: 1px solid var(--ast-border);
    border-radius: 16px;
    background: var(--ast-card-bg);
    box-shadow: var(--ast-shadow);
    padding: 14px;
    min-width: 0;
}

body.ast-device-page-body .ast-device-diagnostics-widget-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

body.ast-device-page-body .ast-device-diagnostics-widget h3 {
    margin: 0;
    color: var(--ast-title);
    font-size: 16px;
    line-height: 1.25;
}

body.ast-device-page-body .ast-device-diagnostics-widget-desc {
    margin: 0 0 10px;
    line-height: 1.4;
}

body.ast-device-page-body .ast-device-diagnostics-widget-body {
    min-width: 0;
}

body.ast-device-page-body .ast-device-diagnostics-placeholder {
    border: 1px dashed var(--ast-border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--ast-panel-bg);
    line-height: 1.45;
}

body.ast-device-page-body .ast-device-diagnostics-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--ast-border);
    background: var(--ast-panel-bg);
    color: var(--ast-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

body.ast-device-page-body .ast-device-diagnostics-badge-enabled,
body.ast-device-page-body .ast-device-diagnostics-badge-ok,
body.ast-device-page-body .ast-device-diagnostics-badge-up {
    border-color: var(--ast-status-ok-border, var(--ast-border));
    background: var(--ast-status-ok-bg, var(--ast-panel-bg));
    color: var(--ast-status-ok-text, var(--ast-title));
}

body.ast-device-page-body .ast-device-diagnostics-badge-warn {
    border-color: var(--ast-status-warning-border, var(--ast-border));
    background: var(--ast-status-warning-bg, var(--ast-panel-bg));
    color: var(--ast-status-warning-text, var(--ast-title));
}

body.ast-device-page-body .ast-device-diagnostics-badge-crit,
body.ast-device-page-body .ast-device-diagnostics-badge-down,
body.ast-device-page-body .ast-device-diagnostics-badge-disabled {
    border-color: var(--ast-status-critical-border, var(--ast-border));
    background: var(--ast-status-critical-bg, var(--ast-panel-bg));
    color: var(--ast-status-critical-text, var(--ast-title));
}

body.ast-device-page-body .ast-device-diagnostics-badge-no_data {
    opacity: 0.72;
}

body.ast-device-page-body .ast-device-diagnostics-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
    margin: 10px 0 12px;
}

body.ast-device-page-body .ast-device-diagnostics-cache {
    margin: 0 0 10px;
    font-size: 12px;
}

body.ast-device-page-body .ast-device-diagnostics-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--ast-border);
    border-radius: 14px;
    background: var(--ast-card-bg);
}

body.ast-device-page-body .ast-device-diagnostics-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

body.ast-device-page-body .ast-device-diagnostics-table th,
body.ast-device-page-body .ast-device-diagnostics-table td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--ast-border);
    color: var(--ast-text);
    text-align: left;
    font-size: 13px;
}

body.ast-device-page-body .ast-device-diagnostics-table th {
    background: var(--ast-table-head-bg);
    color: var(--ast-title);
    font-weight: 800;
}

body.ast-device-page-body .ast-device-diagnostics-table tr:last-child td {
    border-bottom: 0;
}

body.ast-device-page-body .ast-device-diagnostics-error {
    margin: 10px 0;
}

@media (max-width: 980px) {
    body.ast-device-page-body .ast-device-diagnostics-grid {
        grid-template-columns: 1fr;
    }

    body.ast-device-page-body .ast-device-diagnostics-summary {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 560px) {
    body.ast-device-page-body .ast-device-diagnostics-head {
        flex-direction: column;
    }

    body.ast-device-page-body .ast-device-diagnostics-profile {
        white-space: normal;
    }

    body.ast-device-page-body .ast-device-diagnostics-summary {
        grid-template-columns: 1fr;
    }
}
/* AST DEVICE DIAGNOSTICS CSS END 2026-04-27 */

/* AST GRAPH BULK CONTROLS CSS START 2026-04-27 */
body.ast-device-page-body .graph-bulk-controls {
    margin: 12px 0 14px;
    padding: 12px;
    border: 1px solid var(--ast-border);
    border-radius: 14px;
    background: var(--ast-panel-bg);
}

body.ast-device-page-body .graph-bulk-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

body.ast-device-page-body .graph-bulk-btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

body.ast-device-page-body .graph-bulk-filter-row {
    display: grid;
    grid-template-columns: minmax(220px, 340px) 1fr;
    gap: 10px;
    align-items: center;
}

body.ast-device-page-body .graph-bulk-filter {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    background: var(--ast-input-bg);
    color: var(--ast-input-text);
    padding: 6px 10px;
}

body.ast-device-page-body .graph-bulk-hint,
body.ast-device-page-body .graph-bulk-counter {
    font-size: 12px;
    line-height: 1.35;
}

body.ast-device-page-body .graph-bulk-counter {
    margin-top: 8px;
}

@media (max-width: 760px) {
    body.ast-device-page-body .graph-bulk-filter-row {
        grid-template-columns: 1fr;
    }
}
/* AST GRAPH BULK CONTROLS CSS END 2026-04-27 */

/* AST MAP OPEN DEVICE CARD BUTTON START 2026-04-30
   Единая яркая кнопка открытия карточки устройства в правой панели карты.
   Работает для всех типов устройств, потому что класс добавляется к общей detailsUrl-ссылке в topology.js.
*/
.device-actions {
    margin: 12px 0 16px;
}

.device-actions .ast-open-device-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 9px 15px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 13px;
    background:
        linear-gradient(135deg, var(--ast-blue-main, #2563eb) 0%, #6d28d9 58%, #8b5cf6 100%);
    color: var(--ast-button-text-on-accent, #ffffff) !important;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
    text-decoration: none !important;
    letter-spacing: 0.01em;
    box-shadow:
        0 10px 22px rgba(109, 40, 217, 0.28),
        0 2px 5px rgba(15, 23, 42, 0.12);
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        filter 0.16s ease,
        border-color 0.16s ease;
}

.device-actions .ast-open-device-card-btn::before {
    content: "↗";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    color: inherit;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

.device-actions .ast-open-device-card-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06) saturate(1.08);
    box-shadow:
        0 14px 28px rgba(109, 40, 217, 0.34),
        0 3px 8px rgba(15, 23, 42, 0.16);
}

.device-actions .ast-open-device-card-btn:active {
    transform: translateY(0);
    box-shadow:
        0 7px 16px rgba(109, 40, 217, 0.24),
        0 2px 5px rgba(15, 23, 42, 0.12);
}

.device-actions .ast-open-device-card-btn:focus-visible {
    outline: 3px solid rgba(139, 92, 246, 0.34);
    outline-offset: 3px;
}

@media (max-width: 760px) {
    .device-actions .ast-open-device-card-btn {
        width: 100%;
    }
}
/* AST MAP OPEN DEVICE CARD BUTTON END 2026-04-30 */

/* AST MAP OPEN DEVICE CARD BUTTON HOVER FIX START 2026-04-30
   Защита от общих hover-стилей ссылок, которые перекрашивают кнопку в белый.
*/
body .device-actions .ast-open-device-card-btn,
body .device-actions .ast-open-device-card-btn:link,
body .device-actions .ast-open-device-card-btn:visited,
body .device-actions .ast-open-device-card-btn:hover,
body .device-actions .ast-open-device-card-btn:focus,
body .device-actions .ast-open-device-card-btn:active {
    background:
        linear-gradient(135deg, var(--ast-blue-main, #2563eb) 0%, #6d28d9 58%, #8b5cf6 100%) !important;
    background-color: var(--ast-blue-main, #2563eb) !important;
    color: var(--ast-button-text-on-accent, #ffffff) !important;
    border-color: rgba(255, 255, 255, 0.72) !important;
    text-decoration: none !important;
}

body .device-actions .ast-open-device-card-btn:hover {
    transform: translateY(-1px) !important;
    filter: brightness(1.06) saturate(1.08) !important;
    box-shadow:
        0 14px 28px rgba(109, 40, 217, 0.34),
        0 3px 8px rgba(15, 23, 42, 0.16) !important;
}

body .device-actions .ast-open-device-card-btn:hover::before,
body .device-actions .ast-open-device-card-btn:focus::before,
body .device-actions .ast-open-device-card-btn:active::before {
    background: rgba(255, 255, 255, 0.22) !important;
    color: inherit !important;
}
/* AST MAP OPEN DEVICE CARD BUTTON HOVER FIX END 2026-04-30 */

/* AST INCIDENTS PAGE CSS START 2026-04-30 */
body.ast-incidents-page-body .ast-incidents-page {
    display: grid;
    gap: 16px;
}

body.ast-incidents-page-body .ast-incident-flash {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--ast-border);
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    font-weight: 700;
}

body.ast-incidents-page-body .ast-incident-flash-ok {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.12);
}

body.ast-incidents-page-body .ast-incident-flash-bad {
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.13);
}

body.ast-incidents-page-body .ast-incidents-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

body.ast-incidents-page-body .ast-incidents-summary-grid > div {
    padding: 14px;
    border: 1px solid var(--ast-border);
    border-radius: 16px;
    background: var(--ast-card-bg, var(--ast-panel-bg));
}

body.ast-incidents-page-body .ast-incidents-summary-grid span {
    display: block;
    color: var(--ast-muted);
    font-size: 12px;
    margin-bottom: 7px;
}

body.ast-incidents-page-body .ast-incidents-summary-grid strong {
    display: block;
    color: var(--ast-title);
    font-size: 28px;
    line-height: 1;
}

body.ast-incidents-page-body .ast-incidents-summary-grid .is-bad {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.13);
}

body.ast-incidents-page-body .ast-incidents-summary-grid .is-warn {
    border-color: rgba(245, 158, 11, 0.65);
    background: rgba(245, 158, 11, 0.14);
}

body.ast-incidents-page-body .ast-incidents-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

body.ast-incidents-page-body .ast-incident-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--ast-border);
    border-radius: 18px;
    background: var(--ast-card-bg, var(--ast-panel-bg));
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body.ast-incidents-page-body .ast-incident-status-active {
    border-color: rgba(239, 68, 68, 0.72);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16), 0 12px 28px rgba(127, 29, 29, 0.16);
}

body.ast-incidents-page-body .ast-incident-status-recovered_unacked {
    border-color: rgba(245, 158, 11, 0.75);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.16), 0 12px 28px rgba(146, 64, 14, 0.12);
}

body.ast-incidents-page-body .ast-incident-status-closed {
    opacity: 0.84;
}

body.ast-incidents-page-body .ast-incident-topline,
body.ast-incidents-page-body .ast-incident-device {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

body.ast-incidents-page-body .ast-incident-topline {
    margin-bottom: 8px;
}

body.ast-incidents-page-body .ast-incident-card h2 {
    margin: 0 0 8px;
    color: var(--ast-title);
    font-size: 19px;
}

body.ast-incidents-page-body .ast-incident-device {
    color: var(--ast-muted);
    font-size: 13px;
    margin-bottom: 12px;
}

body.ast-incidents-page-body .ast-incident-device strong {
    color: var(--ast-title);
}

body.ast-incidents-page-body .ast-incident-severity-badge,
body.ast-incidents-page-body .ast-incident-status-badge,
body.ast-incidents-page-body .ast-incident-core-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

body.ast-incidents-page-body .ast-incident-severity-badge {
    background: rgba(239, 68, 68, 0.16);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.42);
}

body.ast-incidents-page-body .ast-incident-severity-warning .ast-incident-severity-badge {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.48);
}

body.ast-incidents-page-body .ast-incident-status-badge {
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    border: 1px solid var(--ast-border);
}

body.ast-incidents-page-body .ast-incident-core-badge {
    background: rgba(59, 130, 246, 0.13);
    color: var(--ast-blue-main, #2563eb);
    border: 1px solid rgba(59, 130, 246, 0.32);
}

body.ast-incidents-page-body .ast-incident-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 8px;
}

body.ast-incidents-page-body .ast-incident-grid > div {
    padding: 9px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-panel-bg);
}

body.ast-incidents-page-body .ast-incident-grid span {
    display: block;
    color: var(--ast-muted);
    font-size: 11px;
    margin-bottom: 5px;
}

body.ast-incidents-page-body .ast-incident-grid strong {
    display: block;
    color: var(--ast-title);
    font-size: 12px;
    word-break: break-word;
}

body.ast-incidents-page-body .ast-incident-message {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    font-size: 13px;
}

body.ast-incidents-page-body .ast-incident-events {
    margin-top: 10px;
}

body.ast-incidents-page-body .ast-incident-events summary {
    cursor: pointer;
    color: var(--ast-title);
    font-weight: 800;
}

body.ast-incidents-page-body .ast-incident-events-list {
    display: grid;
    gap: 7px;
    margin-top: 8px;
}

body.ast-incidents-page-body .ast-incident-event {
    display: grid;
    grid-template-columns: 150px 110px 1fr;
    gap: 8px;
    padding: 8px;
    border-radius: 10px;
    background: var(--ast-panel-bg);
    color: var(--ast-muted);
    font-size: 12px;
}

body.ast-incidents-page-body .ast-incident-event strong {
    color: var(--ast-title);
}

body.ast-incidents-page-body .ast-incident-event em {
    font-style: normal;
}

body.ast-incidents-page-body .ast-incident-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

body.ast-incidents-page-body .ast-incident-ack-form {
    display: grid;
    gap: 8px;
}

body.ast-incidents-page-body .ast-incident-ack-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 56px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-input-bg, var(--ast-panel-bg));
    color: var(--ast-input-text, var(--ast-title));
    padding: 8px 10px;
}

body.ast-incidents-page-body .ast-incident-ack-btn {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
    border-color: rgba(22, 163, 74, 0.75) !important;
    color: #ffffff !important;
}

body.ast-incidents-page-body .ast-incident-ack-btn-disabled {
    cursor: not-allowed;
    opacity: 0.72;
    background: rgba(239, 68, 68, 0.16) !important;
    border-color: rgba(239, 68, 68, 0.42) !important;
    color: var(--ast-title) !important;
}

body.ast-incidents-page-body .ast-incident-action-hint,
body.ast-incidents-page-body .ast-incident-closed-by {
    color: var(--ast-muted);
    font-size: 12px;
    line-height: 1.35;
}

@media (max-width: 980px) {
    body.ast-incidents-page-body .ast-incident-card {
        grid-template-columns: 1fr;
    }

    body.ast-incidents-page-body .ast-incident-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    body.ast-incidents-page-body .ast-incidents-summary-grid {
        grid-template-columns: 1fr;
    }

    body.ast-incidents-page-body .ast-incident-event {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    body.ast-incidents-page-body .ast-incident-grid {
        grid-template-columns: 1fr;
    }
}
/* AST INCIDENTS PAGE CSS END 2026-04-30 */

/* AST MAP STICKY INCIDENT CSS START 2026-04-30 */
.ast-map-sticky-incident-box {
    margin: 10px 0 12px;
    padding: 11px;
    border: 1px solid rgba(239, 68, 68, 0.58);
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.13);
    box-shadow: 0 8px 20px rgba(127, 29, 29, 0.13);
}

.ast-map-sticky-incident-title {
    color: var(--ast-title);
    font-weight: 900;
    font-size: 13px;
    margin-bottom: 4px;
}

.ast-map-sticky-incident-subtitle {
    color: var(--ast-muted);
    font-size: 12px;
    line-height: 1.35;
}

.ast-map-sticky-incident-list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.ast-map-sticky-incident-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 7px;
    align-items: center;
    padding: 7px 8px;
    border-radius: 10px;
    background: var(--ast-panel-bg);
    border: 1px solid rgba(239, 68, 68, 0.24);
    font-size: 12px;
}

.ast-map-sticky-incident-row strong {
    color: var(--ast-title);
}

.ast-map-sticky-incident-row span {
    color: #b91c1c;
    font-weight: 800;
}

.ast-map-sticky-incident-row em {
    color: var(--ast-muted);
    font-style: normal;
}

.ast-map-sticky-incident-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 9px;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 10px;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%) !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 900;
}
/* AST MAP STICKY INCIDENT CSS END 2026-04-30 */

/* AST INCIDENTS COMPACT PAGE CSS START 2026-04-30 */
body.ast-incidents-page-body .ast-incidents-page-compact {
    display: grid;
    gap: 12px;
}

body.ast-incidents-page-body .ast-incidents-summary-compact {
    padding: 12px;
}

body.ast-incidents-page-body .ast-incidents-summary-compact .ast-incidents-summary-grid {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 0;
}

body.ast-incidents-page-body .ast-incidents-summary-compact .ast-incidents-summary-grid > div {
    padding: 10px 12px;
    border-radius: 13px;
}

body.ast-incidents-page-body .ast-incidents-summary-compact .ast-incidents-summary-grid strong {
    font-size: 22px;
}

body.ast-incidents-page-body .ast-incidents-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

body.ast-incidents-page-body .ast-incidents-section-head h2 {
    margin: 0;
}

body.ast-incidents-page-body .ast-incidents-section-head span {
    color: var(--ast-muted);
    font-size: 13px;
    font-weight: 800;
}

body.ast-incidents-page-body .ast-incidents-compact-list {
    display: grid;
    gap: 7px;
}

body.ast-incidents-page-body .ast-incident-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 230px;
    gap: 10px;
    align-items: stretch;
    padding: 9px;
    border: 1px solid var(--ast-border);
    border-radius: 15px;
    background: var(--ast-card-bg, var(--ast-panel-bg));
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

body.ast-incidents-page-body .ast-incident-row.ast-incident-status-active {
    border-color: rgba(239, 68, 68, 0.58);
}

body.ast-incidents-page-body .ast-incident-row.ast-incident-status-recovered_unacked {
    border-color: rgba(245, 158, 11, 0.62);
}

body.ast-incidents-page-body .ast-incident-row.ast-incident-status-closed {
    opacity: 0.82;
}

body.ast-incidents-page-body .ast-incident-row-sla {
    position: relative;
    display: grid;
    grid-template-columns: 16px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 7px;
    align-content: center;
    min-height: 70px;
    padding: 8px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-panel-bg);
    overflow: hidden;
}

body.ast-incidents-page-body .ast-incident-row-sla .sla-dot {
    grid-row: 1 / 3;
    width: 11px;
    height: 11px;
    margin-top: 3px;
    border-radius: 50%;
    background: var(--ast-muted);
}

body.ast-incidents-page-body .ast-incident-row-sla strong {
    color: var(--ast-title);
    font-size: 12px;
    line-height: 1.25;
}

body.ast-incidents-page-body .ast-incident-row-sla em {
    color: var(--ast-muted);
    font-style: normal;
    font-size: 11px;
}

body.ast-incidents-page-body .ast-incident-row-sla i {
    grid-column: 1 / -1;
    display: block;
    height: 5px;
    margin-top: 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
    overflow: hidden;
}

body.ast-incidents-page-body .ast-incident-row-sla i::before {
    content: "";
    display: block;
    width: var(--sla-left, 0%);
    height: 100%;
    border-radius: inherit;
    background: currentColor;
}

body.ast-incidents-page-body .ast-incident-row-sla.sla-ok {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.35);
}

body.ast-incidents-page-body .ast-incident-row-sla.sla-warning {
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.52);
    background: rgba(245, 158, 11, 0.09);
}

body.ast-incidents-page-body .ast-incident-row-sla.sla-overdue {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.62);
    background: rgba(239, 68, 68, 0.11);
}

body.ast-incidents-page-body .ast-incident-row-sla.sla-closed {
    color: var(--ast-muted);
    opacity: 0.82;
}

body.ast-incidents-page-body .sla-ok .sla-dot,
body.ast-incidents-page-body .sla-warning .sla-dot,
body.ast-incidents-page-body .sla-overdue .sla-dot,
body.ast-incidents-page-body .sla-closed .sla-dot {
    background: currentColor;
}

body.ast-incidents-page-body .ast-incident-row-main {
    min-width: 0;
    display: grid;
    gap: 5px;
}

body.ast-incidents-page-body .ast-incident-row-line {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

body.ast-incidents-page-body .ast-pill {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid var(--ast-border);
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

body.ast-incidents-page-body .ast-pill-category {
    color: var(--ast-blue-main, #2563eb);
    border-color: rgba(59, 130, 246, 0.28);
    background: rgba(59, 130, 246, 0.10);
}

body.ast-incidents-page-body .ast-incident-category-highest .ast-pill-category {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.44);
    background: rgba(239, 68, 68, 0.12);
}

body.ast-incidents-page-body .ast-incident-category-medium .ast-pill-category {
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.44);
    background: rgba(245, 158, 11, 0.12);
}

body.ast-incidents-page-body .ast-pill-work {
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.34);
    background: rgba(22, 163, 74, 0.10);
}

body.ast-incidents-page-body .ast-pill-severity {
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(239, 68, 68, 0.10);
}

body.ast-incidents-page-body .ast-pill-core {
    color: var(--ast-blue-main, #2563eb);
    border-color: rgba(59, 130, 246, 0.34);
    background: rgba(59, 130, 246, 0.10);
}

body.ast-incidents-page-body .ast-incident-row-title {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: baseline;
}

body.ast-incidents-page-body .ast-incident-row-title strong {
    color: var(--ast-title);
    font-size: 14px;
}

body.ast-incidents-page-body .ast-incident-row-title span {
    color: var(--ast-muted);
    font-size: 12px;
}

body.ast-incidents-page-body .ast-incident-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    color: var(--ast-muted);
    font-size: 11px;
}

body.ast-incidents-page-body .ast-incident-row-meta b {
    color: var(--ast-title);
}

body.ast-incidents-page-body .ast-incident-row-message {
    color: var(--ast-title);
    font-size: 12px;
}

body.ast-incidents-page-body .ast-incident-row-events {
    font-size: 11px;
    color: var(--ast-muted);
}

body.ast-incidents-page-body .ast-incident-row-events summary {
    cursor: pointer;
    color: var(--ast-title);
    font-weight: 800;
}

body.ast-incidents-page-body .ast-incident-row-events div {
    display: grid;
    grid-template-columns: 75px 115px 1fr;
    gap: 7px;
    padding: 5px 0;
    border-top: 1px solid var(--ast-border);
}

body.ast-incidents-page-body .ast-incident-row-events strong {
    color: var(--ast-title);
}

body.ast-incidents-page-body .ast-incident-row-events em {
    font-style: normal;
}

body.ast-incidents-page-body .ast-incident-row-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    align-content: start;
}

body.ast-incidents-page-body .ast-incident-row-actions .btn {
    width: 100%;
    min-height: 30px;
    padding: 6px 9px;
    font-size: 12px;
}

body.ast-incidents-page-body .ast-incident-row-actions form {
    margin: 0;
}

body.ast-incidents-page-body .ast-incident-work-btn {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
    border-color: rgba(79, 70, 229, 0.55) !important;
    color: #ffffff !important;
}

body.ast-incidents-page-body .ast-incident-inline-form {
    display: grid;
    gap: 5px;
}

body.ast-incidents-page-body .ast-incident-inline-form input {
    width: 100%;
    min-height: 30px;
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    padding: 5px 8px;
    background: var(--ast-input-bg, var(--ast-panel-bg));
    color: var(--ast-input-text, var(--ast-title));
    font-size: 12px;
}

body.ast-incidents-page-body .ast-incident-closed-by {
    color: var(--ast-muted);
    font-size: 11px;
    line-height: 1.3;
}

@media (max-width: 1100px) {
    body.ast-incidents-page-body .ast-incident-row {
        grid-template-columns: 1fr;
    }

    body.ast-incidents-page-body .ast-incidents-summary-compact .ast-incidents-summary-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 620px) {
    body.ast-incidents-page-body .ast-incidents-summary-compact .ast-incidents-summary-grid {
        grid-template-columns: 1fr;
    }

    body.ast-incidents-page-body .ast-incident-row-events div {
        grid-template-columns: 1fr;
    }
}
/* AST INCIDENTS COMPACT PAGE CSS END 2026-04-30 */

/* AST INCIDENTS ONE LINE CSS START 2026-04-30 */
body.ast-incidents-one-line-body .ast-incidents-one-line-page {
    display: grid;
    gap: 8px;
}

body.ast-incidents-one-line-body .ast-incidents-one-line-summary,
body.ast-incidents-one-line-body .ast-incidents-one-line-section {
    padding: 8px 10px !important;
}

body.ast-incidents-one-line-body .ast-incidents-mini-counters {
    display: grid;
    grid-template-columns: repeat(5, minmax(90px, 1fr));
    gap: 6px;
}

body.ast-incidents-one-line-body .ast-incidents-mini-counters > div {
    padding: 6px 8px;
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    background: var(--ast-card-bg, var(--ast-panel-bg));
}

body.ast-incidents-one-line-body .ast-incidents-mini-counters span {
    display: block;
    color: var(--ast-muted);
    font-size: 10px;
    line-height: 1.1;
}

body.ast-incidents-one-line-body .ast-incidents-mini-counters strong {
    display: block;
    color: var(--ast-title);
    font-size: 18px;
    line-height: 1;
    margin-top: 2px;
}

body.ast-incidents-one-line-body .ast-incidents-mini-counters .is-bad {
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.10);
}

body.ast-incidents-one-line-body .ast-incidents-mini-counters .is-warn {
    border-color: rgba(245, 158, 11, 0.55);
    background: rgba(245, 158, 11, 0.10);
}

body.ast-incidents-one-line-body .ast-incidents-one-line-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

body.ast-incidents-one-line-body .ast-incidents-one-line-head h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1.1;
}

body.ast-incidents-one-line-body .ast-incidents-one-line-head span {
    color: var(--ast-muted);
    font-size: 11px;
    font-weight: 800;
}

body.ast-incidents-one-line-body .ast-incident-lines {
    display: grid;
    gap: 3px;
}

body.ast-incidents-one-line-body .ast-incident-line {
    display: grid;
    grid-template-columns: 42px 124px 218px minmax(220px, 1.2fr) 138px 128px 190px;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 4px 5px;
    border: 1px solid var(--ast-border);
    border-radius: 9px;
    background: var(--ast-card-bg, var(--ast-panel-bg));
    box-shadow: none;
}

body.ast-incidents-one-line-body .ast-incident-line-status-active {
    border-color: rgba(239, 68, 68, 0.55);
}

body.ast-incidents-one-line-body .ast-incident-line-status-recovered_unacked {
    border-color: rgba(245, 158, 11, 0.58);
}

body.ast-incidents-one-line-body .ast-incident-line-id {
    color: var(--ast-muted);
    font-size: 11px;
    font-weight: 900;
}

body.ast-incidents-one-line-body .ast-incident-line-sla {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    color: var(--ast-muted);
    font-size: 10.5px;
    font-weight: 900;
    white-space: nowrap;
}

body.ast-incidents-one-line-body .ast-incident-line-sla span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

body.ast-incidents-one-line-body .ast-incident-line-sla strong {
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ast-incidents-one-line-body .ast-incident-line-sla.sla-ok {
    color: #16a34a;
}

body.ast-incidents-one-line-body .ast-incident-line-sla.sla-warning {
    color: #d97706;
}

body.ast-incidents-one-line-body .ast-incident-line-sla.sla-overdue {
    color: #dc2626;
}

body.ast-incidents-one-line-body .ast-incident-line-sla.sla-closed {
    color: var(--ast-muted);
}

body.ast-incidents-one-line-body .ast-incident-line-badges {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}

body.ast-incidents-one-line-body .ast-incident-line-badges span {
    display: inline-flex;
    align-items: center;
    min-height: 16px;
    max-width: 72px;
    padding: 2px 5px;
    border: 1px solid var(--ast-border);
    border-radius: 999px;
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    font-size: 9.5px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ast-incidents-one-line-body .ast-incident-line-cat-highest .ast-incident-line-badges span:nth-child(3) {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.36);
    background: rgba(239, 68, 68, 0.10);
}

body.ast-incidents-one-line-body .ast-incident-line-cat-medium .ast-incident-line-badges span:nth-child(3) {
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.38);
    background: rgba(245, 158, 11, 0.10);
}

body.ast-incidents-one-line-body .ast-incident-line-main {
    display: grid;
    grid-template-columns: minmax(120px, 0.85fr) minmax(120px, 1fr) auto;
    gap: 6px;
    align-items: center;
    min-width: 0;
    text-decoration: none !important;
    color: inherit !important;
}

body.ast-incidents-one-line-body .ast-incident-line-main strong,
body.ast-incidents-one-line-body .ast-incident-line-main span,
body.ast-incidents-one-line-body .ast-incident-line-main em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: normal;
}

body.ast-incidents-one-line-body .ast-incident-line-main strong {
    color: var(--ast-title);
    font-size: 11.5px;
}

body.ast-incidents-one-line-body .ast-incident-line-main span,
body.ast-incidents-one-line-body .ast-incident-line-main em {
    color: var(--ast-muted);
    font-size: 10.5px;
}

body.ast-incidents-one-line-body .ast-incident-line-values,
body.ast-incidents-one-line-body .ast-incident-line-time {
    display: flex;
    gap: 5px;
    min-width: 0;
    color: var(--ast-muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
}

body.ast-incidents-one-line-body .ast-incident-line-values b {
    color: var(--ast-title);
}

body.ast-incidents-one-line-body .ast-incident-line-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

body.ast-incidents-one-line-body .ast-incident-line-actions form {
    margin: 0;
}

body.ast-incidents-one-line-body .ast-incident-line-actions .btn {
    min-height: 22px;
    padding: 3px 6px;
    border-radius: 7px;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

body.ast-incidents-page-body .ast-incident-work-btn {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
    border-color: rgba(79, 70, 229, 0.55) !important;
    color: #ffffff !important;
}

body.ast-incident-detail-body .ast-incident-detail-page {
    display: grid;
    gap: 10px;
}

body.ast-incident-detail-body .ast-incident-detail-hero {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 270px;
    gap: 12px;
    align-items: stretch;
}

body.ast-incident-detail-body .ast-incident-detail-sla {
    display: grid;
    gap: 5px;
    align-content: center;
    padding: 10px;
    border: 1px solid var(--ast-border);
    border-radius: 14px;
    background: var(--ast-panel-bg);
    color: var(--ast-muted);
}

body.ast-incident-detail-body .ast-incident-detail-sla span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: currentColor;
}

body.ast-incident-detail-body .ast-incident-detail-sla strong {
    color: var(--ast-title);
}

body.ast-incident-detail-body .ast-incident-detail-sla.sla-ok { color: #16a34a; }
body.ast-incident-detail-body .ast-incident-detail-sla.sla-warning { color: #d97706; }
body.ast-incident-detail-body .ast-incident-detail-sla.sla-overdue { color: #dc2626; }
body.ast-incident-detail-body .ast-incident-detail-sla.sla-closed { color: var(--ast-muted); }

body.ast-incident-detail-body .ast-incident-detail-title h1 {
    margin: 0 0 5px;
    color: var(--ast-title);
}

body.ast-incident-detail-body .ast-incident-detail-title p {
    margin: 0;
    color: var(--ast-muted);
}

body.ast-incident-detail-body .ast-incident-detail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

body.ast-incident-detail-body .ast-incident-detail-pills span {
    padding: 4px 8px;
    border: 1px solid var(--ast-border);
    border-radius: 999px;
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    font-size: 12px;
    font-weight: 800;
}

body.ast-incident-detail-body .ast-incident-detail-actions {
    display: grid;
    gap: 8px;
    align-content: start;
}

body.ast-incident-detail-body .ast-incident-detail-actions form {
    display: grid;
    gap: 5px;
    margin: 0;
}

body.ast-incident-detail-body .ast-incident-detail-actions input {
    min-height: 30px;
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    padding: 5px 8px;
    background: var(--ast-input-bg, var(--ast-panel-bg));
    color: var(--ast-input-text, var(--ast-title));
}

body.ast-incident-detail-body .ast-incident-detail-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 8px;
}

body.ast-incident-detail-body .ast-incident-detail-grid > div {
    padding: 9px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-panel-bg);
}

body.ast-incident-detail-body .ast-incident-detail-grid span {
    display: block;
    color: var(--ast-muted);
    font-size: 11px;
    margin-bottom: 4px;
}

body.ast-incident-detail-body .ast-incident-detail-grid strong {
    color: var(--ast-title);
    font-size: 12px;
}

body.ast-incident-detail-body .ast-incident-detail-diagnostics p {
    color: var(--ast-muted);
    margin: 0 0 10px;
}

body.ast-incident-detail-body .ast-incident-detail-message {
    padding: 10px;
    border-radius: 12px;
    background: var(--ast-panel-bg);
    color: var(--ast-title);
}

body.ast-incident-detail-body .ast-incident-detail-event-list {
    display: grid;
    gap: 6px;
}

body.ast-incident-detail-body .ast-incident-detail-event-list > div {
    display: grid;
    grid-template-columns: 145px 130px 80px 1fr 140px;
    gap: 8px;
    padding: 7px 8px;
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    background: var(--ast-panel-bg);
    color: var(--ast-muted);
    font-size: 12px;
}

body.ast-incident-detail-body .ast-incident-detail-event-list strong {
    color: var(--ast-title);
}

body.ast-incident-detail-body .ast-incident-detail-event-list em {
    font-style: normal;
}

body.ast-incident-detail-body .ast-incident-detail-event-list p {
    margin: 0;
}

@media (max-width: 1280px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 38px 120px minmax(170px, 1fr) 120px 126px 180px;
    }

    body.ast-incidents-one-line-body .ast-incident-line-badges {
        display: none;
    }
}

@media (max-width: 900px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    body.ast-incidents-one-line-body .ast-incident-line-actions {
        justify-content: flex-start;
    }

    body.ast-incident-detail-body .ast-incident-detail-hero {
        grid-template-columns: 1fr;
    }

    body.ast-incident-detail-body .ast-incident-detail-grid {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }

    body.ast-incident-detail-body .ast-incident-detail-event-list > div {
        grid-template-columns: 1fr;
    }
}
/* AST INCIDENTS ONE LINE CSS END 2026-04-30 */

/* AST INCIDENT ARTIFACTS VIEW CSS START 2026-04-30 */
body.ast-incident-detail-body .ast-incident-artifacts-list {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

body.ast-incident-detail-body .ast-incident-artifact-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 10px;
    align-items: center;
    padding: 8px 9px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-panel-bg);
}

body.ast-incident-detail-body .ast-incident-artifact-card.is-high {
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.09);
}

body.ast-incident-detail-body .ast-incident-artifact-title {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 3px;
}

body.ast-incident-detail-body .ast-incident-artifact-title strong {
    color: var(--ast-title);
    font-size: 13px;
}

body.ast-incident-detail-body .ast-incident-artifact-title span {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #dc2626;
    font-size: 10px;
    font-weight: 900;
}

body.ast-incident-detail-body .ast-incident-artifact-name,
body.ast-incident-detail-body .ast-incident-artifact-summary,
body.ast-incident-detail-body .ast-incident-artifact-meta {
    font-size: 11px;
    line-height: 1.25;
}

body.ast-incident-detail-body .ast-incident-artifact-name {
    color: var(--ast-title);
    overflow-wrap: anywhere;
}

body.ast-incident-detail-body .ast-incident-artifact-summary {
    color: var(--ast-muted);
    margin-top: 2px;
}

body.ast-incident-detail-body .ast-incident-artifact-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--ast-muted);
    margin-top: 3px;
}

body.ast-incident-detail-body .ast-incident-artifact-actions {
    display: grid;
    gap: 5px;
}

body.ast-incident-detail-body .ast-incident-artifact-actions .btn {
    min-height: 26px;
    padding: 4px 7px;
    border-radius: 8px;
    font-size: 11px;
}

@media (max-width: 760px) {
    body.ast-incident-detail-body .ast-incident-artifact-card {
        grid-template-columns: 1fr;
    }

    body.ast-incident-detail-body .ast-incident-artifact-actions {
        grid-template-columns: 1fr 1fr;
    }
}
/* AST INCIDENT ARTIFACTS VIEW CSS END 2026-04-30 */

/* AST INCIDENT REPORT RESEARCH CSS START 2026-04-30 */
body.ast-incidents-one-line-body .ast-incidents-mini-counters {
    grid-template-columns: repeat(6, minmax(82px, 1fr));
}

body.ast-incidents-one-line-body .ast-incident-line-actions {
    flex-wrap: wrap;
}

body.ast-incidents-one-line-body .ast-incident-line-actions .btn,
body.ast-incidents-one-line-body .ast-incident-line-actions button {
    min-width: 64px;
}

body.ast-incidents-page-body .ast-incident-research-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%) !important;
    border-color: rgba(124, 58, 237, 0.55) !important;
    color: #ffffff !important;
}

body.ast-incidents-page-body .ast-incident-research-btn:hover {
    filter: brightness(1.05);
    color: #ffffff !important;
}

body.ast-incidents-page-body .sla-research,
body.ast-incident-detail-body .ast-incident-detail-sla.sla-research {
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.5);
    background: rgba(124, 58, 237, 0.09);
}

body.ast-incident-detail-body .ast-incident-artifact-report-note {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 26px;
    padding: 4px 7px;
    border-radius: 8px;
    border: 1px solid rgba(124, 58, 237, 0.25);
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

body.ast-incidents-one-line-body .ast-incident-line {
    grid-template-columns: 42px 124px 218px minmax(220px, 1.2fr) 138px 128px 230px;
}

@media (max-width: 1280px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 38px 120px minmax(170px, 1fr) 120px 126px 220px;
    }
}
/* AST INCIDENT REPORT RESEARCH CSS END 2026-04-30 */

/* AST INCIDENT RESEARCH REPORT UPLOAD CSS START 2026-04-30 */
body.ast-incident-detail-body .ast-incident-research-reports {
    display: grid;
    gap: 10px;
}

body.ast-incident-detail-body .ast-incident-research-report-list {
    display: grid;
    gap: 7px;
}

body.ast-incident-detail-body .ast-incident-research-report-list article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 10px;
    align-items: center;
    padding: 8px 9px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-panel-bg);
}

body.ast-incident-detail-body .ast-incident-research-report-list strong,
body.ast-incident-detail-body .ast-incident-research-report-list span,
body.ast-incident-detail-body .ast-incident-research-report-list em {
    display: block;
}

body.ast-incident-detail-body .ast-incident-research-report-list strong {
    color: var(--ast-title);
    font-size: 13px;
}

body.ast-incident-detail-body .ast-incident-research-report-list span,
body.ast-incident-detail-body .ast-incident-research-report-list em {
    color: var(--ast-muted);
    font-size: 11px;
    line-height: 1.3;
    margin-top: 2px;
}

body.ast-incident-detail-body .ast-incident-research-report-list article > div:last-child {
    display: grid;
    gap: 5px;
}

body.ast-incident-detail-body .ast-incident-research-upload {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 160px;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px dashed rgba(124, 58, 237, 0.45);
    border-radius: 12px;
    background: rgba(124, 58, 237, 0.06);
}

body.ast-incident-detail-body .ast-incident-research-upload label {
    display: grid;
    gap: 4px;
    color: var(--ast-title);
    font-size: 12px;
    font-weight: 800;
}

body.ast-incident-detail-body .ast-incident-research-upload input[type="file"],
body.ast-incident-detail-body .ast-incident-research-upload input[name="comment"] {
    min-height: 32px;
    border: 1px solid var(--ast-border);
    border-radius: 10px;
    padding: 5px 8px;
    background: var(--ast-input-bg, var(--ast-panel-bg));
    color: var(--ast-input-text, var(--ast-title));
}

body.ast-incidents-page-body .ast-incident-research-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%) !important;
    border-color: rgba(124, 58, 237, 0.55) !important;
    color: #ffffff !important;
}

body.ast-incidents-page-body .ast-incident-research-btn:hover {
    filter: brightness(1.05);
    color: #ffffff !important;
}

body.ast-incidents-page-body .sla-research,
body.ast-incident-detail-body .ast-incident-detail-sla.sla-research {
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.5);
    background: rgba(124, 58, 237, 0.09);
}

@media (max-width: 900px) {
    body.ast-incident-detail-body .ast-incident-research-report-list article,
    body.ast-incident-detail-body .ast-incident-research-upload {
        grid-template-columns: 1fr;
    }
}
/* AST INCIDENT RESEARCH REPORT UPLOAD CSS END 2026-04-30 */

/* AST INCIDENTS LIST NO BUTTONS CSS START 2026-04-30
   Список инцидентов: одна тонкая строка, без кнопок справа.
   Отчёты и DOCX остаются внутри карточки инцидента.
*/
body.ast-incidents-one-line-body .ast-incident-line {
    grid-template-columns: 42px 132px 220px minmax(260px, 1fr) 140px 140px !important;
    min-height: 28px !important;
    padding: 2px 5px !important;
    gap: 5px !important;
}

body.ast-incidents-one-line-body .ast-incident-line-main {
    min-height: 22px;
}

body.ast-incidents-one-line-body .ast-incident-line-main:hover strong {
    text-decoration: underline;
}

body.ast-incidents-one-line-body .ast-incident-line-badges span {
    min-height: 14px !important;
    padding: 1px 5px !important;
    font-size: 9px !important;
}

body.ast-incidents-one-line-body .ast-incident-line-sla {
    font-size: 10px !important;
}

body.ast-incidents-one-line-body .ast-incident-line-main strong,
body.ast-incidents-one-line-body .ast-incident-line-main span,
body.ast-incidents-one-line-body .ast-incident-line-main em,
body.ast-incidents-one-line-body .ast-incident-line-values,
body.ast-incidents-one-line-body .ast-incident-line-time {
    font-size: 10px !important;
}

@media (max-width: 1280px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 38px 120px minmax(220px, 1fr) 120px 126px !important;
    }

    body.ast-incidents-one-line-body .ast-incident-line-badges {
        display: none !important;
    }
}

@media (max-width: 900px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 1fr !important;
    }
}
/* AST INCIDENTS LIST NO BUTTONS CSS END 2026-04-30 */

/* AST INCIDENT PRIMARY STATUS BADGE CSS START 2026-04-30
   Главная явная метка состояния инцидента в строке журнала.
*/
body.ast-incidents-one-line-body .ast-incident-line {
    grid-template-columns: 42px 132px 150px 210px minmax(260px, 1fr) 140px 140px !important;
}

body.ast-incidents-one-line-body .ast-incident-primary-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--ast-border);
    font-size: 10px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-transform: uppercase;
}

body.ast-incidents-one-line-body .ast-incident-primary-state.is-open {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.12);
}

body.ast-incidents-one-line-body .ast-incident-primary-state.is-work {
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.60);
    background: rgba(245, 158, 11, 0.16);
}

body.ast-incidents-one-line-body .ast-incident-primary-state.is-wait-ack {
    color: #7c2d12;
    border-color: rgba(251, 146, 60, 0.62);
    background: rgba(251, 146, 60, 0.16);
}

body.ast-incidents-one-line-body .ast-incident-primary-state.is-research {
    color: #6d28d9;
    border-color: rgba(124, 58, 237, 0.55);
    background: rgba(124, 58, 237, 0.12);
}

body.ast-incidents-one-line-body .ast-incident-primary-state.is-closed {
    color: #166534;
    border-color: rgba(34, 197, 94, 0.48);
    background: rgba(34, 197, 94, 0.11);
}

body.ast-incidents-one-line-body .ast-incident-primary-state.is-unknown {
    color: var(--ast-muted);
    border-color: var(--ast-border);
    background: var(--ast-panel-bg);
}

@media (max-width: 1280px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 38px 120px 140px minmax(220px, 1fr) 120px 126px !important;
    }

    body.ast-incidents-one-line-body .ast-incident-line-badges {
        display: none !important;
    }
}

@media (max-width: 900px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 1fr !important;
    }

    body.ast-incidents-one-line-body .ast-incident-primary-state {
        justify-content: flex-start;
    }
}
/* AST INCIDENT PRIMARY STATUS BADGE CSS END 2026-04-30 */

/* AST INCIDENT PASSIVE SNAPSHOTS CSS START 2026-04-30 */
body.ast-incident-detail-body .ast-incident-snapshot-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

body.ast-incident-detail-body .ast-incident-snapshot-card {
    padding: 10px;
    border: 1px solid var(--ast-border);
    border-radius: 12px;
    background: var(--ast-panel-bg);
}

body.ast-incident-detail-body .ast-incident-snapshot-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 5px;
}

body.ast-incident-detail-body .ast-incident-snapshot-head strong {
    color: var(--ast-title);
    font-size: 13px;
}

body.ast-incident-detail-body .ast-incident-snapshot-head span,
body.ast-incident-detail-body .ast-incident-snapshot-summary {
    color: var(--ast-muted);
    font-size: 11px;
}

body.ast-incident-detail-body .ast-incident-snapshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

body.ast-incident-detail-body .ast-incident-snapshot-grid div {
    padding: 6px 7px;
    border-radius: 9px;
    border: 1px solid var(--ast-border);
    background: rgba(148, 163, 184, 0.08);
}

body.ast-incident-detail-body .ast-incident-snapshot-grid span,
body.ast-incident-detail-body .ast-incident-snapshot-grid strong {
    display: block;
    font-size: 11px;
    line-height: 1.25;
}

body.ast-incident-detail-body .ast-incident-snapshot-grid span {
    color: var(--ast-muted);
}

body.ast-incident-detail-body .ast-incident-snapshot-grid strong {
    color: var(--ast-title);
    margin-top: 2px;
}
/* AST INCIDENT PASSIVE SNAPSHOTS CSS END 2026-04-30 */

/* AST INCIDENT WORKFLOW STATUS CSS START 2026-05-01 */
body.ast-incidents-one-line-body .ast-incident-primary-state.is-resolved {
    color: #0369a1;
    border-color: rgba(14, 165, 233, 0.55);
    background: rgba(14, 165, 233, 0.13);
}
/* AST INCIDENT WORKFLOW STATUS CSS END 2026-05-01 */

/* AST INCIDENT WORKFLOW VISUAL FIX START 2026-05-01 */
body.ast-incident-detail-body .ast-incident-detail-pills .ast-incident-workflow-main {
    font-weight: 900;
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.14);
}

body.ast-incident-detail-body .ast-incident-detail-pills .ast-incident-tech-state,
body.ast-incidents-one-line-body .ast-incident-line-badges .ast-incident-tech-state {
    opacity: 0.62;
    font-size: 10px;
    font-weight: 600;
}
/* AST INCIDENT WORKFLOW VISUAL FIX END 2026-05-01 */


/* AST INCIDENT PUBLIC NUMBER OVERLAP FIX START 2026-05-01
   Public codes like МИ26000001 are longer than old #1 IDs.
   Keep number, SLA and workflow status in separate safe columns.
*/
body.ast-incidents-one-line-body .ast-incident-line {
    grid-template-columns:
        minmax(86px, 96px)
        minmax(86px, 118px)
        minmax(118px, 168px)
        minmax(125px, 0.65fr)
        minmax(220px, 1.45fr)
        minmax(88px, 118px)
        minmax(104px, 128px) !important;
    column-gap: 7px !important;
}

body.ast-incidents-one-line-body .ast-incident-line-id {
    display: block !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 10.5px !important;
    letter-spacing: -0.15px;
}

body.ast-incidents-one-line-body .ast-incident-line-sla,
body.ast-incidents-one-line-body .ast-incident-primary-state,
body.ast-incidents-one-line-body .ast-incident-line-badges,
body.ast-incidents-one-line-body .ast-incident-line-main,
body.ast-incidents-one-line-body .ast-incident-line-values,
body.ast-incidents-one-line-body .ast-incident-line-time {
    min-width: 0 !important;
}

body.ast-incidents-one-line-body .ast-incident-line-sla strong,
body.ast-incidents-one-line-body .ast-incident-primary-state {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.ast-incidents-one-line-body .ast-incident-line-badges span {
    max-width: 64px;
}

body.ast-incidents-one-line-body .ast-incident-line-main {
    grid-template-columns: minmax(105px, 0.8fr) minmax(115px, 1fr) minmax(72px, 0.45fr) !important;
}

@media (max-width: 1220px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns:
            minmax(82px, 90px)
            minmax(76px, 94px)
            minmax(104px, 138px)
            minmax(96px, 0.55fr)
            minmax(170px, 1fr)
            minmax(76px, 96px)
            minmax(86px, 104px) !important;
        column-gap: 5px !important;
    }

    body.ast-incidents-one-line-body .ast-incident-line-badges span {
        max-width: 52px;
        padding-left: 4px;
        padding-right: 4px;
    }

    body.ast-incidents-one-line-body .ast-incident-line-values,
    body.ast-incidents-one-line-body .ast-incident-line-time {
        font-size: 9.5px;
    }
}

@media (max-width: 980px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns: 88px 1fr 126px !important;
        grid-auto-rows: minmax(22px, auto);
        align-items: center;
    }

    body.ast-incidents-one-line-body .ast-incident-line-id {
        grid-column: 1;
    }

    body.ast-incidents-one-line-body .ast-incident-line-sla {
        grid-column: 2;
    }

    body.ast-incidents-one-line-body .ast-incident-primary-state {
        grid-column: 3;
    }

    body.ast-incidents-one-line-body .ast-incident-line-badges,
    body.ast-incidents-one-line-body .ast-incident-line-main,
    body.ast-incidents-one-line-body .ast-incident-line-values,
    body.ast-incidents-one-line-body .ast-incident-line-time {
        grid-column: 1 / -1;
    }
}
/* AST INCIDENT PUBLIC NUMBER OVERLAP FIX END 2026-05-01 */

/* AST INCIDENT LINE COMPACT TUNING START 2026-05-01
   Goal:
   - reduce empty horizontal gaps,
   - keep public number/labels readable,
   - make tiny badges a bit larger and more legible.
*/
body.ast-incidents-one-line-body .ast-incident-line {
    grid-template-columns:
        minmax(96px, 106px)
        minmax(96px, 122px)
        minmax(120px, 170px)
        minmax(150px, 0.75fr)
        minmax(260px, 1.55fr)
        minmax(110px, 126px)
        minmax(132px, 150px) !important;
    column-gap: 5px !important;
    row-gap: 4px !important;
    align-items: center !important;
}

body.ast-incidents-one-line-body .ast-incident-line,
body.ast-incidents-one-line-body .ast-incident-line > * {
    min-width: 0 !important;
}

body.ast-incidents-one-line-body .ast-incident-line-id,
body.ast-incidents-one-line-body .ast-incident-line-title,
body.ast-incidents-one-line-body .ast-incident-line-device,
body.ast-incidents-one-line-body .ast-incident-line-tech,
body.ast-incidents-one-line-body .ast-incident-line-sla,
body.ast-incidents-one-line-body .ast-incident-line-metric,
body.ast-incidents-one-line-body .ast-incident-line-value,
body.ast-incidents-one-line-body .ast-incident-line-time {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.ast-incidents-one-line-body .ast-incident-line-id {
    font-weight: 700 !important;
    letter-spacing: 0 !important;
}

body.ast-incidents-one-line-body .ast-incident-line-title,
body.ast-incidents-one-line-body .ast-incident-line-device {
    font-weight: 600 !important;
}

body.ast-incidents-one-line-body .ast-incident-line-badges,
body.ast-incidents-one-line-body .ast-incident-badges,
body.ast-incidents-one-line-body .ast-incident-inline-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
}

body.ast-incidents-one-line-body .ast-incident-line .badge,
body.ast-incidents-one-line-body .ast-incident-line .pill,
body.ast-incidents-one-line-body .ast-incident-line .status-badge,
body.ast-incidents-one-line-body .ast-incident-line .ast-badge,
body.ast-incidents-one-line-body .ast-incident-line [class*="badge"],
body.ast-incidents-one-line-body .ast-incident-line [class*="pill"] {
    min-height: 22px !important;
    line-height: 1.15 !important;
    padding: 2px 8px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

body.ast-incidents-one-line-body .ast-incident-line .ast-incident-workflow-badge,
body.ast-incidents-one-line-body .ast-incident-line .ast-incident-state-badge {
    min-height: 28px !important;
    padding: 4px 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}

body.ast-incidents-one-line-body .ast-incidents-list > * + *,
body.ast-incidents-one-line-body .ast-incident-history-list > * + * {
    margin-top: 4px !important;
}

body.ast-incidents-one-line-body .portal-page-card {
    margin-bottom: 10px !important;
}

body.ast-incidents-one-line-body .ast-incidents-one-line-summary {
    margin-bottom: 10px !important;
}

@media (max-width: 1500px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns:
            minmax(92px, 102px)
            minmax(92px, 116px)
            minmax(118px, 158px)
            minmax(140px, 0.7fr)
            minmax(220px, 1.4fr)
            minmax(100px, 118px)
            minmax(124px, 142px) !important;
    }
}

@media (max-width: 1280px) {
    body.ast-incidents-one-line-body .ast-incident-line {
        grid-template-columns:
            minmax(90px, 100px)
            minmax(90px, 112px)
            minmax(112px, 150px)
            minmax(130px, 0.68fr)
            minmax(200px, 1.25fr)
            minmax(96px, 114px)
            minmax(118px, 136px) !important;
        column-gap: 4px !important;
    }

    body.ast-incidents-one-line-body .ast-incident-line .badge,
    body.ast-incidents-one-line-body .ast-incident-line .pill,
    body.ast-incidents-one-line-body .ast-incident-line .status-badge,
    body.ast-incidents-one-line-body .ast-incident-line .ast-badge,
    body.ast-incidents-one-line-body .ast-incident-line [class*="badge"],
    body.ast-incidents-one-line-body .ast-incident-line [class*="pill"] {
        padding: 2px 7px !important;
        font-size: 11px !important;
    }
}
/* AST INCIDENT LINE COMPACT TUNING END 2026-05-01 */


/* AST ADD DEVICE CACTI WIZARD START 2026-05-02 */
.ast-add-device-cacti-wizard-body .ast-add-device-hero p {
    max-width: 1040px;
    color: var(--ast-muted);
}

.ast-add-device-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.ast-add-device-steps > div,
.ast-add-device-profile-card,
.ast-add-device-console,
.ast-add-device-notice {
    border: 1px solid var(--ast-border);
    background: var(--ast-card-bg);
    color: var(--ast-text);
    box-shadow: var(--ast-shadow);
    border-radius: 18px;
}

.ast-add-device-steps > div {
    padding: 12px;
    min-height: 86px;
}

.ast-add-device-steps span {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--ast-border);
    background: var(--ast-panel-bg);
    color: var(--ast-title);
    font-weight: 800;
    margin-bottom: 8px;
}

.ast-add-device-steps strong,
.ast-add-device-steps small {
    display: block;
}

.ast-add-device-steps small {
    margin-top: 4px;
    color: var(--ast-muted);
}

.ast-add-device-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 14px;
    margin: 14px 0 18px;
}

.ast-add-device-profile-card {
    display: block;
    padding: 14px;
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.ast-add-device-profile-card:hover {
    transform: translateY(-1px);
    border-color: var(--ast-accent);
}

.ast-add-device-profile-card input {
    margin-right: 8px;
}

.ast-add-device-profile-title {
    display: inline-block;
    font-size: 18px;
    font-weight: 900;
    color: var(--ast-title);
}

.ast-add-device-profile-text,
.ast-add-device-profile-meta {
    display: block;
    margin-top: 7px;
    color: var(--ast-muted);
}

.ast-add-device-profile-meta {
    font-size: 12px;
}

.ast-add-device-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 14px;
}

.ast-add-device-grid .full {
    grid-column: 1 / -1;
}

.ast-add-device-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.ast-add-device-notice {
    padding: 14px 16px;
    font-weight: 800;
}

.ast-add-device-notice.ok {
    border-color: rgba(22, 163, 74, .45);
}

.ast-add-device-notice.bad {
    border-color: rgba(220, 38, 38, .55);
}

.ast-add-device-console {
    overflow: hidden;
}

.ast-add-device-console-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--ast-border);
    background: var(--ast-panel-bg);
}

.ast-add-device-console-head span {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    display: inline-flex;
}

.ast-add-device-console-head span.ok {
    background: #16a34a;
}

.ast-add-device-console-head span.bad {
    background: #dc2626;
}

.ast-add-device-console pre {
    margin: 0;
    padding: 14px;
    max-height: 460px;
    overflow: auto;
    background: #070b1a;
    color: #9ff38a;
    font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 980px) {
    .ast-add-device-steps,
    .ast-add-device-profile-grid,
    .ast-add-device-grid {
        grid-template-columns: 1fr;
    }
}
/* AST ADD DEVICE CACTI WIZARD END 2026-05-02 */

/* AST PORTAL COPYABLE CONSOLE OUTPUT START 2026-05-02 */
.portal-copyable-pre {
    position: relative;
}

.portal-copyable-pre > .portal-copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    min-height: 30px;
    padding: 5px 12px;
    font-size: 12px;
    opacity: .92;
}

.portal-copyable-pre > .portal-copy-button.ok {
    border-color: rgba(22, 163, 74, .55);
}

.portal-copyable-pre > .portal-copy-button.bad {
    border-color: rgba(220, 38, 38, .55);
}

.portal-copyable-pre pre {
    padding-top: 48px !important;
}
/* AST PORTAL COPYABLE CONSOLE OUTPUT END 2026-05-02 */

/* AST ADD DEVICE NAMING UX START 2026-05-02 */
.ast-add-device-name-guide h3 {
    margin-top: 16px;
    margin-bottom: 10px;
}

.ast-add-device-guide-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(190px, 1fr));
    gap: 12px;
}

.ast-add-device-guide-grid > div {
    border: 1px solid var(--ast-border);
    background: var(--ast-panel-bg);
    border-radius: 16px;
    padding: 12px;
}

.ast-add-device-guide-grid strong {
    display: block;
    color: var(--ast-title);
    margin-bottom: 6px;
}

.ast-add-device-guide-grid p {
    margin: 0 0 8px;
    color: var(--ast-muted);
}

.ast-add-device-guide-grid code {
    display: block;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--ast-border);
    background: var(--ast-input-bg);
    color: var(--ast-input-text);
    overflow-wrap: anywhere;
}

.ast-add-device-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ast-field-hint {
    display: block;
    margin-top: 5px;
    color: var(--ast-muted);
    line-height: 1.35;
}

@media (max-width: 980px) {
    .ast-add-device-guide-grid {
        grid-template-columns: 1fr;
    }

    .portal-copyable-pre > .portal-copy-button {
        position: sticky;
        top: 8px;
        float: right;
        margin: 8px;
    }
}
/* AST ADD DEVICE NAMING UX END 2026-05-02 */

/* AST ADD DEVICE DB PROFILES PRESETS UX START 2026-05-02 */
.ast-add-device-name-guide .portal-page-note {
    margin-top: 8px;
}

.ast-add-device-preset-row .btn {
    text-align: left;
}
/* AST ADD DEVICE DB PROFILES PRESETS UX END 2026-05-02 */

/* AST ADD DEVICE SNMP PREREQUISITE START 2026-05-02
   Goal:
   - remind operator to enable SNMP on BDCOM OLT before adding it through Cacti;
   - keep secrets out of UI;
   - use shared portal card style without hardcoding deployment-specific devices.
*/
.ast-add-device-prereq {
    border: 1px solid rgba(245, 158, 11, 0.38);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.03));
}

.ast-add-device-prereq[hidden] {
    display: none !important;
}

.ast-add-device-prereq > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 800;
}

.ast-add-device-prereq > summary::-webkit-details-marker {
    display: none;
}

.ast-add-device-prereq > summary::before {
    content: "▾";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.22);
    color: #92400e;
    font-size: 13px;
    float: left;
}

.ast-add-device-prereq:not([open]) > summary::before {
    content: "▸";
}

.ast-add-device-prereq > summary span {
    color: var(--portal-text, #172033);
}

.ast-add-device-prereq > summary small {
    color: var(--portal-muted, #64748b);
    font-weight: 600;
}

.ast-add-device-prereq-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.ast-add-device-prereq-card {
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.ast-add-device-prereq-warning {
    border-color: rgba(245, 158, 11, 0.42);
    background: rgba(255, 251, 235, 0.72);
}

.ast-add-device-prereq-card strong {
    display: block;
    margin-bottom: 8px;
    color: var(--portal-text, #172033);
}

.ast-add-device-prereq-card p,
.ast-add-device-prereq-card li {
    color: var(--portal-muted, #64748b);
    font-size: 13px;
    line-height: 1.45;
}

.ast-add-device-prereq-card ol {
    margin: 0 0 10px 18px;
    padding: 0;
}

.ast-add-device-prereq-card pre {
    overflow: auto;
    white-space: pre;
    margin: 10px 0 0;
    padding: 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92);
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.45;
}

body.theme-ast_dark .ast-add-device-prereq-card,
body.theme-noc_night .ast-add-device-prereq-card {
    background: rgba(15, 23, 42, 0.72);
}

body.theme-ast_dark .ast-add-device-prereq-warning,
body.theme-noc_night .ast-add-device-prereq-warning {
    background: rgba(120, 53, 15, 0.34);
}

@media (max-width: 1100px) {
    .ast-add-device-prereq-grid {
        grid-template-columns: 1fr;
    }
}
/* AST ADD DEVICE SNMP PREREQUISITE END 2026-05-02 */

/* AST ADD DEVICE PROFILE COMPACT + DB SNMP HELP START 2026-05-02
   Goal:
   - make add-device profile cards compact enough for BDCOM/MikroTik/Linux/Windows;
   - display SNMP instructions from add_device_profiles, not hardcoded PHP blocks.
*/
body.ast-add-device-cacti-wizard-body .ast-add-device-profile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
}

body.ast-add-device-cacti-wizard-body .ast-add-device-profile-card {
    min-height: 0;
    padding: 10px 12px;
    border-radius: 14px;
}

body.ast-add-device-cacti-wizard-body .ast-add-device-profile-title {
    font-size: 14px;
    line-height: 1.2;
}

body.ast-add-device-cacti-wizard-body .ast-add-device-profile-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.25;
    margin-top: 5px;
}

body.ast-add-device-cacti-wizard-body .ast-add-device-profile-meta {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ast-add-device-prereq-text {
    background: transparent !important;
    color: var(--portal-muted, #64748b) !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    white-space: pre-wrap !important;
    font-family: inherit !important;
}

@media (max-width: 1200px) {
    body.ast-add-device-cacti-wizard-body .ast-add-device-profile-grid {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }
}

@media (max-width: 700px) {
    body.ast-add-device-cacti-wizard-body .ast-add-device-profile-grid {
        grid-template-columns: 1fr;
    }
}
/* AST ADD DEVICE PROFILE COMPACT + DB SNMP HELP END 2026-05-02 */

/* AST ADD DEVICE PROFILE HINTS UNDER PROFILE START 2026-05-02
   Goal:
   - show profile-specific SNMP hint immediately after profile selection;
   - keep copy buttons visible on all SNMP command blocks.
*/
body.ast-add-device-cacti-wizard-body .ast-add-device-profile-grid + .ast-add-device-prereq {
    margin-top: 14px;
}

.ast-copyable-pre-wrap {
    position: relative;
}

.ast-copyable-pre-wrap > pre {
    padding-top: 36px !important;
}

.ast-copyable-pre-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    padding: 4px 10px;
    min-height: 24px;
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.ast-copyable-pre-btn:hover {
    transform: translateY(-1px);
}
/* AST ADD DEVICE PROFILE HINTS UNDER PROFILE END 2026-05-02 */


/* AST DEVICE ADD PROFILES EDITOR START 2026-05-02
   Editor for add_device_profiles: profiles, reference Cacti hosts, allowed networks and SNMP hints.
*/
.ast-device-add-profiles-page {
    display: grid;
    gap: 18px;
}

.ast-device-profile-hero p {
    max-width: 980px;
    color: var(--portal-muted, #64748b);
}

.ast-device-profile-notice {
    font-weight: 800;
}

.ast-device-profile-notice.ok {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(220, 252, 231, 0.72);
}

.ast-device-profile-notice.bad {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(254, 226, 226, 0.72);
}

.ast-device-profile-form {
    display: grid;
    gap: 14px;
}

.ast-device-profile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
}

.ast-device-profile-grid .full {
    grid-column: 1 / -1;
}

.ast-device-profile-grid label {
    display: block;
    margin-bottom: 5px;
    color: var(--portal-text, #172033);
    font-size: 12px;
    font-weight: 800;
}

.ast-device-profile-grid input,
.ast-device-profile-grid textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 12px;
    padding: 9px 10px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--portal-text, #172033);
    font: inherit;
    font-size: 13px;
}

.ast-device-profile-grid textarea {
    resize: vertical;
    min-height: 44px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.ast-device-profile-grid small {
    display: block;
    margin-top: 5px;
    color: var(--portal-muted, #64748b);
    font-size: 11px;
    line-height: 1.35;
}

.ast-device-profile-grid .two-col-textareas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ast-device-profile-checkline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--portal-muted, #64748b);
    font-weight: 700;
}

.ast-device-profile-checkline input {
    width: 16px;
    height: 16px;
}

.ast-device-profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ast-device-profile-list {
    display: grid;
    gap: 12px;
}

.ast-device-profile-editor {
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.52);
    padding: 0;
    overflow: hidden;
}

.ast-device-profile-editor > summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    list-style: none;
}

.ast-device-profile-editor > summary::-webkit-details-marker {
    display: none;
}

.ast-device-profile-editor > summary::before {
    content: "▸";
    display: inline-flex;
    width: 22px;
    height: 22px;
    margin-right: 8px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.14);
    color: #5b21b6;
    font-size: 12px;
}

.ast-device-profile-editor[open] > summary::before {
    content: "▾";
}

.ast-device-profile-editor > summary span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ast-device-profile-editor > summary code {
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(15, 23, 42, 0.08);
    font-size: 11px;
}

.ast-device-profile-editor > summary small {
    color: var(--portal-muted, #64748b);
    font-size: 12px;
}

.ast-device-profile-editor > form {
    padding: 0 16px 16px;
}

.ast-device-profile-ref-table-wrap {
    overflow: auto;
}

.ast-device-profile-ref-table code {
    white-space: nowrap;
}

body.theme-ast_dark .ast-device-profile-grid input,
body.theme-ast_dark .ast-device-profile-grid textarea,
body.theme-noc_night .ast-device-profile-grid input,
body.theme-noc_night .ast-device-profile-grid textarea {
    background: rgba(15, 23, 42, 0.58);
}

body.theme-ast_dark .ast-device-profile-editor,
body.theme-noc_night .ast-device-profile-editor {
    background: rgba(15, 23, 42, 0.44);
}

@media (max-width: 1200px) {
    .ast-device-profile-grid {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }

    .ast-device-profile-grid .two-col-textareas {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .ast-device-profile-grid {
        grid-template-columns: 1fr;
    }

    .ast-device-profile-editor > summary {
        align-items: flex-start;
        flex-direction: column;
    }
}
/* AST DEVICE ADD PROFILES EDITOR END 2026-05-02 */




/* AST ADD DEVICE PORTAL BUTTON STYLE REBIND START 2026-05-02
   Layout only. Colors/background/borders come from the portal .btn.secondary style.
*/
.ast-add-device-profile-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ast-add-device-profile-head h2 {
    margin: 0;
}

.ast-add-device-profile-card {
    position: relative;
}

body.ast-add-device-cacti-wizard-body .ast-profile-mini-action {
    width: 26px;
    min-width: 26px;
    height: 26px;
    min-height: 26px;
    max-height: 26px;
    padding: 0 !important;
    border-radius: 999px;
    line-height: 1;
}

body.ast-add-device-cacti-wizard-body .ast-profile-mini-add {
    font-size: 16px;
    font-weight: 900;
}

body.ast-add-device-cacti-wizard-body .ast-profile-mini-edit {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    padding: 0 !important;
    font-size: 13px;
    opacity: 0.82;
}

body.ast-add-device-cacti-wizard-body .ast-add-device-profile-card:hover .ast-profile-mini-edit {
    opacity: 1;
}

.ast-snmp-copy-wrap {
    position: relative;
}

.ast-snmp-copy-wrap > pre {
    padding-top: 42px !important;
}

body.ast-add-device-cacti-wizard-body .ast-snmp-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    min-height: 26px;
    height: 26px;
    max-height: 26px;
    padding: 0 12px !important;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.ast-device-profile-editor:target,
#add-profile:target {
    outline: 2px solid var(--ast-border, currentColor);
    outline-offset: 3px;
}
/* AST ADD DEVICE PORTAL BUTTON STYLE REBIND END 2026-05-02 */

/* AST SNMP CREDENTIALS PAGE START 2026-05-02
   Uses portal theme variables only. No hardcoded theme colors.
*/
.ast-snmp-credentials-page {
    display: grid;
    gap: 18px;
}

.ast-snmp-credentials-hero p {
    max-width: 980px;
    color: var(--ast-muted, var(--portal-muted, currentColor));
}

.ast-snmp-credentials-notice {
    font-weight: 800;
}

.ast-snmp-credentials-notice.ok,
.ast-snmp-credentials-notice.bad {
    border-color: var(--ast-border, var(--portal-border, currentColor));
    background: var(--ast-card-bg, var(--portal-card-bg, transparent));
}

.ast-snmp-credential-form {
    display: grid;
    gap: 14px;
}

.ast-snmp-credential-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
}

.ast-snmp-credential-grid .full {
    grid-column: 1 / -1;
}

.ast-snmp-credential-grid label {
    display: block;
    margin-bottom: 5px;
    color: var(--ast-text, var(--portal-text, currentColor));
    font-size: 12px;
    font-weight: 800;
}

.ast-snmp-credential-grid input,
.ast-snmp-credential-grid textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 9px 10px;
    background: var(--ast-input-bg, var(--portal-input-bg, transparent));
    color: var(--ast-input-text, var(--ast-text, var(--portal-text, currentColor)));
    font: inherit;
    font-size: 13px;
}

.ast-snmp-credential-grid textarea {
    resize: vertical;
    min-height: 44px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.ast-snmp-credential-grid small,
.ast-muted-inline,
.ast-snmp-credential-table small {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 11px;
    line-height: 1.35;
}

.ast-snmp-credential-grid .two-col-textareas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ast-snmp-credential-checkline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-weight: 700;
}

.ast-snmp-credential-checkline input {
    width: 16px;
    height: 16px;
}

.ast-snmp-credential-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ast-snmp-credential-list {
    display: grid;
    gap: 12px;
}

.ast-snmp-credential-editor {
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 18px;
    background: var(--ast-card-bg, var(--portal-card-bg, transparent));
    padding: 0;
    overflow: hidden;
}

.ast-snmp-credential-editor > summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    list-style: none;
}

.ast-snmp-credential-editor > summary::-webkit-details-marker {
    display: none;
}

.ast-snmp-credential-editor > summary span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ast-snmp-credential-editor > summary code,
.ast-snmp-credential-table code {
    border-radius: 999px;
    padding: 3px 8px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
}

.ast-snmp-credential-editor > summary small {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
}

.ast-snmp-credential-editor > form {
    padding: 0 16px 16px;
}

.ast-snmp-credential-table-wrap {
    overflow: auto;
}

.ast-snmp-credential-table code {
    white-space: nowrap;
}

@media (max-width: 1200px) {
    .ast-snmp-credential-grid {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }

    .ast-snmp-credential-grid .two-col-textareas {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .ast-snmp-credential-grid {
        grid-template-columns: 1fr;
    }

    .ast-snmp-credential-editor > summary {
        align-items: flex-start;
        flex-direction: column;
    }
}
/* AST SNMP CREDENTIALS PAGE END 2026-05-02 */

/* AST SNMP CREDENTIALS COMPACT START 2026-05-02
   Compact admin layout for many SNMP credential groups.
   Layout only; colors inherit portal variables/styles.
*/
body.ast-snmp-credentials-page-body .ast-snmp-credentials-page {
    gap: 10px;
}

body.ast-snmp-credentials-page-body .portal-page-card {
    padding: 12px 14px;
    border-radius: 14px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credentials-hero h1,
body.ast-snmp-credentials-page-body .portal-page-card h2 {
    margin-top: 0;
    margin-bottom: 6px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credentials-hero p,
body.ast-snmp-credentials-page-body .portal-page-card p {
    margin-top: 0;
    margin-bottom: 8px;
    line-height: 1.35;
}

.ast-snmp-compact-panel > summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
    min-height: 28px;
}

.ast-snmp-compact-panel > summary::-webkit-details-marker {
    display: none;
}

.ast-snmp-compact-panel > summary strong {
    color: var(--ast-title, var(--ast-text, var(--portal-text, currentColor)));
    font-size: 14px;
}

.ast-snmp-compact-panel > summary small {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
}

.ast-snmp-compact-panel-body {
    margin-top: 10px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-list {
    gap: 6px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor {
    border-radius: 12px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary {
    min-height: 30px;
    padding: 7px 10px;
    gap: 8px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary span {
    gap: 6px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary strong {
    font-size: 13px;
    line-height: 1.2;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary code,
body.ast-snmp-credentials-page-body .ast-snmp-credential-table code {
    padding: 2px 6px;
    font-size: 11px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary small {
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > form {
    padding: 0 10px 10px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-form {
    gap: 8px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-grid {
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 8px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-grid label {
    margin-bottom: 3px;
    font-size: 11px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-grid input,
body.ast-snmp-credentials-page-body .ast-snmp-credential-grid textarea {
    border-radius: 9px;
    padding: 6px 8px;
    font-size: 12px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-grid textarea {
    min-height: 34px;
    line-height: 1.25;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-grid small {
    margin-top: 3px;
    font-size: 10.5px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-grid .two-col-textareas {
    gap: 8px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-checkline {
    font-size: 12px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-actions {
    gap: 6px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-actions .btn {
    min-height: 28px;
    padding-top: 5px;
    padding-bottom: 5px;
    font-size: 12px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-table th,
body.ast-snmp-credentials-page-body .ast-snmp-credential-table td {
    padding: 5px 7px;
    font-size: 12px;
    line-height: 1.25;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-table small {
    font-size: 10.5px;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-table-wrap {
    max-height: 360px;
    overflow: auto;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--ast-table-head-bg, var(--ast-panel-bg, var(--portal-panel-bg, Canvas)));
}

@media (max-width: 1400px) {
    body.ast-snmp-credentials-page-body .ast-snmp-credential-grid {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
    }
}

@media (max-width: 900px) {
    body.ast-snmp-credentials-page-body .ast-snmp-credential-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary {
        align-items: flex-start;
        flex-direction: column;
    }

    body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary small {
        white-space: normal;
    }
}
/* AST SNMP CREDENTIALS COMPACT END 2026-05-02 */

/* AST SNMP CREDENTIALS BADGE SCHEME START 2026-05-02
   Compact badge/tile scheme for many SNMP credential groups.
   Portal variables only; no fixed theme colors.
*/
body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary {
    display: grid;
    grid-template-columns: minmax(220px, 0.75fr) minmax(360px, 1.25fr);
    align-items: center;
    gap: 8px;
}

.ast-snmp-credential-summary-main {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.ast-snmp-credential-summary-main strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ast-snmp-credential-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
}

.ast-snmp-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    max-width: 190px;
    padding: 2px 7px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 999px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary code,
body.ast-snmp-credentials-page-body .ast-snmp-credential-table code {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ast-snmp-credentials-page-body .ast-snmp-credential-table th,
body.ast-snmp-credentials-page-body .ast-snmp-credential-table td {
    vertical-align: middle;
}

@media (max-width: 1200px) {
    body.ast-snmp-credentials-page-body .ast-snmp-credential-editor > summary {
        grid-template-columns: 1fr;
    }

    .ast-snmp-credential-badges {
        justify-content: flex-start;
    }
}
/* AST SNMP CREDENTIALS BADGE SCHEME END 2026-05-02 */

/* AST SNMP CREDENTIAL SECRET UI START 2026-05-02
   Layout only. Uses portal button/input/card variables.
*/
body.ast-snmp-credentials-page-body .ast-snmp-secret-box {
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 8px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
}

body.ast-snmp-credentials-page-body .ast-snmp-secret-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    gap: 6px;
    align-items: center;
}

body.ast-snmp-credentials-page-body .ast-snmp-secret-row .btn {
    min-height: 30px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    body.ast-snmp-credentials-page-body .ast-snmp-secret-row {
        grid-template-columns: 1fr;
    }
}
/* AST SNMP CREDENTIAL SECRET UI END 2026-05-02 */


/* AST SNMP PAGE FLASH START 2026-05-02
   One portal-themed flash alert for SNMP credentials page.
   Uses theme variables; no fixed page colors.
*/
body.ast-snmp-credentials-page-body .ast-snmp-page-flash {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    margin: 10px auto 12px;
    padding: 11px 13px;
    max-width: min(100%, 980px);
    border-radius: 16px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
    box-shadow:
        0 10px 26px color-mix(in srgb, var(--ast-text, var(--portal-text, currentColor)) 10%, transparent),
        inset 0 1px 0 color-mix(in srgb, #fff 22%, transparent);
}

body.ast-snmp-credentials-page-body .ast-snmp-page-flash__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    background: var(--ast-chip-bg, var(--portal-chip-bg, var(--ast-panel-bg, transparent)));
    color: var(--ast-text-strong, var(--ast-text, var(--portal-text, currentColor)));
    font-weight: 900;
    font-size: 15px;
    line-height: 1;
}

body.ast-snmp-credentials-page-body .ast-snmp-page-flash__title {
    margin: 0 0 3px;
    color: var(--ast-title, var(--ast-text, var(--portal-text, currentColor)));
    font-size: 15px;
    font-weight: 900;
    line-height: 1.25;
}

body.ast-snmp-credentials-page-body .ast-snmp-page-flash__text {
    margin: 0;
    color: var(--ast-text, var(--portal-text, currentColor));
    font-size: 13px;
    line-height: 1.35;
}

body.ast-snmp-credentials-page-body .ast-snmp-page-flash--success {
    border-color: color-mix(in srgb, var(--ast-accent, var(--portal-accent, var(--ast-border, currentColor))) 70%, var(--ast-border, var(--portal-border, currentColor)) 30%);
    background:
        linear-gradient(
            90deg,
            color-mix(in srgb, var(--ast-accent, var(--portal-accent, currentColor)) 18%, var(--ast-panel-bg, var(--portal-panel-bg, transparent)) 82%),
            var(--ast-panel-bg, var(--portal-panel-bg, transparent))
        );
}

body.ast-snmp-credentials-page-body .ast-snmp-page-flash--success .ast-snmp-page-flash__icon {
    border-color: color-mix(in srgb, var(--ast-accent, var(--portal-accent, currentColor)) 70%, var(--ast-border, var(--portal-border, currentColor)) 30%);
    background: color-mix(in srgb, var(--ast-accent, var(--portal-accent, currentColor)) 22%, var(--ast-panel-bg, var(--portal-panel-bg, transparent)) 78%);
}

body.ast-snmp-credentials-page-body .ast-snmp-page-flash--danger {
    border-color: color-mix(in srgb, var(--ast-danger, var(--ast-border, var(--portal-border, currentColor))) 70%, var(--ast-border, var(--portal-border, currentColor)) 30%);
    background:
        linear-gradient(
            90deg,
            color-mix(in srgb, var(--ast-danger, var(--ast-border, currentColor)) 16%, var(--ast-panel-bg, var(--portal-panel-bg, transparent)) 84%),
            var(--ast-panel-bg, var(--portal-panel-bg, transparent))
        );
}

@media (max-width: 700px) {
    body.ast-snmp-credentials-page-body .ast-snmp-page-flash {
        grid-template-columns: 1fr;
    }
}
/* AST SNMP PAGE FLASH END 2026-05-02 */

/* AST SNMP BDCOM CONSOLE START 2026-05-02
   Controlled BDCOM helper console. Portal variables only.
*/
body.ast-snmp-credentials-page-body .ast-snmp-console-result {
    display: grid;
    gap: 8px;
}

body.ast-snmp-credentials-page-body .ast-snmp-console-result__head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

body.ast-snmp-credentials-page-body .ast-snmp-console-result__meta {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
}

body.ast-snmp-credentials-page-body .ast-snmp-console-result pre {
    max-height: 340px;
    overflow: auto;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 10px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
    font-size: 11px;
    line-height: 1.35;
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-console {
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 8px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-device-list {
    display: grid;
    gap: 6px;
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-device {
    display: grid;
    gap: 5px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 10px;
    padding: 7px;
    background: var(--ast-card-bg, var(--portal-card-bg, transparent));
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-device__title {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-device__meta {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 11px;
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-console-form {
    display: grid;
    grid-template-columns:
        minmax(90px, 0.8fr)
        minmax(110px, 0.9fr)
        minmax(110px, 0.9fr)
        minmax(110px, 1fr)
        minmax(80px, 0.8fr)
        auto auto auto;
    gap: 5px;
    align-items: center;
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-console-form input {
    min-width: 0;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 9px;
    padding: 5px 7px;
    background: var(--ast-input-bg, var(--portal-input-bg, transparent));
    color: var(--ast-input-text, var(--ast-text, var(--portal-text, currentColor)));
    font-size: 11px;
}

body.ast-snmp-credentials-page-body .ast-snmp-bdcom-console-form .btn {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
}

@media (max-width: 1200px) {
    body.ast-snmp-credentials-page-body .ast-snmp-bdcom-console-form {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }
}

@media (max-width: 700px) {
    body.ast-snmp-credentials-page-body .ast-snmp-bdcom-console-form {
        grid-template-columns: 1fr;
    }
}
/* AST SNMP BDCOM CONSOLE END 2026-05-02 */

/* AST SNMP APPLY MASTER PAGE START 2026-05-02
   Separate SNMP credential apply master. Portal variables only.
*/
body.ast-snmp-apply-master-body .ast-snmp-apply-master-page {
    display: grid;
    gap: 12px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-master-hero p {
    color: var(--ast-muted, var(--portal-muted, currentColor));
}

body.ast-snmp-apply-master-body .ast-snmp-apply-flash {
    max-width: min(100%, 980px);
    margin-inline: auto;
    border-color: var(--ast-border, var(--portal-border, currentColor));
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    font-weight: 800;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-flash--error {
    border-color: var(--ast-danger, var(--ast-border, var(--portal-border, currentColor)));
}

body.ast-snmp-apply-master-body .ast-snmp-apply-console pre {
    max-width: 100%;
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 10px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
    font-size: 11px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-device-list {
    display: grid;
    gap: 10px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-device-card {
    display: grid;
    gap: 8px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 14px;
    padding: 10px;
    background: var(--ast-card-bg, var(--portal-card-bg, transparent));
}

body.ast-snmp-apply-master-body .ast-snmp-apply-device-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-device-head > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-device-head code,
body.ast-snmp-apply-master-body .ast-snmp-apply-master-hero code {
    border-radius: 999px;
    padding: 2px 7px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
}

body.ast-snmp-apply-master-body .ast-snmp-apply-device-head span,
body.ast-snmp-apply-master-body .ast-snmp-apply-device-meta {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-form {
    display: grid;
    gap: 8px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-form-grid {
    display: grid;
    grid-template-columns:
        minmax(130px, 0.85fr)
        minmax(150px, 1fr)
        minmax(150px, 1fr)
        minmax(160px, 1fr)
        minmax(110px, 0.8fr);
    gap: 6px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-form-grid input {
    min-width: 0;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 10px;
    padding: 7px 9px;
    background: var(--ast-input-bg, var(--portal-input-bg, transparent));
    color: var(--ast-input-text, var(--ast-text, var(--portal-text, currentColor)));
    font-size: 12px;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-check {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
}

body.ast-snmp-credentials-page-body .ast-snmp-apply-master-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 8px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
}

body.ast-snmp-credentials-page-body .ast-snmp-apply-master-link small {
    color: var(--ast-muted, var(--portal-muted, currentColor));
}

@media (max-width: 1100px) {
    body.ast-snmp-apply-master-body .ast-snmp-apply-form-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 700px) {
    body.ast-snmp-apply-master-body .ast-snmp-apply-device-head {
        align-items: flex-start;
        flex-direction: column;
    }

    body.ast-snmp-apply-master-body .ast-snmp-apply-form-grid {
        grid-template-columns: 1fr;
    }
}
/* AST SNMP APPLY MASTER PAGE END 2026-05-02 */

/* AST SNMP HIDE OLD INLINE BDCOM CONSOLE START 2026-05-02
   Temporary safe refactor:
   - keep old nested PHP blocks intact to avoid parse breakage,
   - hide the old wide inline console/result from the credential list,
   - use the separate apply master page instead.
*/
body.ast-snmp-credentials-page-body .ast-snmp-bdcom-console,
body.ast-snmp-credentials-page-body .ast-snmp-console-result {
    display: none !important;
}

body.ast-snmp-credentials-page-body .ast-snmp-apply-master-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 8px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
}

body.ast-snmp-credentials-page-body .ast-snmp-apply-master-link small {
    color: var(--ast-muted, var(--portal-muted, currentColor));
}
/* AST SNMP HIDE OLD INLINE BDCOM CONSOLE END 2026-05-02 */

/* AST SNMP APPLY SAFE MODE START 2026-05-02
   Disable one-click OLT configuration. Use step-by-step console instead.
*/
body.ast-snmp-apply-master-body .ast-snmp-apply-actions-safe {
    align-items: center;
}

body.ast-snmp-apply-master-body .ast-snmp-apply-safe-note {
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 8px 10px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
    line-height: 1.35;
}
/* AST SNMP APPLY SAFE MODE END 2026-05-02 */

/* AST SNMP CONSOLE PAGE START 2026-05-02
   Controlled SNMP setup console. Portal variables only.
*/
body.ast-snmp-console-body .ast-snmp-console-page {
    display: grid;
    gap: 12px;
}

body.ast-snmp-console-body .ast-snmp-console-hero p,
body.ast-snmp-console-body .ast-snmp-console-plan li,
body.ast-snmp-console-body .ast-snmp-console-output-meta {
    color: var(--ast-muted, var(--portal-muted, currentColor));
}

body.ast-snmp-console-body .ast-snmp-console-hero code,
body.ast-snmp-console-body .ast-snmp-console-plan code,
body.ast-snmp-console-body .ast-snmp-console-output-meta code {
    border-radius: 999px;
    padding: 2px 7px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
}

body.ast-snmp-console-body .ast-snmp-console-plan ol {
    margin: 8px 0 0 20px;
    padding: 0;
}

body.ast-snmp-console-body .ast-snmp-console-plan li {
    margin: 4px 0;
    line-height: 1.35;
}

body.ast-snmp-console-body .ast-snmp-console-fields {
    display: grid;
    grid-template-columns:
        minmax(130px, 0.9fr)
        minmax(150px, 1fr)
        minmax(150px, 1fr)
        minmax(170px, 1fr)
        minmax(110px, 0.75fr);
    gap: 7px;
}

body.ast-snmp-console-body .ast-snmp-console-fields input {
    min-width: 0;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 10px;
    padding: 8px 10px;
    background: var(--ast-input-bg, var(--portal-input-bg, transparent));
    color: var(--ast-input-text, var(--ast-text, var(--portal-text, currentColor)));
    font-size: 13px;
}

body.ast-snmp-console-body .ast-snmp-console-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-top: 10px;
}

body.ast-snmp-console-body .ast-snmp-console-check {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
}

body.ast-snmp-console-body .ast-snmp-console-flash {
    max-width: min(100%, 980px);
    margin-inline: auto;
    border-color: var(--ast-border, var(--portal-border, currentColor));
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    font-weight: 800;
}

body.ast-snmp-console-body .ast-snmp-console-flash--error {
    border-color: var(--ast-danger, var(--ast-border, var(--portal-border, currentColor)));
}

body.ast-snmp-console-body .ast-snmp-console-output pre {
    max-width: 100%;
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 12px;
    padding: 10px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
    font-size: 11px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 1100px) {
    body.ast-snmp-console-body .ast-snmp-console-fields {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 700px) {
    body.ast-snmp-console-body .ast-snmp-console-fields {
        grid-template-columns: 1fr;
    }
}
/* AST SNMP CONSOLE PAGE END 2026-05-02 */

/* AST SNMP LIVE CONSOLE OVERRIDE START 2026-05-02
   Live OLT console output. Portal variables only.
*/
body.ast-snmp-console-body .ast-snmp-console-page {
    display: grid;
    gap: 12px;
}

body.ast-snmp-console-body .ast-snmp-console-hero code,
body.ast-snmp-console-body .ast-snmp-console-output-meta code {
    border-radius: 999px;
    padding: 2px 7px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
}

body.ast-snmp-console-body .ast-snmp-console-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

body.ast-snmp-console-body .ast-snmp-console-action-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
    font-size: 12px;
    font-weight: 700;
}

body.ast-snmp-console-body .ast-snmp-console-fields {
    display: grid;
    grid-template-columns:
        minmax(130px, 0.9fr)
        minmax(150px, 1fr)
        minmax(150px, 1fr)
        minmax(170px, 1fr)
        minmax(110px, 0.75fr);
    gap: 7px;
}

body.ast-snmp-console-body .ast-snmp-console-fields input {
    min-width: 0;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 10px;
    padding: 8px 10px;
    background: var(--ast-input-bg, var(--portal-input-bg, transparent));
    color: var(--ast-input-text, var(--ast-text, var(--portal-text, currentColor)));
    font-size: 13px;
}

body.ast-snmp-console-body .ast-snmp-console-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-top: 10px;
}

body.ast-snmp-console-body .ast-snmp-console-status {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
    font-weight: 800;
}

body.ast-snmp-console-body .ast-snmp-console-output-meta {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    font-size: 12px;
    margin-bottom: 8px;
}

body.ast-snmp-console-body #ast-snmp-live-console-output {
    width: 100%;
    min-height: 360px;
    max-height: 560px;
    overflow: auto;
    box-sizing: border-box;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 14px;
    padding: 12px;
    background: var(--ast-console-bg, var(--ast-panel-bg, var(--portal-panel-bg, #000)));
    color: var(--ast-console-text, var(--ast-text, var(--portal-text, currentColor)));
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.38;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 1100px) {
    body.ast-snmp-console-body .ast-snmp-console-fields {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 700px) {
    body.ast-snmp-console-body .ast-snmp-console-fields {
        grid-template-columns: 1fr;
    }
}
/* AST SNMP LIVE CONSOLE OVERRIDE END 2026-05-02 */

/* AST SNMP CONSOLE FLUID SAME WIDTH START 2026-05-02
   Goal:
   - all main SNMP console cards have one adaptive width;
   - no fixed pixel widths in this override;
   - layout adapts to laptop/desktop/narrow screens.
*/
body.ast-snmp-console-body {
    --ast-snmp-console-width: min(94vw, 76rem);
    --ast-snmp-console-gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --ast-snmp-console-card-pad: clamp(0.85rem, 1.8vw, 1.35rem);
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page {
    display: grid;
    justify-items: center;
    gap: var(--ast-snmp-console-gap);
    width: 100%;
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card {
    width: var(--ast-snmp-console-width);
    max-width: 100%;
    box-sizing: border-box;
    margin-inline: auto;
    padding: var(--ast-snmp-console-card-pad);
}

body.ast-snmp-console-body .ast-snmp-console-card,
body.ast-snmp-console-body .ast-snmp-console-output,
body.ast-snmp-console-body .ast-snmp-console-hero {
    justify-self: center;
}

body.ast-snmp-console-body .ast-snmp-console-form {
    display: grid;
    gap: clamp(0.6rem, 1vw, 0.9rem);
    width: 100%;
}

body.ast-snmp-console-body .ast-snmp-console-action-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: clamp(0.4rem, 0.8vw, 0.7rem);
    width: 100%;
}

body.ast-snmp-console-body .ast-snmp-console-action-row label {
    justify-content: center;
    min-width: 0;
    text-align: center;
}

body.ast-snmp-console-body .ast-snmp-console-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    gap: clamp(0.4rem, 0.8vw, 0.7rem);
    width: 100%;
}

body.ast-snmp-console-body .ast-snmp-console-fields input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

body.ast-snmp-console-body .ast-snmp-console-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.45rem, 0.9vw, 0.75rem);
    align-items: center;
}

body.ast-snmp-console-body .ast-snmp-console-actions .btn {
    flex: 0 1 auto;
}

body.ast-snmp-console-body .ast-snmp-console-status {
    min-width: min(100%, 12rem);
}

body.ast-snmp-console-body .ast-snmp-console-output-meta {
    width: 100%;
}

body.ast-snmp-console-body #ast-snmp-live-console-output {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: clamp(18rem, 42vh, 34rem);
    max-height: 62vh;
}

@media (max-width: 48rem) {
    body.ast-snmp-console-body {
        --ast-snmp-console-width: min(96vw, 100%);
    }

    body.ast-snmp-console-body .ast-snmp-console-actions .btn {
        flex: 1 1 100%;
    }

    body.ast-snmp-console-body .ast-snmp-console-status {
        width: 100%;
    }
}
/* AST SNMP CONSOLE FLUID SAME WIDTH END 2026-05-02 */

/* AST SNMP CONSOLE TOP CARDS COMPACT START 2026-05-02
   Goal:
   - make the first two cards (hero + launch) visually lower/denser;
   - keep adaptive layout;
   - use only portal theme variables and neutral compact spacing.
*/
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1),
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(2) {
    padding-block: clamp(0.75rem, 1vw, 1rem);
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) {
    min-height: auto;
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) .portal-section-eyebrow,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) .portal-page-eyebrow,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) .ast-page-kicker {
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) h1,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) .portal-page-title,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) .ast-snmp-console-title {
    margin: 0 0 0.35rem 0;
    line-height: 1.08;
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) p,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) .portal-page-subtitle,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1) .ast-snmp-console-meta {
    margin: 0;
    line-height: 1.25;
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(2) {
    min-height: auto;
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(2) h2,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(2) .portal-section-title,
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(2) .ast-snmp-console-section-title {
    margin: 0 0 0.55rem 0;
    line-height: 1.1;
}

body.ast-snmp-console-body .ast-snmp-console-form {
    gap: clamp(0.45rem, 0.8vw, 0.7rem);
}

body.ast-snmp-console-body .ast-snmp-console-action-row {
    gap: clamp(0.35rem, 0.7vw, 0.55rem);
}

body.ast-snmp-console-body .ast-snmp-console-action-row label {
    padding: 0.35rem 0.75rem;
    min-height: auto;
    line-height: 1.2;
}

body.ast-snmp-console-body .ast-snmp-console-fields {
    gap: clamp(0.35rem, 0.7vw, 0.55rem);
}

body.ast-snmp-console-body .ast-snmp-console-fields input,
body.ast-snmp-console-body .ast-snmp-console-fields select,
body.ast-snmp-console-body .ast-snmp-console-fields textarea {
    min-height: auto;
    padding: 0.45rem 0.7rem;
    line-height: 1.2;
}

body.ast-snmp-console-body .ast-snmp-console-actions {
    gap: 0.5rem;
    margin-top: 0;
}

body.ast-snmp-console-body .ast-snmp-console-actions .btn,
body.ast-snmp-console-body .ast-snmp-console-actions button,
body.ast-snmp-console-body .ast-snmp-console-actions input[type="submit"] {
    padding: 0.45rem 0.95rem;
    min-height: auto;
    line-height: 1.15;
}

body.ast-snmp-console-body .ast-snmp-console-status {
    line-height: 1.2;
}

@media (max-width: 48rem) {
    body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1),
    body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(2) {
        padding-block: 0.75rem;
    }

    body.ast-snmp-console-body .ast-snmp-console-action-row label,
    body.ast-snmp-console-body .ast-snmp-console-fields input,
    body.ast-snmp-console-body .ast-snmp-console-fields select,
    body.ast-snmp-console-body .ast-snmp-console-fields textarea {
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }
}
/* AST SNMP CONSOLE TOP CARDS COMPACT END 2026-05-02 */

/* AST SNMP CONSOLE ULTRA COMPACT HEADER START 2026-05-02
   Extra compact layout for SNMP console top cards.
   No fixed pixel widths; adaptive rem/vw/clamp only.
*/
body.ast-snmp-console-body {
    --ast-snmp-console-width: min(94vw, 76rem);
    --ast-snmp-console-gap: clamp(0.45rem, 0.9vw, 0.75rem);
    --ast-snmp-console-card-pad: clamp(0.55rem, 1vw, 0.8rem);
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page {
    gap: var(--ast-snmp-console-gap);
}

body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(1),
body.ast-snmp-console-body .portal-page.ast-snmp-console-page > .portal-page-card:nth-of-type(2) {
    padding: var(--ast-snmp-console-card-pad);
    border-radius: clamp(0.75rem, 1.2vw, 1rem);
}

/* Top hero: compact two-line max */
body.ast-snmp-console-body .ast-snmp-console-hero {
    display: grid;
    grid-template-columns: minmax(12rem, auto) 1fr;
    grid-template-areas:
        "kicker meta"
        "title  meta";
    column-gap: clamp(0.7rem, 1.4vw, 1.2rem);
    row-gap: 0.1rem;
    align-items: center;
}

body.ast-snmp-console-body .ast-snmp-console-hero .portal-page-kicker {
    grid-area: kicker;
    margin: 0;
    line-height: 1.05;
    font-size: clamp(0.68rem, 0.8vw, 0.78rem);
    white-space: nowrap;
}

body.ast-snmp-console-body .ast-snmp-console-hero h1 {
    grid-area: title;
    margin: 0;
    line-height: 1.02;
    font-size: clamp(1.25rem, 2.1vw, 1.8rem);
}

body.ast-snmp-console-body .ast-snmp-console-hero p {
    grid-area: meta;
    margin: 0;
    line-height: 1.25;
    font-size: clamp(0.78rem, 0.95vw, 0.92rem);
    text-align: right;
}

body.ast-snmp-console-body .ast-snmp-console-hero p strong,
body.ast-snmp-console-body .ast-snmp-console-hero p code {
    white-space: nowrap;
}

/* Launch card: compact grid */
body.ast-snmp-console-body .ast-snmp-console-card {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: clamp(0.8rem, 1.5vw, 1.25rem);
    row-gap: clamp(0.35rem, 0.7vw, 0.55rem);
    align-items: center;
}

body.ast-snmp-console-body .ast-snmp-console-card h2 {
    margin: 0;
    line-height: 1.05;
    font-size: clamp(1.05rem, 1.6vw, 1.45rem);
}

body.ast-snmp-console-body .ast-snmp-console-card .ast-snmp-console-form {
    gap: clamp(0.35rem, 0.7vw, 0.55rem);
}

body.ast-snmp-console-body .ast-snmp-console-action-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(0.3rem, 0.6vw, 0.5rem);
}

body.ast-snmp-console-body .ast-snmp-console-action-row label {
    padding: 0.28rem 0.65rem;
    font-size: clamp(0.72rem, 0.85vw, 0.82rem);
    line-height: 1.12;
}

body.ast-snmp-console-body .ast-snmp-console-fields {
    grid-template-columns:
        minmax(7rem, 0.8fr)
        minmax(8rem, 0.9fr)
        minmax(8rem, 0.9fr)
        minmax(10rem, 1fr)
        minmax(6rem, 0.7fr);
    gap: clamp(0.3rem, 0.6vw, 0.5rem);
}

body.ast-snmp-console-body .ast-snmp-console-fields input {
    padding: 0.35rem 0.6rem;
    font-size: clamp(0.72rem, 0.85vw, 0.82rem);
    line-height: 1.12;
    border-radius: 0.65rem;
}

body.ast-snmp-console-body .ast-snmp-console-actions {
    margin-top: 0;
    gap: clamp(0.35rem, 0.7vw, 0.55rem);
}

body.ast-snmp-console-body .ast-snmp-console-actions .btn,
body.ast-snmp-console-body .ast-snmp-console-actions button {
    padding: 0.36rem 0.85rem;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    line-height: 1.1;
}

body.ast-snmp-console-body .ast-snmp-console-status {
    font-size: clamp(0.72rem, 0.85vw, 0.82rem);
}

/* Console output can start closer to launch block */
body.ast-snmp-console-body .ast-snmp-console-output h2 {
    margin-top: 0;
    margin-bottom: 0.45rem;
    line-height: 1.1;
}

body.ast-snmp-console-body .ast-snmp-console-output-meta {
    margin-bottom: 0.45rem;
}

@media (max-width: 64rem) {
    body.ast-snmp-console-body .ast-snmp-console-hero {
        grid-template-columns: 1fr;
        grid-template-areas:
            "kicker"
            "title"
            "meta";
    }

    body.ast-snmp-console-body .ast-snmp-console-hero p {
        text-align: left;
    }

    body.ast-snmp-console-body .ast-snmp-console-card {
        grid-template-columns: 1fr;
    }

    body.ast-snmp-console-body .ast-snmp-console-action-row {
        grid-template-columns: 1fr;
    }

    body.ast-snmp-console-body .ast-snmp-console-fields {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    }
}
/* AST SNMP CONSOLE ULTRA COMPACT HEADER END 2026-05-02 */

/* AST SNMP CONSOLE CATCI PORTAL ACTION START 2026-05-02
   Adaptive 4-action row for SNMP live console.
*/
body.ast-snmp-console-body .ast-snmp-console-action-row {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

body.ast-snmp-console-body .ast-snmp-console-action-row label {
    min-width: 0;
}
/* AST SNMP CONSOLE CATCI PORTAL ACTION END 2026-05-02 */

/* AST SNMP CONSOLE HUMAN STEPS START 2026-05-02
   Human-readable workflow steps and status highlighting.
   Portal variables only.
*/
body.ast-snmp-console-body .ast-snmp-step-flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: clamp(0.35rem, 0.7vw, 0.6rem);
}

body.ast-snmp-console-body .ast-snmp-step-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.55rem;
    align-items: center;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    border-radius: 0.85rem;
    background: var(--ast-panel-bg, var(--portal-panel-bg, transparent));
    color: var(--ast-text, var(--portal-text, currentColor));
    cursor: pointer;
}

body.ast-snmp-console-body .ast-snmp-step-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

body.ast-snmp-console-body .ast-snmp-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    border: 1px solid var(--ast-border, var(--portal-border, currentColor));
    background: var(--ast-card-bg, var(--portal-card-bg, transparent));
    font-weight: 900;
    line-height: 1;
}

body.ast-snmp-console-body .ast-snmp-step-text {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

body.ast-snmp-console-body .ast-snmp-step-text strong {
    line-height: 1.1;
    font-size: clamp(0.78rem, 0.9vw, 0.9rem);
}

body.ast-snmp-console-body .ast-snmp-step-text small {
    color: var(--ast-muted, var(--portal-muted, currentColor));
    line-height: 1.15;
    font-size: clamp(0.68rem, 0.78vw, 0.78rem);
}

body.ast-snmp-console-body .ast-snmp-step-card--selected,
body.ast-snmp-console-body .ast-snmp-step-card--running {
    border-color: var(--ast-accent, var(--portal-accent, var(--ast-border, currentColor)));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--ast-accent, var(--portal-accent, currentColor)) 35%, transparent);
}

body.ast-snmp-console-body .ast-snmp-step-card--running .ast-snmp-step-num {
    border-color: var(--ast-accent, var(--portal-accent, currentColor));
}

body.ast-snmp-console-body .ast-snmp-step-card--done {
    border-color: color-mix(in srgb, var(--ast-accent, var(--portal-accent, currentColor)) 70%, var(--ast-border, var(--portal-border, currentColor)) 30%);
    background:
        linear-gradient(
            90deg,
            color-mix(in srgb, var(--ast-accent, var(--portal-accent, currentColor)) 12%, var(--ast-panel-bg, var(--portal-panel-bg, transparent)) 88%),
            var(--ast-panel-bg, var(--portal-panel-bg, transparent))
        );
}

body.ast-snmp-console-body .ast-snmp-step-card--failed {
    border-color: var(--ast-danger, var(--ast-border, var(--portal-border, currentColor)));
}

body.ast-snmp-console-body .ast-snmp-step-card--failed .ast-snmp-step-num {
    border-color: var(--ast-danger, var(--ast-border, var(--portal-border, currentColor)));
}

body.ast-snmp-console-body #ast-snmp-live-console-output {
    white-space: pre-wrap;
    word-break: break-word;
}
/* AST SNMP CONSOLE HUMAN STEPS END 2026-05-02 */


/* AST SNMP CONSOLE STEP SELECT STYLE START 2026-05-02
   Goal:
   - selected step must be visually obvious,
   - styling must follow portal theme variables,
   - no hardcoded one-off colors.
*/
.ast-snmp-console-page .is-selected,
.ast-snmp-console-page [data-step-selected="1"] {
    position: relative;
    border-color: var(--portal-accent, currentColor) !important;
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--portal-accent, currentColor) 10%, transparent),
            color-mix(in srgb, var(--portal-panel-bg, transparent) 86%, transparent)
        ) !important;
    box-shadow:
        0 0 0 0.12rem color-mix(in srgb, var(--portal-accent, currentColor) 45%, transparent),
        0 0.45rem 1.2rem color-mix(in srgb, var(--portal-accent, currentColor) 12%, transparent);
    transform: translateY(-0.02rem);
}

.ast-snmp-console-page .is-selected::after,
.ast-snmp-console-page [data-step-selected="1"]::after {
    content: "Выбрано";
    position: absolute;
    inset-inline-end: 0.8rem;
    inset-block-start: 0.55rem;
    padding: 0.14rem 0.5rem;
    border-radius: 999rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--portal-panel-bg, #fff);
    background: var(--portal-accent, currentColor);
    box-shadow: 0 0.15rem 0.5rem color-mix(in srgb, var(--portal-accent, currentColor) 24%, transparent);
    pointer-events: none;
}

.ast-snmp-console-page .is-selected input[type="radio"],
.ast-snmp-console-page [data-step-selected="1"] input[type="radio"] {
    accent-color: var(--portal-accent, currentColor);
}

.ast-snmp-console-page .is-selected strong,
.ast-snmp-console-page [data-step-selected="1"] strong,
.ast-snmp-console-page .is-selected .ast-step-title,
.ast-snmp-console-page [data-step-selected="1"] .ast-step-title {
    color: var(--portal-accent, currentColor) !important;
    font-weight: 800 !important;
}

.ast-snmp-console-page .is-selected .ast-step-num,
.ast-snmp-console-page [data-step-selected="1"] .ast-step-num,
.ast-snmp-console-page .is-selected .ast-snmp-console-step-num,
.ast-snmp-console-page [data-step-selected="1"] .ast-snmp-console-step-num {
    background: var(--portal-accent, currentColor) !important;
    color: var(--portal-panel-bg, #fff) !important;
    border-color: var(--portal-accent, currentColor) !important;
    box-shadow: 0 0 0 0.12rem color-mix(in srgb, var(--portal-accent, currentColor) 22%, transparent);
}

.ast-snmp-console-page .is-selected .ast-step-subtitle,
.ast-snmp-console-page [data-step-selected="1"] .ast-step-subtitle,
.ast-snmp-console-page .is-selected small,
.ast-snmp-console-page [data-step-selected="1"] small {
    color: color-mix(in srgb, var(--portal-text-color, currentColor) 78%, var(--portal-accent, currentColor) 22%) !important;
    font-weight: 600;
}

/* Fallback for pages where step cards are generic labels inside launch block */
.ast-snmp-console-page .ast-snmp-console-launch label.is-selected,
.ast-snmp-console-page .ast-snmp-console-launch label[data-step-selected="1"] {
    position: relative;
}
/* AST SNMP CONSOLE STEP SELECT STYLE END 2026-05-02 */

/* AST SNMP CONSOLE WHITE BLOB FIX START 2026-05-02
   Goal:
   - remove white spot on selected step cards,
   - keep selected state expressive,
   - use only portal theme variables.
*/
.ast-snmp-console-page .is-selected::after,
.ast-snmp-console-page [data-step-selected="1"]::after {
    content: none !important;
    display: none !important;
}

.ast-snmp-console-page .ast-snmp-console-step input[type="radio"],
.ast-snmp-console-page .ast-snmp-console-step-card input[type="radio"],
.ast-snmp-console-page .ast-snmp-console-launch-step input[type="radio"],
.ast-snmp-console-page .ast-snmp-console-launch label input[type="radio"] {
    position: absolute !important;
    inline-size: 0.0625rem !important;
    block-size: 0.0625rem !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ast-snmp-console-page .is-selected,
.ast-snmp-console-page [data-step-selected="1"] {
    border-color: var(--portal-accent, currentColor) !important;
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--portal-accent, currentColor) 12%, transparent),
            color-mix(in srgb, var(--portal-panel-bg, transparent) 88%, transparent)
        ) !important;
    box-shadow:
        0 0 0 0.1rem color-mix(in srgb, var(--portal-accent, currentColor) 28%, transparent),
        0 0.35rem 1rem color-mix(in srgb, var(--portal-accent, currentColor) 10%, transparent) !important;
}

.ast-snmp-console-page .is-selected .ast-step-num,
.ast-snmp-console-page [data-step-selected="1"] .ast-step-num,
.ast-snmp-console-page .is-selected .ast-snmp-console-step-num,
.ast-snmp-console-page [data-step-selected="1"] .ast-snmp-console-step-num {
    background: var(--portal-accent, currentColor) !important;
    color: var(--portal-panel-bg, #fff) !important;
    border-color: var(--portal-accent, currentColor) !important;
}
/* AST SNMP CONSOLE WHITE BLOB FIX END 2026-05-02 */

/* AST ADD DEVICE TOPOLOGY HINT START 2026-05-02
   Neighbor hint block for add-device wizard.
   Uses portal/theme variables only.
*/
body.ast-add-device-cacti-wizard-body .ast-add-device-topology-block {
    margin-top: clamp(0.7rem, 1.2vw, 1rem);
    padding: clamp(0.7rem, 1.2vw, 1rem);
    border: 1px solid var(--portal-border, var(--ast-border, currentColor));
    border-radius: clamp(0.75rem, 1vw, 1rem);
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--portal-accent, currentColor) 5%, transparent),
            var(--portal-panel-bg, transparent)
        );
}

body.ast-add-device-cacti-wizard-body .ast-add-device-topology-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: clamp(0.6rem, 1vw, 1rem);
    margin-bottom: clamp(0.55rem, 0.9vw, 0.8rem);
}

body.ast-add-device-cacti-wizard-body .ast-add-device-topology-head h3 {
    margin: 0 0 0.2rem;
    line-height: 1.1;
    font-size: clamp(1rem, 1.2vw, 1.2rem);
}

body.ast-add-device-cacti-wizard-body .ast-add-device-topology-head p {
    margin: 0;
}

body.ast-add-device-cacti-wizard-body .ast-add-device-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--portal-border, var(--ast-border, currentColor));
    border-radius: 999rem;
    background: var(--portal-card-bg, transparent);
    font-size: clamp(0.76rem, 0.9vw, 0.86rem);
}

body.ast-add-device-cacti-wizard-body .ast-add-device-toggle input {
    accent-color: var(--portal-accent, currentColor);
}

body.ast-add-device-cacti-wizard-body .ast-add-device-topology-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

body.ast-add-device-cacti-wizard-body .ast-add-device-topology-grid .full {
    grid-column: 1 / -1;
}

@media (max-width: 48rem) {
    body.ast-add-device-cacti-wizard-body .ast-add-device-topology-head {
        display: grid;
    }

    body.ast-add-device-cacti-wizard-body .ast-add-device-toggle {
        justify-content: center;
        white-space: normal;
    }
}
/* AST ADD DEVICE TOPOLOGY HINT END 2026-05-02 */

/* AST MAP LAYER TOGGLES CSS START 2026-05-02
   Live map layer toggles in toolbar.
   Uses portal/theme variables only.
*/
#toolbar .map-layer-toggles {
    display: inline-flex;
    align-items: center;
    gap: clamp(0.35rem, 0.7vw, 0.55rem);
    padding: 0.22rem;
    border: 1px solid var(--portal-border, var(--ast-border, currentColor));
    border-radius: 999rem;
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--portal-panel-bg, transparent) 92%, var(--portal-accent, currentColor) 8%),
            var(--portal-panel-bg, transparent)
        );
    white-space: nowrap;
}

#toolbar .map-layer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.75rem;
    padding: 0.22rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 999rem;
    color: var(--portal-text-color, inherit);
    font-size: clamp(0.74rem, 0.85vw, 0.84rem);
    line-height: 1.15;
    cursor: pointer;
    user-select: none;
}

#toolbar .map-layer-toggle:hover {
    border-color: color-mix(in srgb, var(--portal-accent, currentColor) 35%, transparent);
    background: color-mix(in srgb, var(--portal-accent, currentColor) 7%, transparent);
}

#toolbar .map-layer-toggle input {
    margin: 0;
    accent-color: var(--portal-accent, currentColor);
}

#toolbar .map-layer-toggle:has(input:checked) {
    border-color: color-mix(in srgb, var(--portal-accent, currentColor) 55%, transparent);
    background: color-mix(in srgb, var(--portal-accent, currentColor) 14%, transparent);
    color: var(--portal-accent, currentColor);
    font-weight: 700;
}

@media (max-width: 70rem) {
    #toolbar .map-layer-toggles {
        order: 3;
        width: 100%;
        justify-content: center;
        border-radius: clamp(0.75rem, 1vw, 1rem);
        flex-wrap: wrap;
        white-space: normal;
    }
}
/* AST MAP LAYER TOGGLES CSS END 2026-05-02 */

/* AST MAP LAYER MARKERS CSS START 2026-05-02
   JS draws vis-network labels on canvas. This block is kept for future legend/tooltips
   and does not override existing map layout.
*/
#toolbar .map-layer-toggle span {
    letter-spacing: 0.01em;
}
/* AST MAP LAYER MARKERS CSS END 2026-05-02 */

/* AST DISCOVERED DEVICE CARD CSS START 2026-05-02
   Compact side-card block for discovered/unmanaged nodes.
   Uses portal/theme variables only.
*/
.ast-discovered-card {
    margin: 0.75rem 0;
    padding: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--portal-accent, currentColor) 38%, var(--portal-border, currentColor));
    border-radius: 0.9rem;
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--portal-accent, currentColor) 10%, transparent),
            color-mix(in srgb, var(--portal-panel-bg, transparent) 94%, var(--portal-accent, currentColor) 6%)
        );
}

.ast-discovered-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.55rem;
}

.ast-discovered-card-title {
    font-weight: 800;
    line-height: 1.15;
}

.ast-discovered-card-subtitle {
    margin-top: 0.15rem;
    opacity: 0.78;
    font-size: 0.82rem;
    line-height: 1.25;
}

.ast-discovered-card-badge {
    flex: 0 0 auto;
    padding: 0.22rem 0.5rem;
    border: 1px solid color-mix(in srgb, var(--portal-accent, currentColor) 48%, transparent);
    border-radius: 999rem;
    background: color-mix(in srgb, var(--portal-accent, currentColor) 14%, transparent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.ast-discovered-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
    gap: 0.35rem 0.65rem;
    font-size: 0.84rem;
    line-height: 1.28;
}

.ast-discovered-card-key {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px dashed color-mix(in srgb, var(--portal-border, currentColor) 70%, transparent);
    font-size: 0.78rem;
    opacity: 0.82;
    word-break: break-word;
}

.ast-discovered-card-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.ast-discovered-cacti-btn {
    padding: 0.42rem 0.65rem;
    border: 1px solid color-mix(in srgb, var(--portal-accent, currentColor) 45%, transparent);
    border-radius: 0.7rem;
    background: color-mix(in srgb, var(--portal-accent, currentColor) 13%, transparent);
    color: var(--portal-text-color, inherit);
    font-weight: 800;
    cursor: not-allowed;
    opacity: 0.75;
}

.ast-discovered-card-actions span {
    opacity: 0.78;
    font-size: 0.78rem;
}
/* AST DISCOVERED DEVICE CARD CSS END 2026-05-02 */

/* AST DISCOVERED MANUAL IP EDITOR CSS START 2026-05-03
   Manual candidate IP editor inside discovered device side card. */
.ast-discovered-ip-form {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--ast-border-color, #334155) 72%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--ast-panel-bg, #0f172a) 88%, #ffffff 12%);
}

.ast-discovered-ip-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--ast-muted-text, #94a3b8);
}

.ast-discovered-ip-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

.ast-discovered-ip-input {
    min-width: 0;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--ast-border-color, #334155) 78%, transparent);
    border-radius: 10px;
    background: var(--ast-input-bg, rgba(15, 23, 42, .78));
    color: var(--ast-text-color, #e5e7eb);
    outline: none;
}

.ast-discovered-ip-input:focus {
    border-color: color-mix(in srgb, var(--ast-accent, #38bdf8) 80%, #ffffff 20%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ast-accent, #38bdf8) 22%, transparent);
}

.ast-discovered-ip-save-btn,
.ast-discovered-ip-clear-btn {
    border: 0;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.ast-discovered-ip-save-btn {
    background: color-mix(in srgb, var(--ast-accent, #38bdf8) 82%, #0f172a 18%);
    color: #06131f;
}

.ast-discovered-ip-clear-btn {
    background: color-mix(in srgb, #ef4444 78%, #0f172a 22%);
    color: #fff;
}

.ast-discovered-ip-hint {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--ast-muted-text, #94a3b8);
}

.ast-discovered-ip-message {
    min-height: 18px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 700;
}

.ast-discovered-ip-message.is-ok {
    color: #22c55e;
}

.ast-discovered-ip-message.is-error {
    color: #f87171;
}

@media (max-width: 720px) {
    .ast-discovered-ip-row {
        grid-template-columns: 1fr;
    }

    .ast-discovered-ip-save-btn,
    .ast-discovered-ip-clear-btn {
        width: 100%;
    }
}
/* AST DISCOVERED MANUAL IP EDITOR CSS END 2026-05-03 */

/* AST CANDIDATE IP STATUS UI CSS START 2026-05-03
   Readiness badges for discovered candidate management IP. */
.ast-candidate-ip-status {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    vertical-align: middle;
}

.ast-candidate-ip-status-manual {
    color: #052e16;
    background: #86efac;
    border-color: #22c55e;
}

.ast-candidate-ip-status-high {
    color: #052e16;
    background: #bbf7d0;
    border-color: #22c55e;
}

.ast-candidate-ip-status-medium {
    color: #422006;
    background: #fde68a;
    border-color: #f59e0b;
}

.ast-candidate-ip-status-low {
    color: #450a0a;
    background: #fecaca;
    border-color: #ef4444;
}

.ast-candidate-ip-status-none,
.ast-candidate-ip-status-unknown {
    color: var(--ast-muted-text, #94a3b8);
    background: color-mix(in srgb, var(--ast-panel-bg, #0f172a) 76%, #ffffff 24%);
    border-color: color-mix(in srgb, var(--ast-border-color, #334155) 72%, transparent);
}
/* AST CANDIDATE IP STATUS UI CSS END 2026-05-03 */

/* AST DISCOVERED RETURN AUTO IP CSS START 2026-05-03
   Button for returning manually protected candidate IP back to automatic discovery mode. */
.ast-discovered-ip-auto-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    padding: 8px;
    border-radius: 12px;
    background: color-mix(in srgb, #f59e0b 16%, var(--ast-panel-bg, #0f172a) 84%);
    border: 1px solid color-mix(in srgb, #f59e0b 48%, transparent);
}

.ast-discovered-ip-auto-btn {
    border: 0;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    color: #422006;
    background: #fde68a;
}

.ast-discovered-ip-auto-row span {
    font-size: 12px;
    line-height: 1.35;
    color: var(--ast-muted-text, #94a3b8);
}

@media (max-width: 720px) {
    .ast-discovered-ip-auto-row {
        grid-template-columns: 1fr;
    }

    .ast-discovered-ip-auto-btn {
        width: 100%;
    }
}
/* AST DISCOVERED RETURN AUTO IP CSS END 2026-05-03 */

/* AST DISCOVERED ADD TO CACTI PREFILL CSS START 2026-05-03
   Styling for discovered -> add-device wizard prefill. */
.ast-discovered-cacti-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.ast-discovered-cacti-btn.is-warning {
    background: #fde68a;
    color: #422006;
    border-color: #f59e0b;
}

.ast-add-device-discovered-prefill {
    border-color: color-mix(in srgb, #38bdf8 65%, transparent);
    background: color-mix(in srgb, #38bdf8 12%, var(--ast-panel-bg, #0f172a) 88%);
}

.ast-add-device-prefill-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--ast-muted-text, #94a3b8);
}
/* AST DISCOVERED ADD TO CACTI PREFILL CSS END 2026-05-03 */

/* AST DISCOVERED ADD TO CACTI PROFILE GUARD CSS START 2026-05-03
   Disabled state when discovered node has no reliable add-device profile. */
.ast-discovered-cacti-btn.is-disabled,
button.ast-discovered-cacti-btn.is-disabled:disabled {
    cursor: not-allowed;
    opacity: .66;
    color: var(--ast-muted-text, #94a3b8);
    background: color-mix(in srgb, var(--ast-panel-bg, #0f172a) 80%, #ffffff 20%);
    border-color: color-mix(in srgb, var(--ast-border-color, #334155) 72%, transparent);
}
/* AST DISCOVERED ADD TO CACTI PROFILE GUARD CSS END 2026-05-03 */

/* AST DISCOVERED THEME BUTTONS CSS START 2026-05-03
   Discovered-card controls must look like normal portal buttons.
   These overrides neutralize earlier local red/yellow/blue button colors. */
.ast-discovered-ip-row .btn,
.ast-discovered-card-actions .btn,
.ast-discovered-ip-auto-row .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.ast-discovered-ip-form .btn.primary.ast-discovered-ip-save-btn,
.ast-discovered-card-actions .btn.primary.ast-discovered-cacti-btn,
.ast-discovered-card-actions .btn.primary.ast-discovered-cacti-btn.is-warning {
    background: var(--ast-accent, #4f46e5) !important;
    color: var(--ast-accent-contrast, #ffffff) !important;
    border: 1px solid color-mix(in srgb, var(--ast-accent, #4f46e5) 72%, #ffffff 28%) !important;
    box-shadow: var(--ast-button-shadow, 0 8px 18px rgba(15, 23, 42, .14));
}

.ast-discovered-ip-form .btn.secondary.ast-discovered-ip-clear-btn,
.ast-discovered-ip-form .btn.secondary.ast-discovered-ip-auto-btn,
.ast-discovered-card-actions .btn.secondary.ast-discovered-cacti-btn {
    background: color-mix(in srgb, var(--ast-panel-bg, #0f172a) 78%, #ffffff 22%) !important;
    color: var(--ast-text-color, #e5e7eb) !important;
    border: 1px solid color-mix(in srgb, var(--ast-border-color, #334155) 76%, transparent) !important;
    box-shadow: var(--ast-button-shadow-soft, 0 6px 14px rgba(15, 23, 42, .10));
}

.ast-discovered-card-actions .btn.secondary.ast-discovered-cacti-btn.is-disabled,
.ast-discovered-card-actions button.btn.secondary.ast-discovered-cacti-btn.is-disabled:disabled {
    cursor: not-allowed !important;
    opacity: .62;
}

.ast-discovered-ip-form .btn:hover,
.ast-discovered-card-actions .btn:hover,
.ast-discovered-ip-auto-row .btn:hover {
    filter: brightness(1.04);
}

@media (max-width: 720px) {
    .ast-discovered-ip-row .btn,
    .ast-discovered-ip-auto-row .btn {
        width: 100%;
    }
}
/* AST DISCOVERED THEME BUTTONS CSS END 2026-05-03 */


/* AST LINK LOAD LEGEND PANEL START 2026-05-03
   Thin draggable/collapsible legend for channel-utilization coloring. */
.link-load-legend-panel {
    position: absolute;
    left: 18px;
    top: 84px;
    z-index: 870;
    width: 520px;
    max-width: calc(100vw - 36px);
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(199, 210, 254, 0.90);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.13);
    backdrop-filter: blur(8px);
}

.link-load-legend-panel.hidden,
.link-load-legend-collapsed.hidden {
    display: none !important;
}

.link-load-legend-inner,
.link-load-legend-collapsed-inner {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 24px;
    color: #334155;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.link-load-legend-title {
    color: #1e2f6f;
    font-size: 12px;
    font-weight: 900;
}

.link-load-legend-scale {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.link-load-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    color: #475569;
}

.link-load-legend-swatch {
    width: 28px;
    height: 6px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.link-load-legend-swatch-low {
    background: #22c55e;
}

.link-load-legend-swatch-medium {
    background: #eab308;
}

.link-load-legend-swatch-high {
    background: #f97316;
}

.link-load-legend-swatch-critical {
    background: #ef4444;
}

.link-load-legend-note {
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
}

#btn-hide-link-load-legend,
#btn-show-link-load-legend {
    min-height: 22px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-size: 11px;
    font-weight: 900;
    box-shadow: none;
}

.link-load-legend-collapsed {
    position: absolute;
    left: 18px;
    top: 84px;
    z-index: 871;
    max-width: calc(100vw - 36px);
}

.link-load-legend-collapsed-inner {
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(199, 210, 254, 0.90);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.13);
    backdrop-filter: blur(8px);
}

.link-load-legend-mini-scale {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border-radius: 999px;
    width: 76px;
    height: 7px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.14);
}

.link-load-legend-mini-scale span {
    display: block;
    height: 100%;
    flex: 1 1 0;
}

body.map-edit-mode .link-load-legend-panel,
body.map-edit-mode .link-load-legend-collapsed {
    cursor: move;
    outline: 2px dashed rgba(99, 102, 241, 0.45);
    outline-offset: 3px;
}

body.link-load-legend-dragging,
body.link-load-legend-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

body.theme-ast_dark .link-load-legend-panel,
body.theme-ast_dark .link-load-legend-collapsed-inner,
body.theme-noc_night .link-load-legend-panel,
body.theme-noc_night .link-load-legend-collapsed-inner {
    background: var(--ast-panel-bg, rgba(15, 23, 42, 0.92));
    border-color: var(--ast-border, rgba(122, 162, 255, 0.28));
}

body.theme-ast_dark .link-load-legend-inner,
body.theme-ast_dark .link-load-legend-collapsed-inner,
body.theme-noc_night .link-load-legend-inner,
body.theme-noc_night .link-load-legend-collapsed-inner {
    color: var(--ast-text, #dbeafe);
}

body.theme-ast_dark .link-load-legend-title,
body.theme-noc_night .link-load-legend-title {
    color: var(--ast-title, #f8fafc);
}

@media (max-width: 1100px) {
    .link-load-legend-panel {
        width: auto;
        max-width: calc(100vw - 36px);
        border-radius: 18px;
    }

    .link-load-legend-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .link-load-legend-scale {
        flex-wrap: wrap;
    }
}
/* AST LINK LOAD LEGEND PANEL END 2026-05-03 */

/* AST LEFT PANELS COMPACT STACK START 2026-05-03
   Goal:
   - make core/problems/link-load legend panels visually uniform,
   - reduce obstruction of map,
   - keep them movable in edit mode. */

#core-load-panel,
#core-load-panel-collapsed,
#problems-panel,
#problems-panel-collapsed,
#link-load-legend-panel,
#link-load-legend-collapsed {
    width: 292px !important;
    max-width: 292px !important;
    box-sizing: border-box !important;
}

#core-load-panel-content,
#core-load-panel-collapsed-content,
#problems-panel-content,
#problems-panel-collapsed-content,
#link-load-legend-panel-content,
#link-load-legend-collapsed-content {
    width: 100% !important;
    box-sizing: border-box !important;
}

#core-load-panel-content > *,
#core-load-panel-collapsed-content > *,
#problems-panel-content > *,
#problems-panel-collapsed-content > *,
#link-load-legend-panel-content > *,
#link-load-legend-collapsed-content > * {
    width: 100% !important;
    box-sizing: border-box !important;
}

.link-load-legend-panel {
    width: 292px !important;
    max-width: 292px !important;
    padding: 8px 10px !important;
}

.link-load-legend-collapsed {
    width: 292px !important;
    max-width: 292px !important;
}

.link-load-legend-inner,
.link-load-legend-collapsed-inner {
    width: 100% !important;
    box-sizing: border-box !important;
}

.link-load-legend-inner {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
}

.link-load-legend-title {
    flex: 0 0 auto !important;
}

.link-load-legend-scale {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}

.link-load-legend-note {
    margin-right: auto !important;
}

#btn-hide-link-load-legend,
#btn-show-link-load-legend {
    margin-left: auto !important;
}

#core-load-panel button,
#core-load-panel-collapsed button,
#problems-panel button,
#problems-panel-collapsed button,
#link-load-legend-panel button,
#link-load-legend-collapsed button {
    flex: 0 0 auto !important;
}

#core-load-panel,
#problems-panel,
#link-load-legend-panel {
    border-radius: 18px !important;
}

#core-load-panel-collapsed,
#problems-panel-collapsed,
#link-load-legend-collapsed {
    border-radius: 18px !important;
}

/* Optional extra compression for smaller screens */
@media (max-width: 1366px) {
    #core-load-panel,
    #core-load-panel-collapsed,
    #problems-panel,
    #problems-panel-collapsed,
    #link-load-legend-panel,
    #link-load-legend-collapsed {
        width: 280px !important;
        max-width: 280px !important;
    }
}
/* AST LEFT PANELS COMPACT STACK END 2026-05-03 */

/* AST UNIFIED MAP STATUS PANEL START 2026-05-03
   Single operator map panel: core + link-load legend + problems. */
#problems-panel,
#problems-panel-collapsed,
#link-load-legend-panel,
#link-load-legend-collapsed {
    display: none !important;
}

#core-load-panel {
    width: 430px !important;
    max-width: 430px !important;
    padding: 12px !important;
    border-radius: 22px !important;
}

#core-load-collapsed {
    width: 430px !important;
    max-width: 430px !important;
}

.unified-map-status-inner {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.unified-map-status-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.unified-map-status-title {
    font-size: 15px;
    font-weight: 950;
    color: #1e2f6f;
}

.unified-map-status-subtitle,
.unified-map-status-muted {
    font-size: 11px;
    font-weight: 750;
    color: #64748b;
}

.unified-map-status-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.unified-map-status-actions button {
    min-height: 26px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.unified-map-status-core {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 9px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.unified-map-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.unified-map-status-core.core-state-online .unified-map-status-dot {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.unified-map-status-core.core-state-offline .unified-map-status-dot {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.unified-map-status-core.core-state-warning .unified-map-status-dot {
    background: #eab308;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.20);
}

.unified-map-status-core-name {
    max-width: 185px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1e2f6f;
    font-weight: 900;
}

.unified-map-status-pill {
    padding: 3px 7px;
    border-radius: 999px;
    background: #eef2ff;
    font-size: 11px;
    font-weight: 900;
}

.unified-map-status-load {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 7px 9px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.unified-map-status-section-title {
    font-size: 12px;
    font-weight: 950;
    color: #1e2f6f;
}

.unified-map-status-load-scale {
    flex: 1 1 auto;
    min-width: 210px;
}

.unified-map-status-problems {
    padding: 8px 9px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.unified-map-status-problem-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 7px;
}

.unified-map-status-problem-total {
    min-width: 26px;
    text-align: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 950;
}

.unified-map-status-problem-total.has-problems {
    color: #991b1b;
    background: #fee2e2;
}

.unified-map-status-problem-total.is-ok {
    color: #166534;
    background: #dcfce7;
}

.unified-map-status-problem-chip {
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.unified-map-status-problem-chip.critical {
    color: #991b1b;
    background: #fee2e2;
}

.unified-map-status-problem-chip.warning {
    color: #92400e;
    background: #fef3c7;
}

.unified-map-status-problem-chip.ok {
    color: #166534;
    background: #dcfce7;
}

.unified-map-status-problem-list {
    display: grid;
    gap: 5px;
}

.unified-status-problem-row {
    padding: 6px 7px !important;
}

.unified-map-status-collapsed {
    min-height: 32px;
    padding: 6px 9px !important;
    gap: 8px !important;
    border-radius: 999px !important;
}

.unified-map-status-collapsed .link-load-legend-mini-scale {
    width: 74px;
    flex: 0 0 74px;
}

.unified-map-status-collapsed-problems {
    font-size: 11px;
    font-weight: 900;
}

.unified-map-status-collapsed-problems.has-problems {
    color: #991b1b;
}

.unified-map-status-collapsed-problems.is-ok {
    color: #166534;
}

@media (max-width: 1366px) {
    #core-load-panel,
    #core-load-collapsed {
        width: 410px !important;
        max-width: 410px !important;
    }

    .unified-map-status-core-name {
        max-width: 145px;
    }
}

body.theme-ast_dark .unified-map-status-core,
body.theme-ast_dark .unified-map-status-load,
body.theme-ast_dark .unified-map-status-problems,
body.theme-noc_night .unified-map-status-core,
body.theme-noc_night .unified-map-status-load,
body.theme-noc_night .unified-map-status-problems {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(122, 162, 255, 0.28);
}
/* AST UNIFIED MAP STATUS PANEL END 2026-05-03 */

/* AST UNIFIED MAP STATUS COMPACT OVERRIDE START 2026-05-03
   Make the unified map status panel denser:
   - channel load legend in one line;
   - smaller fonts and paddings;
   - problem cards in a compact two-column row. */

#core-load-panel {
    width: 462px !important;
    max-width: 462px !important;
    padding: 8px 10px !important;
    border-radius: 18px !important;
}

#core-load-collapsed {
    width: 462px !important;
    max-width: 462px !important;
}

.unified-map-status-inner {
    gap: 6px !important;
}

.unified-map-status-header {
    gap: 8px !important;
    align-items: center !important;
}

.unified-map-status-title {
    font-size: 13px !important;
    line-height: 1.05 !important;
}

.unified-map-status-subtitle {
    font-size: 10px !important;
    line-height: 1.05 !important;
}

.unified-map-status-actions {
    gap: 4px !important;
}

.unified-map-status-actions button {
    min-height: 24px !important;
    padding: 4px 7px !important;
    font-size: 10px !important;
}

.unified-map-status-core {
    padding: 5px 7px !important;
    gap: 5px !important;
    border-radius: 14px !important;
    min-height: 24px !important;
}

.unified-map-status-dot {
    width: 9px !important;
    height: 9px !important;
}

.unified-map-status-core strong,
.unified-map-status-core-name,
.unified-map-status-pill,
.unified-map-status-muted {
    font-size: 10px !important;
    line-height: 1.05 !important;
}

.unified-map-status-core-name {
    max-width: 170px !important;
}

.unified-map-status-pill {
    padding: 2px 6px !important;
}

.unified-map-status-snmp {
    margin-top: -2px !important;
    font-size: 9.5px !important;
}

.unified-map-status-load {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px 7px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
}

.unified-map-status-section-title {
    font-size: 10px !important;
    line-height: 1 !important;
    flex: 0 0 auto !important;
}

.unified-map-status-load-scale {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 5px !important;
    min-width: 0 !important;
    width: auto !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

.unified-map-status-load .link-load-legend-item {
    gap: 3px !important;
    flex: 0 0 auto !important;
    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.unified-map-status-load .link-load-legend-swatch {
    width: 21px !important;
    height: 5px !important;
}

.unified-map-status-load .unified-map-status-muted {
    flex: 0 0 auto !important;
    font-size: 9px !important;
    white-space: nowrap !important;
}

.unified-map-status-problems {
    padding: 6px 7px !important;
    border-radius: 14px !important;
}

.unified-map-status-problem-head {
    gap: 5px !important;
    margin-bottom: 5px !important;
}

.unified-map-status-problem-total {
    min-width: 22px !important;
    padding: 2px 6px !important;
    font-size: 10px !important;
}

.unified-map-status-problem-chip {
    padding: 2px 6px !important;
    font-size: 9.5px !important;
}

.unified-map-status-problem-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    align-items: stretch !important;
}

.unified-status-problem-row {
    min-height: 46px !important;
    padding: 6px 7px !important;
    border-radius: 12px !important;
    align-items: flex-start !important;
}

.unified-status-problem-row .problem-dot {
    width: 10px !important;
    height: 10px !important;
    margin-top: 2px !important;
    flex: 0 0 10px !important;
}

.unified-status-problem-row .problem-main {
    min-width: 0 !important;
    gap: 1px !important;
}

.unified-status-problem-row .problem-main strong {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 10.5px !important;
    line-height: 1.12 !important;
}

.unified-status-problem-row .problem-main span {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 9.5px !important;
    line-height: 1.12 !important;
}

.unified-status-problem-row .problem-main em {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 9px !important;
    line-height: 1.12 !important;
}

.unified-map-status-problem-list .problem-extra,
.unified-map-status-problem-list .problem-ok {
    grid-column: 1 / -1 !important;
    padding: 5px 7px !important;
    font-size: 10px !important;
}

.unified-map-status-collapsed {
    min-height: 26px !important;
    padding: 4px 8px !important;
    gap: 6px !important;
}

.unified-map-status-collapsed,
.unified-map-status-collapsed * {
    font-size: 10px !important;
}

.unified-map-status-collapsed .link-load-legend-mini-scale {
    width: 66px !important;
    flex-basis: 66px !important;
    height: 6px !important;
}

@media (max-width: 1366px) {
    #core-load-panel,
    #core-load-collapsed {
        width: 448px !important;
        max-width: 448px !important;
    }

    .unified-map-status-core-name {
        max-width: 150px !important;
    }

    .unified-map-status-load .link-load-legend-swatch {
        width: 18px !important;
    }

    .unified-map-status-load .link-load-legend-item {
        font-size: 9.5px !important;
    }
}
/* AST UNIFIED MAP STATUS COMPACT OVERRIDE END 2026-05-03 */

/* AST DEVICE MODEL CATALOG PAGE START 2026-05-03
   Editable vendor/model/alias directory for device classification, add-device profiles and safe auto-merge. */
.ast-device-model-catalog-page {
    width: min(1600px, calc(100vw - 28px));
    margin: 18px auto 70px;
}

.ast-model-catalog-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.ast-model-catalog-summary > div {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.54);
}

.ast-model-catalog-summary strong {
    display: block;
    font-size: 1.55rem;
    line-height: 1;
}

.ast-model-catalog-summary span {
    display: block;
    margin-top: 4px;
    opacity: 0.72;
    font-size: 0.84rem;
}

.ast-device-model-catalog-page select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.84);
    color: inherit;
}

.ast-model-editor > summary small {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ast-model-aliases {
    margin: 10px 14px 14px;
    padding: 12px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.035);
}

.ast-model-aliases h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.ast-model-alias-row {
    display: grid;
    grid-template-columns: minmax(92px, 0.7fr) minmax(230px, 2fr) minmax(130px, 1fr) 84px 74px 60px auto;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.ast-model-alias-row input[type="text"],
.ast-model-alias-row input:not([type]) {
    min-width: 0;
}

.ast-model-alias-row input {
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 8px;
    padding: 7px 8px;
}

.ast-model-alias-row label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    white-space: nowrap;
}

.ast-model-alias-add {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.28);
}

body.theme-ast_dark .ast-model-catalog-summary > div,
body.theme-noc_night .ast-model-catalog-summary > div,
body.theme-ast_dark .ast-model-aliases,
body.theme-noc_night .ast-model-aliases {
    background: rgba(15, 23, 42, 0.42);
}

body.theme-ast_dark .ast-device-model-catalog-page select,
body.theme-noc_night .ast-device-model-catalog-page select,
body.theme-ast_dark .ast-model-alias-row input,
body.theme-noc_night .ast-model-alias-row input {
    background: rgba(15, 23, 42, 0.72);
    color: #e5e7eb;
    border-color: rgba(148, 163, 184, 0.42);
}

@media (max-width: 980px) {
    .ast-model-alias-row {
        grid-template-columns: 1fr;
    }
}
/* AST DEVICE MODEL CATALOG PAGE END 2026-05-03 */

/* AST MAP FATAL ERROR START 2026-05-03 */
.ast-map-fatal-error {
    margin: 24px;
    padding: 18px 20px;
    border-radius: 14px;
    border: 1px solid rgba(220, 38, 38, 0.55);
    background: rgba(127, 29, 29, 0.16);
    font-size: 15px;
    line-height: 1.45;
    font-weight: 700;
}
/* AST MAP FATAL ERROR END 2026-05-03 */

/* AST ONU FAMILY DRAG START 2026-05-04 */
body.ast-onu-family-dragging #network {
    cursor: grabbing;
}
/* AST ONU FAMILY DRAG END 2026-05-04 */




/* AST subscriber search in map layer panel */
.map-subscriber-search {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 285px;
    margin-left: 8px;
    z-index: 60;
}

.map-subscriber-search-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.map-subscriber-search-form input[type="search"] {
    width: 210px;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid var(--ast-border-color, rgba(90, 120, 180, 0.35));
    border-radius: 999px;
    background: var(--ast-panel-bg, rgba(255, 255, 255, 0.92));
    color: var(--ast-text-color, #1f2a44);
    font-size: 12px;
    outline: none;
}

.map-subscriber-search-form input[type="search"]:focus {
    border-color: var(--ast-accent-color, #3f7cff);
    box-shadow: 0 0 0 2px rgba(63, 124, 255, 0.16);
}

.map-subscriber-search-form button {
    min-height: 24px;
    padding: 3px 10px;
    border: 1px solid var(--ast-border-color, rgba(90, 120, 180, 0.35));
    border-radius: 999px;
    background: var(--ast-button-bg, rgba(255, 255, 255, 0.96));
    color: var(--ast-text-color, #1f2a44);
    font-size: 12px;
    cursor: pointer;
}

.map-subscriber-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: min(520px, 88vw);
    max-height: 330px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--ast-border-color, rgba(90, 120, 180, 0.28));
    border-radius: 14px;
    background: var(--ast-panel-bg, rgba(255, 255, 255, 0.98));
    box-shadow: 0 16px 32px rgba(20, 35, 70, 0.18);
}

.map-subscriber-search-results.hidden {
    display: none;
}

.map-subscriber-search-row {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ast-text-color, #1f2a44);
    text-align: left;
    cursor: pointer;
}

.map-subscriber-search-row:hover,
.map-subscriber-search-row:focus {
    background: var(--ast-hover-bg, rgba(63, 124, 255, 0.10));
}

.map-subscriber-search-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.map-subscriber-search-row-main strong {
    font-size: 12px;
    line-height: 1.25;
}

.map-subscriber-search-row-main small {
    font-size: 11px;
    line-height: 1.25;
    opacity: 0.78;
}

.map-subscriber-search-row-tag {
    flex: 0 0 auto;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(63, 124, 255, 0.10);
    color: var(--ast-muted-text-color, #47607f);
}

.map-subscriber-search-empty {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--ast-muted-text-color, #47607f);
}

@media (max-width: 1100px) {
    .map-subscriber-search {
        min-width: 220px;
    }

    .map-subscriber-search-form input[type="search"] {
        width: 155px;
    }
}

/* AST subscriber search spotlight */
.map-subscriber-search-spotlight {
    position: absolute;
    width: 78px;
    height: 78px;
    margin-left: -39px;
    margin-top: -39px;
    border: 3px solid var(--ast-accent-color, #2f7cff);
    border-radius: 999px;
    box-shadow:
        0 0 0 8px rgba(47, 124, 255, 0.16),
        0 0 24px rgba(47, 124, 255, 0.55);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.72);
    z-index: 80;
}

.map-subscriber-search-spotlight.is-visible {
    animation: astSubscriberSearchSpotlightPulse 3.2s ease-out forwards;
}

@keyframes astSubscriberSearchSpotlightPulse {
    0% {
        opacity: 0;
        transform: scale(0.55);
    }

    12% {
        opacity: 1;
        transform: scale(1.05);
    }

    35% {
        opacity: 1;
        transform: scale(0.86);
    }

    65% {
        opacity: 0.92;
        transform: scale(1.18);
    }

    100% {
        opacity: 0;
        transform: scale(1.45);
    }
}

/* AST map subscriber search: vertical results, no horizontal scrolling */
#map-subscriber-search {
    overflow: visible;
}

#toolbar,
#toolbar .toolbar-info,
#toolbar .map-layer-toggles {
    overflow: visible;
}

#map-subscriber-search-results.map-subscriber-search-results {
    width: min(520px, calc(100vw - 28px));
    max-width: min(520px, calc(100vw - 28px));
    max-height: 430px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: normal;
}

#map-subscriber-search-results .map-subscriber-search-row {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    white-space: normal;
    overflow: hidden;
}

#map-subscriber-search-results .map-subscriber-search-row-main {
    display: block;
    width: 100%;
    min-width: 0;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong,
#map-subscriber-search-results .map-subscriber-search-row-main small {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong {
    margin-bottom: 3px;
}

#map-subscriber-search-results .map-subscriber-search-row-main small {
    line-height: 1.35;
}

#map-subscriber-search-results .map-subscriber-search-row-tag {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    margin-top: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
}

#map-subscriber-search-results .map-subscriber-search-empty {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* AST map subscriber search: show only human-readable billing fields */
#map-subscriber-search-results .map-subscriber-search-row-tag {
    display: none !important;
}

/* AST map subscriber search: values-only readable rows */
#map-subscriber-search-results .map-subscriber-search-row-main strong {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--ast-text-color, #152238);
}

#map-subscriber-search-results .map-subscriber-search-row-main small {
    margin-top: 3px;
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--ast-text-color, #243855);
    opacity: 0.92;
}

#map-subscriber-search-results .map-subscriber-search-row {
    padding: 9px 10px;
    border-bottom: 1px solid var(--ast-border-color, rgba(90, 120, 180, 0.18));
}

#map-subscriber-search-results .map-subscriber-search-row:last-child {
    border-bottom: 0;
}

#map-subscriber-search-results .map-subscriber-search-row-tag {
    display: none !important;
}

/* AST map subscriber search: tall readable result cards flex patch */
#map-subscriber-search-results.map-subscriber-search-results {
    width: min(660px, calc(100vw - 32px));
    max-width: min(660px, calc(100vw - 32px));
    max-height: 640px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
}

#map-subscriber-search-results .map-subscriber-search-row {
    display: block;
    width: 100%;
    min-height: 86px;
    height: auto;
    padding: 11px 13px;
    margin: 0 0 8px 0;
    border: 1px solid rgba(80, 115, 170, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-sizing: border-box;
}

#map-subscriber-search-results .map-subscriber-search-row:last-child {
    margin-bottom: 0;
}

#map-subscriber-search-results .map-subscriber-search-row-main {
    display: block;
    width: 100%;
    min-width: 0;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong {
    display: block;
    width: 100%;
    margin: 0 0 5px 0;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    color: #13233d;
    white-space: normal;
    overflow-wrap: anywhere;
}

#map-subscriber-search-results .map-subscriber-search-row-main small {
    display: block;
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

#map-subscriber-search-results .map-subscriber-search-name {
    margin-top: 2px;
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1.3;
    color: #29466d;
    opacity: 1;
}

#map-subscriber-search-results .map-subscriber-search-address {
    margin-top: 5px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.35;
    color: #536b88;
    opacity: 1;
}

#map-subscriber-search-results .map-subscriber-search-row-tag {
    display: none !important;
}

/* AST map subscriber search: tall cards readable spacing START */
#map-subscriber-search-results.map-subscriber-search-results {
    width: min(760px, calc(100vw - 20px));
    max-width: min(760px, calc(100vw - 20px));
    max-height: 72vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    box-sizing: border-box;
}

#map-subscriber-search-results .map-subscriber-search-row {
    display: block !important;
    width: 100%;
    min-height: 116px !important;
    height: auto !important;
    margin: 0 0 6px 0 !important;
    padding: 12px 16px !important;
    border-radius: 14px;
    box-sizing: border-box;
    overflow: visible !important;
}

#map-subscriber-search-results .map-subscriber-search-row:last-child {
    margin-bottom: 0 !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main {
    display: block !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong,
#map-subscriber-search-results .map-subscriber-search-row-main small {
    display: block !important;
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong {
    font-size: 13px !important;
    line-height: 1.28 !important;
    font-weight: 800 !important;
    color: #223754 !important;
    margin-bottom: 4px !important;
}

#map-subscriber-search-results .map-subscriber-search-name {
    font-size: 14px !important;
    line-height: 1.34 !important;
    font-weight: 700 !important;
    color: #345883 !important;
    margin-top: 2px !important;
}

#map-subscriber-search-results .map-subscriber-search-address {
    font-size: 12.5px !important;
    line-height: 1.38 !important;
    font-weight: 500 !important;
    color: #617a97 !important;
    margin-top: 4px !important;
}

#map-subscriber-search-results .map-subscriber-search-row-tag {
    display: none !important;
}
/* AST map subscriber search: tall cards readable spacing END */

/* AST map subscriber search: compact readable cards START */
#map-subscriber-search-results.map-subscriber-search-results {
    width: min(760px, calc(100vw - 20px));
    max-width: min(760px, calc(100vw - 20px));
    max-height: 72vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    box-sizing: border-box;
}

#map-subscriber-search-results .map-subscriber-search-row {
    display: block !important;
    width: 100%;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 0 3px 0 !important;
    padding: 4px 10px !important;
    border-radius: 10px;
    box-sizing: border-box;
    overflow: visible !important;
}

#map-subscriber-search-results .map-subscriber-search-row:last-child {
    margin-bottom: 0 !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main {
    display: block !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong,
#map-subscriber-search-results .map-subscriber-search-row-main small {
    display: block !important;
    width: 100%;
    max-width: 100%;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong {
    margin: 0 0 2px 0 !important;
    font-size: 12.5px !important;
    line-height: 1.18 !important;
    font-weight: 800 !important;
    color: #223754 !important;
}

#map-subscriber-search-results .map-subscriber-search-name {
    margin: 0 0 2px 0 !important;
    font-size: 12.5px !important;
    line-height: 1.18 !important;
    font-weight: 700 !important;
    color: #345883 !important;
}

#map-subscriber-search-results .map-subscriber-search-address {
    margin: 0 !important;
    font-size: 11.5px !important;
    line-height: 1.18 !important;
    font-weight: 500 !important;
    color: #617a97 !important;
}

#map-subscriber-search-results .map-subscriber-search-row-tag {
    display: none !important;
}
/* AST map subscriber search: compact readable cards END */

/* AST map subscriber search: final compact cards START */
#map-subscriber-search-results.map-subscriber-search-results {
    width: min(760px, calc(100vw - 20px));
    max-width: min(760px, calc(100vw - 20px));
    max-height: 72vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
    box-sizing: border-box;
}

#map-subscriber-search-results .map-subscriber-search-row {
    display: block !important;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 3px 0 !important;
    padding: 4px 10px !important;
    border-radius: 10px;
    box-sizing: border-box;
    overflow: visible !important;
}

#map-subscriber-search-results .map-subscriber-search-row:last-child {
    margin-bottom: 0 !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main {
    display: block !important;
    width: 100%;
    min-width: 0;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong,
#map-subscriber-search-results .map-subscriber-search-row-main small {
    display: block !important;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    max-height: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

#map-subscriber-search-results .map-subscriber-search-row-main strong {
    margin: 0 0 2px 0 !important;
    font-size: 12.5px !important;
    line-height: 1.18 !important;
    font-weight: 800 !important;
    color: #223754 !important;
}

#map-subscriber-search-results .map-subscriber-search-name {
    margin: 0 0 2px 0 !important;
    font-size: 12.5px !important;
    line-height: 1.18 !important;
    font-weight: 700 !important;
    color: #345883 !important;
}

#map-subscriber-search-results .map-subscriber-search-address {
    margin: 0 0 2px 0 !important;
    font-size: 11.5px !important;
    line-height: 1.18 !important;
    font-weight: 500 !important;
    color: #617a97 !important;
}

#map-subscriber-search-results .map-subscriber-search-notice {
    margin: 2px 0 0 0 !important;
    font-size: 11.5px !important;
    line-height: 1.18 !important;
    font-weight: 700 !important;
    color: #9a5a00 !important;
}

#map-subscriber-search-results .map-subscriber-search-row-tag {
    display: none !important;
}
/* AST map subscriber search: final compact cards END */

/* AST map subscriber search: binding status labels */
#map-subscriber-search-results .map-subscriber-search-notice {
    display: block !important;
    margin: 2px 0 0 0 !important;
    font-size: 11.5px !important;
    line-height: 1.18 !important;
    font-weight: 800 !important;
    color: #9a5a00 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

/* AST map subscriber search: binding status colors */
#map-subscriber-search-results .map-subscriber-search-notice.is-linked {
    color: #166534 !important;
}

#map-subscriber-search-results .map-subscriber-search-notice.is-warning {
    color: #9a5a00 !important;
}
