/* =====================================================================
   SFERONIX CARE — оформление в стиле Google Workspace (Material 3)
   Светлая и тёмная темы задаются атрибутом data-theme на <html>.
   ===================================================================== */

:root,
:root[data-theme="light"] {
    --bg: #f8fafd;
    --surface: #ffffff;
    --surface-1: #f0f4f9;
    --surface-2: #e9eef6;
    --surface-3: #dde3ea;
    --outline: #c4c7c5;
    --outline-variant: #e1e3e1;
    --text: #1f1f1f;
    --text-2: #444746;
    --text-3: #5f6368;
    --primary: #0b57d0;
    --on-primary: #ffffff;
    --primary-container: #d3e3fd;
    --on-primary-container: #041e49;
    --success: #146c2e;
    --success-container: #c4eed0;
    --danger: #b3261e;
    --danger-container: #f9dedc;
    --warning: #7a5900;
    --warning-container: #ffefc9;
    --hover: rgba(68, 71, 70, .08);
    --pressed: rgba(68, 71, 70, .12);
    --scrim: rgba(0, 0, 0, .32);
    --shadow-1: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
    --shadow-3: 0 4px 8px 3px rgba(60, 64, 67, .15), 0 1px 3px rgba(60, 64, 67, .3);
    --tooltip-bg: #3c4043;
    --tooltip-text: #ffffff;
    --chart-1: #9aa0a6;
    --chart-2: #1a73e8;
    --chart-3: #12b5cb;
    --chart-grid: #e1e3e1;
    --chart-text: #5f6368;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #131314;
    --surface: #1e1f20;
    --surface-1: #282a2c;
    --surface-2: #333537;
    --surface-3: #3c3f41;
    --outline: #8e918f;
    --outline-variant: #444746;
    --text: #e3e3e3;
    --text-2: #c4c7c5;
    --text-3: #9aa0a6;
    --primary: #a8c7fa;
    --on-primary: #062e6f;
    --primary-container: #004a77;
    --on-primary-container: #c2e7ff;
    --success: #6dd58c;
    --success-container: #0f5223;
    --danger: #f2b8b5;
    --danger-container: #8c1d18;
    --warning: #fdd663;
    --warning-container: #4d3a00;
    --hover: rgba(227, 227, 227, .08);
    --pressed: rgba(227, 227, 227, .12);
    --scrim: rgba(0, 0, 0, .6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
    --shadow-3: 0 4px 8px 3px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .4);
    --tooltip-bg: #e3e3e3;
    --tooltip-text: #1f1f1f;
    --chart-1: #9aa0a6;
    --chart-2: #8ab4f8;
    --chart-3: #78d9ec;
    --chart-grid: #3c3f41;
    --chart-text: #9aa0a6;
    color-scheme: dark;
}

/* ---------------------------------------------------------------- база */
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Google Sans", "Google Sans Text", Roboto, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
}
h1, h2, h3, h4, h5 { color: var(--text); font-family: inherit; margin: 0; }
p { margin: 0 0 4px; font-size: 14px; line-height: 1.5; }
a { color: var(--primary); }
a:hover, a:focus { color: var(--primary); text-decoration: underline; }
::selection { background: var(--primary-container); color: var(--on-primary-container); }
.muted { color: var(--text-3); }
.text-danger { color: var(--danger) !important; }

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    user-select: none;
    vertical-align: middle;
    font-variation-settings: 'FILL' 0;
}
.material-symbols-outlined.filled { font-variation-settings: 'FILL' 1; }

/* ---------------------------------------------------------------- каркас */
.ws-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: 64px;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px 0 8px;
    background: var(--bg);
    transition: background-color .2s ease, box-shadow .2s ease;
}
.ws-topbar.scrolled { box-shadow: var(--shadow-1); }
.ws-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    height: 48px;
    text-decoration: none !important;
    color: var(--text-2) !important;
}
.ws-brand img { width: 32px; height: 32px; }
.ws-brand-name { font-size: 22px; font-weight: 500; color: var(--text); letter-spacing: -.2px; }
.ws-brand-product { font-size: 22px; color: var(--text-2); }
.ws-topbar-spacer { flex: 1; }

.ws-nav {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 256px;
    padding: 8px 12px 16px 0;
    overflow-y: auto;
    z-index: 1020;
    background: var(--bg);
    transition: transform .2s ease, width .2s ease, background-color .2s ease, visibility .2s;
}
.ws-nav-item {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 48px;
    padding: 0 12px 0 24px;
    margin-bottom: 2px;
    border-radius: 0 24px 24px 0;
    color: var(--text-2);
    font-weight: 500;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
}
.ws-nav-item:hover { background: var(--hover); color: var(--text); }
.ws-nav-item.active { background: var(--primary-container); color: var(--on-primary-container); }
.ws-nav-item.active .material-symbols-outlined { font-variation-settings: 'FILL' 1; }

.ws-main {
    margin-left: 256px;
    padding: 80px 24px 32px 8px;
    min-height: 100vh;
    transition: margin-left .2s ease;
}
.ws-scrim { display: none; }

/* свернутое меню на широком экране — узкая «рельса» с иконками */
@media (min-width: 1024px) {
    .nav-collapsed .ws-nav { width: 80px; padding-right: 12px; }
    .nav-collapsed .ws-nav-item { border-radius: 24px; padding: 0; justify-content: center; margin-left: 12px; width: 56px; }
    .nav-collapsed .ws-nav-label { display: none; }
    .nav-collapsed .ws-main { margin-left: 80px; }
}

/* узкий экран — меню выезжает поверх контента */
@media (max-width: 1023px) {
    .ws-nav {
        transform: translateX(-100%);
        background: var(--surface);
        visibility: hidden;
        top: 0;
        padding-top: 72px;
        border-radius: 0 16px 16px 0;
        z-index: 1040;
    }
    .nav-open .ws-nav { transform: none; visibility: visible; box-shadow: var(--shadow-3); }
    .nav-open .ws-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 1035; }
    .nav-open .ws-topbar { z-index: 1045; background: transparent; }
    .ws-main { margin-left: 0; padding: 80px 16px 24px; }
    .ws-brand-product { display: none; }
}

/* ---------------------------------------------------------------- кнопки */
.icon-btn {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: none;
    transition: background-color .15s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { background: var(--pressed); }
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm .material-symbols-outlined { font-size: 20px; }

.btn {
    border-radius: 20px;
    height: 40px;
    padding: 0 24px;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: .1px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: none !important;
    transition: background-color .15s, box-shadow .15s, color .15s;
    white-space: nowrap;
}
.btn .material-symbols-outlined { font-size: 18px; margin-left: -8px; }
.btn:focus, .btn:active:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary, .btn-primary:focus { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: var(--shadow-1) !important; filter: brightness(1.08); }
.btn-tonal, .btn-tonal:focus { background: var(--primary-container); color: var(--on-primary-container); }
.btn-tonal:hover { background: var(--primary-container); color: var(--on-primary-container); box-shadow: var(--shadow-1) !important; }
.btn-outline, .btn-outline:focus, .btn-default, .btn-secondary {
    background: transparent; color: var(--primary); border-color: var(--outline);
}
.btn-outline:hover, .btn-default:hover, .btn-secondary:hover { background: var(--hover); color: var(--primary); border-color: var(--outline); }
.btn-text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn-text:hover { background: var(--hover); color: var(--primary); }
.btn-danger, .btn-danger:focus { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--surface); filter: brightness(1.08); }
.btn-sm { height: 32px; padding: 0 16px; font-size: 13px; }

/* сегментированная кнопка (периоды, месяц/рік) */
.segmented { display: inline-flex; border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; }
.segmented button {
    height: 40px; padding: 0 20px; border: 0; background: transparent; color: var(--text);
    font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.segmented button + button { border-left: 1px solid var(--outline); }
.segmented button:hover { background: var(--hover); }
.segmented button.active { background: var(--primary-container); color: var(--on-primary-container); }
.segmented button.active::before {
    content: 'check'; font-family: 'Material Symbols Outlined'; font-size: 18px; font-feature-settings: 'liga';
}

/* чипы */
.chip {
    display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px;
    border-radius: 8px; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
    background: var(--surface-2); color: var(--text-2); vertical-align: middle;
}
.chip-ok { background: var(--success-container); color: var(--success); }
.chip-off { background: var(--danger-container); color: var(--danger); }
.chip-vpn, .chip-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.chip-warn { background: var(--warning-container); color: var(--warning); }

.filter-chip {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 16px;
    border: 1px solid var(--outline); border-radius: 8px; color: var(--text-2); font-weight: 500;
    cursor: pointer; user-select: none; margin: 0; background: transparent; white-space: nowrap;
}
.filter-chip input { display: none; }
.filter-chip .material-symbols-outlined { font-size: 18px; }
.filter-chip:hover { background: var(--hover); }
.filter-chip.checked { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }

/* ---------------------------------------------------------------- поля ввода */
.form-control {
    height: 48px;
    border-radius: 8px;
    border: 1px solid var(--outline);
    background: var(--surface);
    color: var(--text);
    box-shadow: none;
    font-size: 14px;
    padding: 0 16px;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.form-control::placeholder { color: var(--text-3); }
select.form-control { padding-right: 32px; }

.search-field {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 48px;
    padding: 0 4px 0 12px;
    border-radius: 24px;
    background: var(--surface-2);
    color: var(--text-2);
    flex: 1;
    min-width: 200px;
    transition: background-color .15s, box-shadow .15s;
}
.search-field:focus-within { background: var(--surface); box-shadow: var(--shadow-1); }
.search-field input {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
    color: var(--text); font-size: 16px; font-family: inherit;
}
.search-field input::placeholder { color: var(--text-3); }
.search-field .clear { visibility: hidden; }
.search-field.has-value .clear { visibility: visible; }

/* ---------------------------------------------------------------- карточки */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 20px; }
.page-head h1 { font-size: 28px; line-height: 36px; font-weight: 400; }
.page-head .subtitle { color: var(--text-3); margin-top: 2px; }

.card {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px 24px;
    border: 1px solid var(--outline-variant);
    transition: background-color .2s ease, border-color .2s ease;
}
:root[data-theme="dark"] .card { border-color: transparent; }
.card-title { font-size: 16px; font-weight: 500; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-title .muted { font-weight: 400; font-size: 13px; }

.dash-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.dash-grid .span-3 { grid-column: span 3; }
@media (max-width: 1199px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid .span-3 { grid-column: span 2; } }
@media (max-width: 599px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .dash-grid .span-3 { grid-column: auto; } }

.stat-card {
    display: flex; align-items: center; gap: 16px; padding: 20px 24px; text-align: left;
    font: inherit; color: inherit; width: 100%;
}
button.stat-card { cursor: pointer; }
button.stat-card:hover { background: var(--surface-1); }
button.stat-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 50%; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-container); color: var(--on-primary-container);
}
.stat-icon.green { background: var(--success-container); color: var(--success); }
.stat-icon.amber { background: var(--warning-container); color: var(--warning); }
.stat-icon.gray { background: var(--surface-2); color: var(--text-2); }
.stat-value { font-size: 32px; line-height: 40px; font-weight: 400; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-3); font-size: 14px; }
.stat-card .chevron { margin-left: auto; color: var(--text-3); }

.chart-box { height: 240px; position: relative; overflow: hidden; min-width: 0; }

/* ---------------------------------------------------------------- таблицы */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .count { color: var(--text-3); white-space: nowrap; }

.table-wrap { overflow-x: auto; margin: 0 -24px -20px; padding: 0 24px 8px; }
.table { margin: 0; color: var(--text); background: transparent; }
.table > thead > tr > th {
    border-bottom: 1px solid var(--outline-variant) !important;
    border-top: 0 !important;
    color: var(--text-2);
    font-weight: 500;
    font-size: 13px;
    padding: 12px 12px;
    white-space: nowrap;
    vertical-align: middle;
    background: transparent;
}
.table > tbody > tr > td, .table > tfoot > tr > td {
    border-top: 0 !important;
    border-bottom: 1px solid var(--outline-variant);
    padding: 10px 12px;
    vertical-align: middle;
}
.table > tbody > tr:hover > td { background: var(--hover); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-bordered, .table-bordered > thead > tr > th, .table-bordered > tbody > tr > td { border-left: 0; border-right: 0; }
.table-striped > tbody > tr:nth-child(odd) > td { background: transparent; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 500; background: var(--surface-1); }
.data-table tr.row-click { cursor: pointer; }

.vm-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.vm-name .os-icon { width: 16px; height: 16px; }
.memory-pressure-warning > td { background: var(--warning-container) !important; }
.ram-icon { color: var(--warning); font-size: 20px; }
.disk-column { text-align: center; }
.th-btn { border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 12px; padding: 0 4px; cursor: pointer; border-radius: 8px; }
.th-btn:hover { background: var(--hover); }
.row-actions { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.row-actions a.icon-btn { text-decoration: none; }

.circle, .status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.circle { margin-right: 4px; }
.circle.active, .circle.online, .status-dot.green { background: #1e8e3e; box-shadow: 0 0 0 3px rgba(30, 142, 62, .18); }
.circle.inactive, .status-dot.red { background: #d93025; box-shadow: 0 0 0 3px rgba(217, 48, 37, .18); }
.circle.offline { background: var(--text-3); }
.disabled-user-row { opacity: .55; }

/* RDP */
.rdp-control { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; }
.rdp-square { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 500; }
.rdp-square.open { background: var(--success-container); color: var(--success); }
.rdp-square.closed { background: var(--danger-container); color: var(--danger); }
.rdp-toggle.act-close { color: var(--danger); }
.rdp-toggle.act-open { color: var(--success); }

/* ---------------------------------------------------------------- модальные окна */
.modal-backdrop.in { opacity: 1; background: var(--scrim); }
.modal-backdrop { background: transparent; }
.modal-content {
    background: var(--surface-1);
    color: var(--text);
    border: 0;
    border-radius: 28px;
    box-shadow: var(--shadow-3);
}
:root[data-theme="light"] .modal-content { background: var(--surface); }
.modal-header { border-bottom: 0; padding: 24px 24px 8px; display: flex; align-items: center; gap: 8px; }
.modal-header .modal-title { font-size: 22px; line-height: 28px; font-weight: 400; flex: 1; }
.modal-body { padding: 8px 24px 16px; }
.modal-footer { border-top: 0; padding: 8px 24px 24px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-footer .btn + .btn { margin-left: 0; }
.modal-dialog { margin: 48px auto; }
.modal-dialog.modal-wide { width: auto; max-width: 1100px; margin-left: 16px; margin-right: 16px; }
@media (min-width: 1132px) { .modal-dialog.modal-wide { margin-left: auto; margin-right: auto; } }
@media (min-width: 768px) { .modal-dialog.modal-sm2 { width: 420px; } }

/* Технические характеристики */
.noteinfo { color: var(--text-3); font-size: 13px; margin: 4px 0 12px; }
.tech-section { margin-bottom: 20px; }
.tech-section header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tech-section h3 { font-size: 16px; font-weight: 500; }
.tech-section .total { color: var(--primary); font-weight: 500; }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tech-card {
    display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--outline-variant); border-radius: 12px;
}
:root[data-theme="dark"] .tech-card { background: var(--surface-2); border-color: transparent; }
.tech-icon {
    width: 40px; height: 40px; flex: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-container); color: var(--on-primary-container); font-size: 20px;
}
.tech-body { min-width: 0; flex: 1; word-break: break-word; }
.tech-body p { margin: 0 0 2px; }
.flag { height: 14px; border-radius: 2px; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); }
.disk-bar { width: 100%; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin: 8px 0 6px; }
.disk-usage { height: 100%; width: 0; border-radius: 2px; background: var(--primary); transition: width .4s ease; }
.disk-usage.warn { background: #f9ab00; }
.disk-usage.crit { background: #d93025; }

/* Пользователи */
.user-counts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.info-header { color: var(--text-3); }
.max-rdp-sessions { color: var(--primary); font-weight: 500; }

/* VPN */
.vpn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.node-card { padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--outline-variant); }
:root[data-theme="dark"] .node-card { background: var(--surface-2); border-color: transparent; }
.node-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.node-header h2 { font-size: 16px; font-weight: 500; word-break: break-all; }
.agent-ips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ip-item { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--surface-1); font-family: "Roboto Mono", Consolas, monospace; font-size: 13px; }
:root[data-theme="dark"] .ip-item { background: var(--surface-3); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin-top: 8px; }
.metric { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.metric .material-symbols-outlined { font-size: 18px; color: var(--text-3); }
.metric b { color: var(--text); font-weight: 500; }
.interfaces-list { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13px; color: var(--text-2); }
.vm-list { margin-top: 8px; font-size: 13px; color: var(--text-3); }
.vm-tag {
    display: inline-flex; align-items: center; height: 28px; padding: 0 12px; margin: 4px 4px 0 0;
    border-radius: 8px; border: 1px solid var(--outline); color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 500;
}
.vm-tag:hover { background: var(--hover); }
.fi { width: 20px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }

/* ---------------------------------------------------------------- индикаторы */
.progress-linear { height: 4px; background: var(--primary-container); overflow: hidden; border-radius: 2px; position: relative; visibility: hidden; }
.progress-linear.on { visibility: visible; }
.progress-linear::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
    background: var(--primary); border-radius: 2px; animation: progress-slide 1.2s ease-in-out infinite;
}
@keyframes progress-slide { from { left: -40%; } to { left: 100%; } }

.spinner {
    width: 40px; height: 40px; margin: 40px auto; border-radius: 50%;
    border: 4px solid var(--primary-container); border-top-color: var(--primary);
    animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; color: var(--text-3); padding: 32px 16px; }

.ws-snackbar {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 24px);
    min-width: 288px; max-width: calc(100vw - 32px); padding: 14px 16px; border-radius: 4px;
    background: var(--tooltip-bg); color: var(--tooltip-text); box-shadow: var(--shadow-3);
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 2000;
}
.ws-snackbar.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- Bootstrap: тултипы, close */
.tooltip-inner { background: var(--tooltip-bg); color: var(--tooltip-text); border-radius: 4px; font-size: 12px; padding: 6px 8px; max-width: 280px; }
.tooltip.top .tooltip-arrow { border-top-color: var(--tooltip-bg); }
.tooltip.bottom .tooltip-arrow { border-bottom-color: var(--tooltip-bg); }
.tooltip.left .tooltip-arrow { border-left-color: var(--tooltip-bg); }
.tooltip.right .tooltip-arrow { border-right-color: var(--tooltip-bg); }
.tooltip.in { opacity: 1; }
.hidden { display: none !important; }

/* Morris */
.morris-hover.morris-default-style {
    background: var(--surface) !important; color: var(--text); border: 0 !important; border-radius: 8px !important;
    box-shadow: var(--shadow-3); font-family: inherit; font-size: 12px; padding: 8px 12px;
}
.morris-hover.morris-default-style .morris-hover-row-label { color: var(--text); font-weight: 500; }

/* ---------------------------------------------------------------- страницы статистики */
.period-nav { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 0 20px; }
.period-label {
    min-width: 220px; height: 48px; padding: 0 24px; border-radius: 24px; border: 0; cursor: pointer;
    background: var(--surface-2); color: var(--text); font: inherit; font-size: 18px; font-weight: 500;
}
.period-label:hover { background: var(--surface-3); }
.period-nav select.form-control { min-width: 220px; height: 48px; border-radius: 24px; font-size: 16px; width: auto; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stats-card { padding: 24px; }
.stats-card .stat-icon { margin-bottom: 16px; }
.stats-card h3 { font-size: 14px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.stats-card .value { font-size: 32px; line-height: 40px; font-weight: 400; font-variant-numeric: tabular-nums; }
.stats-card .value small { font-size: 14px; color: var(--text-3); }
.stats-card .error { color: var(--danger); font-size: 14px; }

.narrow { max-width: 1040px; margin: 0 auto; }

/* Довідник */
.guide-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .guide-grid { grid-template-columns: minmax(0, 1fr); } }
.result-card { padding: 16px 20px; border-radius: 12px; background: var(--surface-1); margin-bottom: 8px; }
.result-card .position { font-size: 16px; font-weight: 500; margin: 8px 0 4px; color: var(--text); }
.result-card p { color: var(--text-2); margin: 0; }
.codes { margin: 0; padding: 0; list-style: none; }
.codes li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--outline-variant); color: var(--text-2); }
.codes li:last-child { border-bottom: 0; }
.codes b { min-width: 48px; color: var(--text); font-weight: 500; }

/* ---------------------------------------------------------------- Пакети годин */
.pkg-slot:empty { display: none; }
.pkg-badge {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 28px; padding: 7px 6px 0; margin-left: 6px; border: 0; border-radius: 6px;
    background: var(--primary-container); color: var(--on-primary-container);
    box-shadow: inset 0 0 0 1.5px currentColor; cursor: pointer;
    font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
    transition: transform .1s, box-shadow .15s;
}
/* крышка коробки и полоска скотча */
.pkg-badge::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 7px; border-radius: 6px 6px 0 0; background: currentColor; }
.pkg-badge::after { content: ''; position: absolute; top: 0; left: 50%; width: 6px; height: 7px; transform: translateX(-50%); background: inherit; }
.pkg-badge:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1.5px currentColor, var(--shadow-1); }
.pkg-badge.expired { background: #d93025; color: #fff; }
:root[data-theme="dark"] .pkg-badge.expired { background: #b3261e; }

.pkg-form { margin-bottom: 12px; padding: 16px; }
.pkg-form-row, .pkg-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pkg-form-row select { flex: 1; min-width: 220px; }
.pkg-hours { width: 110px; }
.pkg-form .form-control, .pkg-inline .form-control { height: 40px; }
.pkg-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.pkg-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.pkg-inline select { width: auto; min-width: 200px; }
#pkg-list .chip + .chip { margin-left: 2px; }

/* ---------------------------------------------------------------- меню: раскрывающиеся разделы */
.ws-nav-group-btn { width: 100%; border: 0; background: transparent; font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.ws-nav-group-btn .ws-nav-label { flex: 1; }
.ws-nav-caret { font-size: 20px; transition: transform .2s; }
.ws-nav-group.open .ws-nav-caret { transform: rotate(180deg); }
.ws-nav-children { display: none; }
.ws-nav-group.open .ws-nav-children { display: block; }
.ws-nav-sub { padding-left: 40px; height: 40px; font-weight: 400; }
.ws-nav-sub .material-symbols-outlined { font-size: 20px; }
@media (min-width: 1024px) {
    /* в свернутой «рельсе» заголовок раздела прячем, подпункты показываем иконками */
    .nav-collapsed .ws-nav-group-btn { display: none; }
    .nav-collapsed .ws-nav-children { display: block; }
    .nav-collapsed .ws-nav-sub { padding: 0; height: 48px; }
}

/* ---------------------------------------------------------------- ДБЖ */
.ups-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.ups-date-bad { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-weight: 500; }
.ups-date-bad .material-symbols-outlined { font-size: 18px; }
.ups-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.ups-form label { display: block; margin: 0; font-weight: 500; font-size: 12px; color: var(--text-2); }
.ups-form label .form-control { margin-top: 4px; height: 44px; font-weight: 400; }
.ups-form .full { grid-column: 1 / -1; }
@media (max-width: 599px) { .ups-form { grid-template-columns: 1fr; } }
#ups-company { width: auto; min-width: 220px; height: 48px; border-radius: 24px; }

/* ---------------------------------------------------------------- My Cloud */
.mc-link { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.mc-link label { margin: 0; font-weight: 500; font-size: 12px; color: var(--text-2); }
.mc-link .form-control { margin-top: 4px; height: 44px; }
@media (max-width: 767px) { .mc-link { grid-template-columns: 1fr; } }
.mc-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mc-user { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--outline-variant); background: var(--surface); }
:root[data-theme="dark"] .mc-user { background: var(--surface-1); border-color: transparent; }
.mc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover;
    display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 16px;
    background: var(--primary-container); color: var(--on-primary-container); }
.mc-user-body { min-width: 0; flex: 1; }
.mc-user-name { font-weight: 500; }
.mc-user-email { color: var(--text-3); font-size: 13px; word-break: break-all; }
.mc-user .chip { margin: 6px 4px 0 0; white-space: normal; height: auto; min-height: 24px; padding: 3px 10px; }

/* Клієнтські VM: компанія — праворуч, впритул до «Користувачі»; небезпечні клієнти — червона плашка */
#servers-table .col-company { text-align: right; white-space: nowrap; width: 1%; }
.chip-danger { background: #d93025; color: #fff; font-weight: 500; }
:root[data-theme="dark"] .chip-danger { background: #b3261e; color: #fff; }
/* «Користувачі» — не ширше заголовка (лишній простір віддається колонці «Назва») */
#servers-table .col-users { width: 1%; white-space: nowrap; }
#servers-table th:last-child, #servers-table td:last-child { width: 1%; white-space: nowrap; }
/* Фільтр «Небезпечні» */
.filter-chip.filter-danger .material-symbols-outlined { color: var(--danger); }
.filter-chip.filter-danger .cnt:not(:empty) { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #d93025; color: #fff;
    font-size: 12px; line-height: 20px; text-align: center; }
.filter-chip.filter-danger.checked { background: var(--danger-container); color: var(--danger); }
/* IP, з якого нас бачать */
.chip-ip { cursor: help; margin-left: 4px; }
.chip-ip-danger { background: #d93025; color: #fff; font-weight: 500; }
.chip-ip-shared { background: #fbbc04; color: #202124; font-weight: 500; }
:root[data-theme="dark"] .chip-ip-danger { background: #b3261e; color: #fff; }
:root[data-theme="dark"] .chip-ip-shared { background: #f9ab00; color: #202124; }

/* ===== Вхід через Google: користувач у верхній панелі ===== */
.ws-user { display: inline-flex; align-items: center; gap: 8px; margin: 0 4px 0 8px; max-width: 220px; }
.ws-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.ws-avatar-letter { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary);
    font-weight: 500; font-size: 15px; }
.ws-user-name { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .ws-user-name { display: none; } .ws-user { margin-left: 4px; } }

/* ===== Сторінка входу (/login.php) ===== */
.signin-page { background: var(--bg); color: var(--text); margin: 0; font-family: Roboto, "Segoe UI", Arial, sans-serif; }
.signin { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; box-sizing: border-box; }
.signin-card { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; width: 100%; max-width: 1040px; box-sizing: border-box;
    background: var(--surface); border-radius: 28px; padding: 40px; }
.signin-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 32px; }
.signin-brand img { width: 40px; height: 40px; object-fit: contain; }
.signin-brand .ws-brand-name { font-size: 22px; font-weight: 500; color: var(--text-2); }
.signin-brand .ws-brand-product { font-size: 22px; color: var(--text-3); }
.signin-intro h1 { margin: 0 0 12px; font-size: 36px; line-height: 44px; font-weight: 400; }
.signin-subtitle { margin: 0; font-size: 16px; line-height: 24px; color: var(--text-2); }
.signin-form { display: flex; flex-direction: column; justify-content: center; padding-top: 72px; }
.signin-text { margin: 0 0 24px; font-size: 15px; line-height: 22px; color: var(--text-2); }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: 44px; padding: 0 24px; align-self: flex-start;
    border: 1px solid var(--outline); border-radius: 22px; background: var(--surface); color: var(--text); font-size: 15px; font-weight: 500;
    text-decoration: none; transition: background .15s, box-shadow .15s; }
.btn-google:hover, .btn-google:focus-visible { background: var(--surface-1); box-shadow: var(--shadow-1); color: var(--text); text-decoration: none; }
.btn-google.disabled { opacity: .45; pointer-events: none; }
.signin-hint { margin: 16px 0 0; font-size: 13px; color: var(--text-3); }
.signin-notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 20px; border-radius: 12px; font-size: 14px; line-height: 20px; }
.signin-notice .material-symbols-outlined { font-size: 20px; flex: none; }
.signin-notice-error { background: var(--danger-container); color: var(--danger); }
.signin-notice-info { background: var(--primary-container); color: var(--on-primary-container); }
.signin-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; max-width: 1040px;
    padding: 12px 8px; box-sizing: border-box; font-size: 12px; color: var(--text-3); }
@media (max-width: 760px) {
    .signin-card { grid-template-columns: 1fr; gap: 8px; padding: 28px 24px; }
    .signin-form { padding-top: 16px; }
    .btn-google { align-self: stretch; }
}

/* ===== Входи на сайт ===== */
.ev-chip { display: inline-block; padding: 2px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.ev-login { background: var(--success-container); color: var(--success); }
.ev-logout, .ev-expired { background: var(--surface-2); color: var(--text-2); }
.ev-revoked { background: var(--warning-container); color: var(--warning); }
.ev-denied, .ev-error { background: var(--danger-container); color: var(--danger); }
.ua-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 13px; }
.nw { white-space: nowrap; }
.toolbar .lg-select { width: auto; flex: none; }

/* ===== Планування ВМ (hv_plan.php) ===== */
.hp-bar { margin-bottom: 16px; }
.hp-plan { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 16px 14px; font-size: 13px; }
.hp-move { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 8px; background: var(--primary-container);
    color: var(--on-primary-container); white-space: nowrap; }
.hp-move.bad { background: var(--danger-container); color: var(--danger); padding-right: 10px; }
.hp-move .material-symbols-outlined { font-size: 16px; }
.hp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; align-items: start; }
.hp-host { background: var(--surface); border: 2px solid transparent; border-radius: 16px; padding: 10px 10px 8px; box-shadow: var(--shadow-1);
    transition: border-color .12s, background-color .12s; min-width: 0; }
.hp-host.over { border-color: var(--danger); }
.hp-host.down .hp-host-name { color: var(--text-3); }
.hp-grid.is-dragging .hp-host, .hp-grid.has-selected .hp-host { border-style: dashed; border-color: var(--outline-variant); cursor: copy; }
.hp-grid .hp-host.drop { border-style: solid; border-color: var(--primary); background: var(--surface-1); }
.hp-host-head { display: flex; align-items: center; gap: 6px; margin: 0 2px 6px; min-width: 0; }
.hp-host-name { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-host-head .chip { font-size: 11px; padding: 0 6px; line-height: 18px; }
.hp-host-count { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.hp-meters { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.hp-meter-row { display: flex; align-items: baseline; gap: 6px; font-size: 12px; line-height: 16px; }
.hp-meter-label { width: 52px; flex: none; color: var(--text-3); }
.hp-meter-val { color: var(--text-2); white-space: nowrap; }
.hp-meter.over .hp-meter-val, .hp-meter.over .hp-meter-val b { color: var(--danger); }
.hp-delta { font-size: 11px; font-weight: 500; padding: 0 5px; border-radius: 6px; white-space: nowrap; }
.hp-delta.minus { background: var(--success-container); color: var(--success); }
.hp-delta.plus { background: var(--warning-container); color: var(--warning); }
.hp-meter-row .hp-delta { margin-left: auto; }
.hp-track { position: relative; height: 6px; margin-top: 2px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.hp-fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--primary); border-radius: 3px; }
.hp-fill.freed { background: repeating-linear-gradient(135deg, var(--success) 0 3px, transparent 3px 6px); opacity: .9; border-radius: 0; }
.hp-fill.added { background: #f9ab00; border-radius: 0; }
.hp-meter.over .hp-fill { background: var(--danger); }
.hp-meter.over .hp-fill.freed { background: repeating-linear-gradient(135deg, var(--success) 0 3px, transparent 3px 6px); }
.hp-cap { position: absolute; top: -1px; bottom: -1px; width: 2px; background: var(--text); }
.hp-warn { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--danger); }
.hp-warn .material-symbols-outlined { font-size: 16px; }
.hp-vms { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--outline-variant); padding-top: 6px; }
.hp-vm { display: flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 4px 0 0; border-radius: 8px; font-size: 13px; cursor: grab;
    user-select: none; background: transparent; }
.hp-vm:hover { background: var(--hover); }
.hp-vm.dragging { opacity: .35; }
.hp-vm.selected { background: var(--primary-container); color: var(--on-primary-container); }
.hp-vm.moved { background: color-mix(in srgb, #f9ab00 16%, transparent); }
.hp-vm.moved.selected { background: var(--primary-container); }
.hp-grip { font-size: 16px; color: var(--text-3); flex: none; }
.hp-vm-name { min-width: 0; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-vm-res { flex: none; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hp-from { flex: none; font-size: 11px; color: var(--warning); white-space: nowrap; }
.hp-undo { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0;
    border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.hp-undo:hover { background: var(--pressed); }
.hp-undo .material-symbols-outlined { font-size: 16px; }
.hp-empty { padding: 10px 4px; font-size: 12px; color: var(--text-3); text-align: center; }
.hp-bar .search-field { flex: 0 1 280px; min-width: 160px; }
.hp-bar .toolbar { flex-wrap: wrap; row-gap: 8px; }
.hp-bar .search-field { flex: 0 1 280px; min-width: 160px; }
.hp-bar .toolbar { flex-wrap: wrap; row-gap: 8px; }
/* Планування ВМ: тінь на старому місці, кольорові лінії до нового */
.hp-grid { position: relative; }
.hp-links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; z-index: 3; }
.hp-links > path { fill: none; stroke-width: 2; stroke-dasharray: 12 4 2 4; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.hp-links > path.live { stroke-width: 2.5; animation: hp-dash .6s linear infinite; }
@keyframes hp-dash { to { stroke-dashoffset: -22; } }
.hp-vm.moved { background: color-mix(in srgb, var(--c, #f9ab00) 15%, transparent); box-shadow: inset 3px 0 0 var(--c, #f9ab00); }
.hp-vm.moved .hp-from { color: var(--c, var(--warning)); font-weight: 500; }
.hp-ghost { border: 1.5px dashed var(--c); background: transparent; cursor: pointer; padding-left: 8px; min-height: 24px; }
.hp-ghost .hp-vm-name, .hp-ghost .hp-vm-res { opacity: .55; }
.hp-ghost:hover { background: color-mix(in srgb, var(--c) 10%, transparent); }
.hp-ghost:hover .hp-vm-name { opacity: .9; }
.hp-move { box-shadow: inset 4px 0 0 var(--c, transparent); }
/* назва ВМ не зникає: першою стискається мітка «з …» */
.hp-vm-name { min-width: 6em; }
.hp-from { flex: 0 1 auto; min-width: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
/* прапор країни VPN у мітці VPN */
.chip-vpn .fi { width: 16px; height: 11px; margin-left: 5px; vertical-align: -1px; border-radius: 2px; }

/* ===== My Cloud — адмінка порталу (mycloud.php) ===== */
.mca-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.mca-summary .chip .material-symbols-outlined { font-size: 15px; }
.mca-tabs { margin-bottom: 12px; max-width: 100%; overflow-x: auto; }
.mca-tabs button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mca-tabs button .material-symbols-outlined { font-size: 18px; }
.mca-tabs button.active::before { display: none; }
.mca-warn { display: flex; gap: 8px; align-items: center; padding: 10px 14px; margin-bottom: 12px; border-radius: 12px; background: var(--warning-container); color: var(--warning); font-size: 13px; }
.mca-split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 999px) { .mca-split { grid-template-columns: minmax(0, 1fr); } }
.mca-list { padding: 12px 8px 8px; position: sticky; top: 76px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; }
@media (max-width: 999px) { .mca-list { position: static; max-height: 46vh; } }
.mca-list-head { display: flex; gap: 6px; align-items: center; padding: 0 4px 8px; }
.mca-list-head .search-field { flex: 1; min-width: 0; }
.mca-add { flex: none; background: var(--primary-container); color: var(--on-primary-container); }
.mca-filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 4px 8px; }
.mca-filters .filter-chip { height: 28px; font-size: 12px; padding: 0 10px; }
.mca-filters .filter-chip .material-symbols-outlined { font-size: 15px; }
.mca-items { overflow-y: auto; flex: 1; min-height: 0; }
.mca-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent;
    color: var(--text); text-align: left; cursor: pointer; }
.mca-item:hover { background: var(--hover); }
.mca-item.active { background: var(--primary-container); color: var(--on-primary-container); }
.mca-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mca-item-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mca-item-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mca-item.active .mca-item-sub { color: inherit; opacity: .75; }
.mca-item-badges { display: flex; gap: 4px; align-items: center; flex: none; }
.mca-dot { width: 10px; height: 10px; border-radius: 50%; }
.mca-dot.danger { background: #d93025; }
.mca-mini { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); }
.mca-mini.warn { background: var(--warning-container); color: var(--warning); }
.mca-mini-ico { font-size: 16px; color: var(--text-3); }
.mca-ava { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.mca-ava-l { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); font-weight: 500; }
.mca-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 280px; text-align: center; color: var(--text-2); }
.mca-empty-ico { font-size: 48px; color: var(--text-3); }
.mca-company { padding: 0; overflow: visible; }
.mca-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px 10px;
    position: sticky; top: 64px; z-index: 5; background: var(--surface); border-radius: 16px 16px 0 0; border-bottom: 1px solid var(--outline-variant); }
.mca-head-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mca-head-title h2 { margin: 0; font-size: 22px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mca-head-actions { display: flex; gap: 8px; }
.mca-danger-btn { color: var(--danger); }
.mca-danger-btn:hover { color: var(--danger); background: var(--danger-container); }
.mca-dirty { display: none; align-items: center; gap: 6px; margin: 10px 20px 0; padding: 6px 12px; border-radius: 8px; font-size: 13px;
    background: var(--warning-container); color: var(--warning); }
.mca-dirty.on { display: flex; }
.mca-dirty .material-symbols-outlined { font-size: 16px; }
.mca-section { padding: 14px 20px 16px; border-bottom: 1px solid var(--outline-variant); }
.mca-section:last-child { border-bottom: 0; }
.mca-section-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 500; margin-bottom: 10px; }
.mca-section-title > .material-symbols-outlined { font-size: 20px; color: var(--primary); }
.mca-section-title .muted { font-weight: 400; font-size: 12px; }
.mca-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px; }
.mca-grid label, .mca-label { display: block; margin: 0; font-weight: 500; font-size: 12px; color: var(--text-2); }
.mca-grid label .form-control, .mca-grid label textarea { margin-top: 4px; font-weight: 400; }
.mca-label { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.mca-label .material-symbols-outlined { font-size: 16px; color: var(--text-3); }
.mca-label .muted { font-weight: 400; }
.mca-wide { grid-column: 1 / -1; }
.mca-sub { grid-column: 1 / -1; font-weight: 500; color: var(--primary); margin-top: 6px; }
.mca-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.mca-inline { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.mca-inline .form-control { margin-top: 0 !important; }
.mca-switches { grid-column: 1 / -1; display: flex; gap: 12px 28px; flex-wrap: wrap; }
.mca-switch { display: flex !important; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 400 !important; font-size: 13px !important; color: var(--text) !important; position: relative; }
.mca-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mca-switch-ui { flex: none; position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--surface-3); border: 2px solid var(--outline); transition: .15s; margin-top: 1px; }
.mca-switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--outline); transition: .15s; }
.mca-switch input:checked + .mca-switch-ui { background: var(--primary); border-color: var(--primary); }
.mca-switch input:checked + .mca-switch-ui::after { left: 18px; background: var(--on-primary); }
.mca-switch input[name="status"]:checked + .mca-switch-ui { background: #d93025; border-color: #d93025; }
.mca-switch input:focus-visible + .mca-switch-ui { box-shadow: 0 0 0 3px var(--primary-container); }
.mca-switch.mini { align-items: center; font-size: 12px !important; }
.mca-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; padding: 4px 6px; border: 1px solid var(--outline); border-radius: 10px; background: var(--surface); }
.mca-chips:focus-within { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.mca-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 28px; padding: 0 2px 0 10px; border-radius: 8px;
    background: var(--surface-2); font-size: 13px; }
.mca-chip > .material-symbols-outlined { font-size: 15px; color: var(--text-3); }
.mca-chip a { color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mca-chip a:hover { color: var(--primary); text-decoration: underline; }
.mca-chip.unknown { background: var(--warning-container); }
.mca-chip.unknown a { color: var(--warning); }
.mca-chip.danger { background: var(--danger-container); color: var(--danger); }
.mca-id { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mca-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: var(--text-3); cursor: pointer; }
.mca-chip-x:hover { background: var(--pressed); color: var(--text); }
.mca-chip-x .material-symbols-outlined { font-size: 15px; }
.mca-chip-input { flex: 1; min-width: 150px; height: 28px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.mca-hosts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px 14px; }
.mca-ac { position: relative; flex: 1; min-width: 150px; display: flex; }
.mca-ac-list { display: none; position: absolute; top: calc(100% + 6px); left: -6px; z-index: 30; width: min(420px, 80vw); max-height: 320px; overflow-y: auto;
    background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-3); padding: 6px; }
.mca-ac-list.open { display: block; }
.mca-ac-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
    color: var(--text); text-align: left; cursor: pointer; font-size: 13px; }
.mca-ac-item:hover, .mca-ac-item:focus { background: var(--hover); outline: 0; }
.mca-ac-item .muted { font-size: 11px; }
.mca-ac-empty { padding: 8px 10px; font-size: 13px; color: var(--text-3); }
.mca-people { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.mca-person { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.mca-person:hover { background: var(--hover); }
.mca-person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.mca-person-main a { font-weight: 500; }
.mca-person-main .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mca-add-person { display: flex; gap: 8px; }
.mca-add-person select { flex: 1; min-width: 0; }
.mca-pad { padding: 6px 8px; font-size: 13px; }
.mca-bots { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.mca-bots .chip .material-symbols-outlined { font-size: 15px; }
.mca-note { display: flex; gap: 8px; align-items: center; margin: 14px 20px 18px; color: var(--text-3); font-size: 13px; }
.mca-chiprow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 20px 0; font-size: 12px; }
.mca-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 10px; max-height: 340px; overflow-y: auto;
    padding: 4px; border: 1px solid var(--outline-variant); border-radius: 10px; }
.mca-check { display: flex !important; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; cursor: pointer; font-weight: 400 !important;
    font-size: 13px !important; color: var(--text) !important; margin: 0; }
.mca-check:hover { background: var(--hover); }
.mca-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); flex: none; }
.mca-check input:checked + span { font-weight: 500; }
.mca-mini-search { margin-bottom: 8px; height: 36px; }
#mca-bot-companies .mca-mini-search { grid-column: 1 / -1; }
.mca-table td { vertical-align: middle; }
.mca-table .form-control.mca-auto, .form-control.mca-auto { width: auto; height: 34px; font-size: 13px; }
.mca-nowrap { white-space: nowrap; }
.mca-mono { font-family: "Roboto Mono", Consolas, monospace; font-size: 12px; }
.mca-blocked td { opacity: .6; }
.mca-right { margin-left: auto; }
.mca-prog { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 8px; font-size: 13px; }
.mca-prog:hover { background: var(--hover); }
.mca-prog b { min-width: 120px; }
.mca-prog .form-control { flex: 1; height: 32px; }
.mca-prog .muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mca-prog-host { color: var(--text-3); font-size: 12px; min-width: 140px; }
.mca-prog-form { display: grid; grid-template-columns: minmax(200px, 1.2fr) minmax(140px, 1fr) minmax(180px, 1.4fr) auto; gap: 8px; margin-bottom: 14px; align-items: center; }
.mca-prog-inline { margin: 10px 0 0; }
@media (max-width: 760px) { .mca-prog-form { grid-template-columns: 1fr; } }
.mca-host-pick .mca-ac { min-width: 0; }
.mca-host-pick .mca-chip { height: 40px; }
.mca-prog-group { padding: 8px 0; border-top: 1px solid var(--outline-variant); }
.mca-prog-group-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 8px; }
.mca-prog-group-head .material-symbols-outlined { font-size: 18px; color: var(--text-3); }
.mca-map iframe { width: 100%; height: 260px; border: 0; border-radius: 12px; }
.mca-map:empty { display: none; }
.mca-table .mca-bu-company { max-width: 200px; }
.mca-table .mca-bu-role { max-width: 150px; }
