/* =====================================================
   BASE STYLES
   ===================================================== */

/* --- CSS-переменные (базовая палитра) --- */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --light-bg: #f8f9fa;
    --dark-text: #2c3e50;
    --light-text: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Финальные правки UX дерева подразделений после перехода на инспектор. */
body[data-theme="vsrf"] .department-tree-inline-actions--row {
    position: relative;
    z-index: 1 !important;
}

body[data-theme="vsrf"] .department-tree-action-menu {
    z-index: 5000 !important;
}

body[data-theme="vsrf"] .department-tree-name--button {
    background: transparent;
    border: 0;
    color: #0f2c50;
    cursor: pointer;
    font: inherit;
    font-weight: 850;
    line-height: 1.25;
    padding: 0;
    text-align: left;
    text-decoration: none;
}

body[data-theme="vsrf"] .department-tree-name--button:hover,
body[data-theme="vsrf"] .department-tree-name--button:focus {
    color: #0d6efd;
    outline: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body[data-theme="vsrf"] .department-tree-branch-hover {
    align-items: center;
    background: #eef5ff;
    border: 1px solid #cfe0f6;
    border-radius: 7px;
    color: #244e78;
    display: inline-flex;
    font-size: 12px;
    font-weight: 750;
    gap: 6px;
    line-height: 1.25;
    margin-top: 4px;
    max-width: min(520px, 70vw);
    opacity: 0;
    overflow: hidden;
    padding: 5px 8px;
    pointer-events: none;
    text-overflow: ellipsis;
    transform: translateY(-2px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    white-space: nowrap;
}

body[data-theme="vsrf"] .department-tree-row:hover .department-tree-branch-hover,
body[data-theme="vsrf"] .department-tree-title-block:focus-within .department-tree-branch-hover {
    opacity: 1;
    transform: translateY(0);
}

body[data-theme="vsrf"] .department-tree-hover-tools {
    left: 42px !important;
    min-width: 292px;
    z-index: 2;
}

body[data-theme="vsrf"] .department-tree-ghost-add {
    justify-content: center;
    min-width: 292px;
    padding-left: 16px !important;
    padding-right: 18px !important;
}

body[data-theme="vsrf"] .department-tree-ghost-add__line {
    display: none !important;
}

body[data-theme="vsrf"] .department-problem-summary {
    background: #fff8e6;
    border: 1px solid #f0cf8a;
    border-radius: 8px;
    color: #704500;
    margin: 0 0 12px;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-problem-summary summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 12px 14px;
}

body[data-theme="vsrf"] .department-problem-summary summary::-webkit-details-marker {
    display: none;
}

body[data-theme="vsrf"] .department-problem-summary summary span:first-child {
    align-items: center;
    display: inline-flex;
    font-weight: 850;
    gap: 8px;
}

body[data-theme="vsrf"] .department-problem-summary__hint {
    color: #8a611b;
    font-size: 12px;
    font-weight: 750;
}

body[data-theme="vsrf"] .department-problem-summary__body {
    align-items: center;
    border-top: 1px solid rgba(138, 97, 27, 0.18);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
}

body[data-theme="vsrf"] .department-problem-summary__body span {
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(138, 97, 27, 0.16);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 750;
    padding: 5px 9px;
}

body[data-theme="vsrf"] .department-tree-toolbar.app-sticky-controls {
    position: sticky !important;
    top: var(--app-sticky-header-offset, 72px) !important;
    z-index: 1020 !important;
}

body[data-theme="vsrf"] .department-tree-toolbar {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(15, 44, 80, 0.12);
    box-shadow: 0 10px 24px rgba(15, 44, 80, 0.08);
}

body[data-theme="vsrf"] .department-inspector__sync-card strong {
    font-size: 18px;
}

body[data-theme="vsrf"] .department-inspector__sync-card .department-icon-badge {
    flex: 0 0 auto;
    height: 26px;
    width: 26px;
}

body[data-theme="vsrf"] .department-inspector-dialog--workspace {
    max-width: min(1380px, calc(100vw - 28px)) !important;
}

body[data-theme="vsrf"] .department-inspector__head--workspace {
    background: #244e78 !important;
    border: 0 !important;
    color: #ffffff;
    display: flex !important;
    justify-content: space-between;
    min-height: 82px;
    padding: 18px 22px !important;
}

body[data-theme="vsrf"] .department-inspector__identity {
    align-items: center;
    display: flex;
    gap: 14px;
    min-width: 0;
}

body[data-theme="vsrf"] .department-inspector__head--workspace .department-inspector__titlemark {
    align-items: center;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 9px;
    display: inline-flex;
    flex: 0 0 42px;
    height: 42px;
    justify-content: center;
    width: 42px;
}

body[data-theme="vsrf"] .department-inspector__heading {
    min-width: 0;
}

body[data-theme="vsrf"] .department-inspector__heading h5 {
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .department-inspector__heading p {
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    margin: 5px 0 0;
}

body[data-theme="vsrf"] .department-inspector__head-actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 12px;
}

body[data-theme="vsrf"] .department-inspector--workspace {
    background: #f7f9fc !important;
    display: grid !important;
    gap: 0 !important;
    grid-template-columns: 300px minmax(0, 1fr);
    max-height: min(72vh, 760px) !important;
    overflow: hidden !important;
    padding: 0 !important;
}

body[data-theme="vsrf"] .department-inspector__sidebar {
    background: #ffffff;
    border-right: 1px solid rgba(15, 44, 80, 0.1);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: auto;
    padding: 18px;
}

body[data-theme="vsrf"] .department-inspector__metric-stack {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-theme="vsrf"] .department-inspector__metric-stack div,
body[data-theme="vsrf"] .department-inspector__sync-card,
body[data-theme="vsrf"] .department-inspector__compact-facts,
body[data-theme="vsrf"] .department-inspector__section {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 8px;
}

body[data-theme="vsrf"] .department-inspector__metric-stack div {
    padding: 12px;
}

body[data-theme="vsrf"] .department-inspector__metric-stack span,
body[data-theme="vsrf"] .department-inspector__sync-card span,
body[data-theme="vsrf"] .department-inspector__section span,
body[data-theme="vsrf"] .department-inspector__compact-facts dt {
    color: #5e6f86;
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

body[data-theme="vsrf"] .department-inspector__metric-stack strong,
body[data-theme="vsrf"] .department-inspector__sync-card strong {
    align-items: center;
    color: #0f2c50;
    display: flex;
    font-size: 20px;
    font-weight: 850;
    gap: 8px;
    margin-top: 5px;
}

body[data-theme="vsrf"] .department-inspector__sync-card {
    padding: 12px;
}

body[data-theme="vsrf"] .department-inspector__notice {
    align-items: center;
    background: #eef7f2;
    border: 1px solid #b9e2c9;
    border-radius: 8px;
    color: #17613b;
    display: flex;
    font-weight: 750;
    gap: 10px;
    margin: 0;
    padding: 11px 12px;
}

body[data-theme="vsrf"] .department-inspector__notice--warning {
    background: #fff8eb;
    border-color: #f4d7a8;
    color: #8a5200;
}

body[data-theme="vsrf"] .department-inspector__compact-facts {
    display: grid;
    gap: 0;
    margin: 0;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-inspector__compact-facts div {
    border-bottom: 1px solid rgba(15, 44, 80, 0.08);
    padding: 11px 12px;
}

body[data-theme="vsrf"] .department-inspector__compact-facts div:last-child {
    border-bottom: 0;
}

body[data-theme="vsrf"] .department-inspector__compact-facts dd {
    color: #0f2c50;
    font-size: 13px;
    font-weight: 700;
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .department-inspector__workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-inspector__tabs {
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 44, 80, 0.1);
    display: flex;
    gap: 6px;
    margin: 0;
    overflow-x: auto;
    padding: 12px 18px 0;
}

body[data-theme="vsrf"] .department-inspector__tab {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: #5e6f86;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    padding: 10px 12px 12px;
    white-space: nowrap;
}

body[data-theme="vsrf"] .department-inspector__tab--active {
    border-bottom-color: #0d6efd;
    color: #0d56d9;
}

body[data-theme="vsrf"] .department-inspector__panel {
    display: grid;
    gap: 16px;
    overflow: auto;
    padding: 18px;
}

body[data-theme="vsrf"] .department-inspector__panel[hidden] {
    display: none !important;
}

body[data-theme="vsrf"] .department-inspector__facts {
    display: grid !important;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector__facts div {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 8px;
    display: block !important;
    padding: 12px;
}

body[data-theme="vsrf"] .department-inspector__facts dt {
    color: #5e6f86;
    font-size: 12px;
    font-weight: 800;
}

body[data-theme="vsrf"] .department-inspector__facts dd {
    color: #0f2c50;
    font-size: 14px;
    font-weight: 700;
    margin: 5px 0 0;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .department-inspector__summary-grid,
body[data-theme="vsrf"] .department-inspector__form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-theme="vsrf"] .department-inspector__section {
    margin: 0;
    padding: 14px;
}

body[data-theme="vsrf"] .department-inspector__section p {
    color: #0f2c50;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
    margin: 7px 0 0;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .department-inspector__panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

body[data-theme="vsrf"] .department-inspector__panel .association-picker {
    border-color: rgba(15, 44, 80, 0.1) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-inspector__panel .association-picker__body {
    max-height: 330px;
    overflow: auto;
}

body[data-theme="vsrf"] .department-inspector__actions {
    align-items: center;
    border-top: 1px solid rgba(15, 44, 80, 0.1);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin: 0 !important;
    padding: 14px 18px !important;
}

body[data-theme="vsrf"] .department-inspector__actions .btn {
    min-width: 150px;
}

@media (max-width: 980px) {
    body[data-theme="vsrf"] .department-inspector--workspace,
    body[data-theme="vsrf"] .department-inspector__facts,
    body[data-theme="vsrf"] .department-inspector__summary-grid,
    body[data-theme="vsrf"] .department-inspector__form-grid {
        grid-template-columns: 1fr !important;
    }

    body[data-theme="vsrf"] .department-inspector--workspace {
        max-height: none !important;
        overflow: auto !important;
    }

    body[data-theme="vsrf"] .department-inspector__workspace,
    body[data-theme="vsrf"] .department-inspector__sidebar {
        overflow: visible;
    }
}

/* Финальный каскад последних правок дерева подразделений. */
body[data-theme="vsrf"] .department-tree-inline-actions--row {
    position: relative;
    z-index: 1 !important;
}

body[data-theme="vsrf"] .department-tree-name--button {
    background: transparent !important;
    border: 0 !important;
    color: #0f2c50;
    cursor: pointer;
    font: inherit;
    font-weight: 850;
    padding: 0;
    text-align: left;
}

body[data-theme="vsrf"] .department-tree-name--button:hover,
body[data-theme="vsrf"] .department-tree-name--button:focus {
    color: #0d6efd;
    outline: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body[data-theme="vsrf"] .department-tree-branch-hover {
    align-items: center !important;
    background: #eef5ff !important;
    border: 1px solid #cfe0f6 !important;
    border-radius: 7px !important;
    color: #244e78 !important;
    display: inline-flex !important;
    font-size: 12px !important;
    font-weight: 750 !important;
    gap: 6px !important;
    margin-top: 4px !important;
    max-width: min(520px, 70vw) !important;
    opacity: 0;
    overflow: hidden;
    padding: 5px 8px !important;
    pointer-events: none;
    text-overflow: ellipsis;
    transform: translateY(-2px);
    white-space: nowrap;
}

body[data-theme="vsrf"] .department-tree-row:hover .department-tree-branch-hover,
body[data-theme="vsrf"] .department-tree-title-block:focus-within .department-tree-branch-hover {
    opacity: 1 !important;
    transform: translateY(0);
}

body[data-theme="vsrf"] .department-tree-hover-tools {
    left: 42px !important;
    min-width: 292px !important;
    z-index: 2 !important;
}

body[data-theme="vsrf"] .department-tree-ghost-add {
    justify-content: center !important;
    min-width: 292px !important;
    padding-left: 16px !important;
    padding-right: 18px !important;
}

body[data-theme="vsrf"] .department-tree-ghost-add__line {
    display: none !important;
}

body[data-theme="vsrf"] .department-problem-summary {
    background: #fff8e6;
    border: 1px solid #f0cf8a;
    border-radius: 8px;
    color: #704500;
    margin: 0 0 12px;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-problem-summary summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 12px 14px;
}

body[data-theme="vsrf"] .department-problem-summary summary::-webkit-details-marker {
    display: none;
}

body[data-theme="vsrf"] .department-problem-summary summary span:first-child {
    align-items: center;
    display: inline-flex;
    font-weight: 850;
    gap: 8px;
}

body[data-theme="vsrf"] .department-problem-summary__hint {
    color: #8a611b;
    font-size: 12px;
    font-weight: 750;
}

body[data-theme="vsrf"] .department-problem-summary__body {
    align-items: center;
    border-top: 1px solid rgba(138, 97, 27, 0.18);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
}

body[data-theme="vsrf"] .department-problem-summary__body span {
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(138, 97, 27, 0.16);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 750;
    padding: 5px 9px;
}

body[data-theme="vsrf"] .department-tree-toolbar.app-sticky-controls {
    position: sticky !important;
    top: var(--app-sticky-header-offset, 72px) !important;
    z-index: 1020 !important;
}

body[data-theme="vsrf"] .department-tree-toolbar {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(15, 44, 80, 0.12);
    box-shadow: 0 10px 24px rgba(15, 44, 80, 0.08);
}

body[data-theme="vsrf"] .department-inspector__sync-card strong {
    font-size: 18px !important;
}

body[data-theme="vsrf"] .department-inspector__sync-card .department-icon-badge {
    flex: 0 0 auto;
    height: 26px;
    width: 26px;
}

/* Departments requested refinements: compact tree, action menu and modal inspector. */
body[data-theme="vsrf"] .department-workspace {
    display: block !important;
    grid-template-columns: none !important;
}

body[data-theme="vsrf"] .department-tree-children {
    border-left: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-cell--name {
    padding-left: 14px !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 28px !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 42px !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 56px !important;
}

body[data-theme="vsrf"] .department-tree-header,
body[data-theme="vsrf"] .department-tree-item {
    gap: 8px !important;
    grid-template-columns: minmax(360px, 1fr) 70px 92px 82px minmax(124px, 0.36fr) 68px !important;
}

body[data-theme="vsrf"] .department-tree-cell--type {
    display: none !important;
}

body[data-theme="vsrf"] .department-tree-cell--status {
    overflow: hidden !important;
}

body[data-theme="vsrf"] .department-tree-inline-actions--row {
    gap: 4px !important;
}

body[data-theme="vsrf"] .department-tree-more-menu {
    display: inline-flex;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-menu {
    border-color: rgba(15, 44, 80, 0.12);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(16, 36, 63, 0.16);
    min-width: 220px;
    padding: 6px;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-item {
    align-items: center;
    border-radius: 6px;
    display: flex;
    font-size: 0.84rem;
    font-weight: 750;
    gap: 8px;
    min-height: 32px;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-item i {
    color: #315a86;
    width: 16px;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-item.text-danger i {
    color: #dc2626;
}

body[data-theme="vsrf"] .department-tree-row {
    position: relative !important;
}

body[data-theme="vsrf"] .department-tree-hover-tools {
    align-items: center;
    bottom: 5px;
    display: flex;
    gap: 6px;
    left: 56px;
    max-width: calc(100% - 140px);
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translateY(-2px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 2;
}

body[data-theme="vsrf"] .department-tree-row:hover {
    padding-bottom: 28px;
}

body[data-theme="vsrf"] .department-tree-row:hover .department-tree-hover-tools,
body[data-theme="vsrf"] .department-tree-hover-tools:focus-within {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

body[data-theme="vsrf"] .department-tree-hover-action {
    align-items: center;
    background: #ffffff;
    border: 1px dashed rgba(37, 99, 235, 0.34);
    border-radius: 7px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 850;
    gap: 6px;
    min-height: 24px;
    padding: 3px 8px;
    text-decoration: none;
}

body[data-theme="vsrf"] button.department-tree-hover-action {
    cursor: pointer;
}

body[data-theme="vsrf"] .department-tree-hover-action:hover,
body[data-theme="vsrf"] .department-tree-hover-action:focus {
    background: #eef6ff;
    border-style: solid;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
    align-items: end !important;
    flex-wrap: wrap !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field--wide {
    flex: 1 1 360px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field:not(.department-tree-filter-field--wide) {
    flex: 0 0 150px !important;
}

body[data-theme="vsrf"] .department-tree-filter-group {
    display: block !important;
}

body[data-theme="vsrf"] .department-tree-filter-group__body {
    z-index: 1310 !important;
}

body[data-theme="vsrf"] .department-inspector-modal .modal-content {
    border: 0;
    border-radius: 12px;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-inspector-dialog {
    max-width: min(1180px, calc(100vw - 32px)) !important;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__head {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector {
    background: #ffffff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: grid !important;
    gap: 16px !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: auto !important;
    padding: 18px !important;
    position: static !important;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    padding: 0 !important;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__facts div {
    grid-template-columns: 130px minmax(0, 1fr);
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__section,
body[data-theme="vsrf"] .department-inspector-modal .department-inspector__link {
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__actions {
    border-top: 1px solid rgba(15, 44, 80, 0.1);
    justify-content: flex-end;
    margin: 0;
    padding: 14px 18px;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__action-grid .btn,
body[data-theme="vsrf"] .department-inspector-modal .department-inspector__action-grid form .btn {
    min-width: 150px;
    width: auto !important;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__action-grid form {
    width: auto !important;
}

@media (max-width: 900px) {
    body[data-theme="vsrf"] .department-tree-header,
    body[data-theme="vsrf"] .department-tree-item {
        grid-template-columns: minmax(0, 1fr) auto auto !important;
    }

    body[data-theme="vsrf"] .department-tree-row:hover {
        padding-bottom: 0;
    }

    body[data-theme="vsrf"] .department-tree-hover-tools {
        grid-column: 1 / -1;
        left: 0;
        margin-top: 6px;
        max-width: 100%;
        opacity: 1;
        pointer-events: auto;
        position: static;
        transform: none;
    }

    body[data-theme="vsrf"] .department-inspector-modal .department-inspector__metrics,
    body[data-theme="vsrf"] .department-inspector-modal .department-inspector__facts {
        grid-template-columns: 1fr !important;
    }
}

/* Финальный каскад рабочей версии инспектора подразделения. */
body[data-theme="vsrf"] .department-inspector-dialog--workspace {
    max-width: min(1380px, calc(100vw - 28px)) !important;
}

body[data-theme="vsrf"] .department-inspector__head--workspace {
    background: #244e78 !important;
    display: flex !important;
    justify-content: space-between !important;
    min-height: 82px;
    padding: 18px 22px !important;
}

body[data-theme="vsrf"] .department-inspector--workspace {
    background: #f7f9fc !important;
    display: grid !important;
    gap: 0 !important;
    grid-template-columns: 300px minmax(0, 1fr) !important;
    max-height: min(72vh, 760px) !important;
    overflow: hidden !important;
    padding: 0 !important;
}

body[data-theme="vsrf"] .department-inspector__identity {
    align-items: center;
    display: flex;
    gap: 14px;
    min-width: 0;
}

body[data-theme="vsrf"] .department-inspector__heading h5 {
    color: #ffffff !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    margin: 0;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .department-inspector__heading p {
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 13px !important;
    margin: 5px 0 0 !important;
}

body[data-theme="vsrf"] .department-inspector__head-actions,
body[data-theme="vsrf"] .department-inspector__actions {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

body[data-theme="vsrf"] .department-inspector__sidebar {
    background: #ffffff;
    border-right: 1px solid rgba(15, 44, 80, 0.1);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: auto;
    padding: 18px;
}

body[data-theme="vsrf"] .department-inspector__workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-inspector__metric-stack {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-theme="vsrf"] .department-inspector__metric-stack div,
body[data-theme="vsrf"] .department-inspector__sync-card,
body[data-theme="vsrf"] .department-inspector__compact-facts,
body[data-theme="vsrf"] .department-inspector__facts div,
body[data-theme="vsrf"] .department-inspector__section {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 8px;
}

body[data-theme="vsrf"] .department-inspector__metric-stack div,
body[data-theme="vsrf"] .department-inspector__sync-card,
body[data-theme="vsrf"] .department-inspector__section,
body[data-theme="vsrf"] .department-inspector__facts div {
    padding: 12px;
}

body[data-theme="vsrf"] .department-inspector__metric-stack span,
body[data-theme="vsrf"] .department-inspector__sync-card span,
body[data-theme="vsrf"] .department-inspector__section span,
body[data-theme="vsrf"] .department-inspector__compact-facts dt,
body[data-theme="vsrf"] .department-inspector__facts dt {
    color: #5e6f86;
    display: block;
    font-size: 12px;
    font-weight: 800;
}

body[data-theme="vsrf"] .department-inspector__metric-stack strong,
body[data-theme="vsrf"] .department-inspector__sync-card strong {
    align-items: center;
    color: #0f2c50;
    display: flex;
    font-size: 20px;
    font-weight: 850;
    gap: 8px;
    margin-top: 5px;
}

body[data-theme="vsrf"] .department-inspector__notice {
    align-items: center;
    background: #eef7f2;
    border: 1px solid #b9e2c9;
    border-radius: 8px;
    color: #17613b;
    display: flex;
    font-weight: 750;
    gap: 10px;
    margin: 0;
    padding: 11px 12px;
}

body[data-theme="vsrf"] .department-inspector__notice--warning {
    background: #fff8eb;
    border-color: #f4d7a8;
    color: #8a5200;
}

body[data-theme="vsrf"] .department-inspector__compact-facts {
    display: grid;
    margin: 0;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-inspector__compact-facts div {
    border-bottom: 1px solid rgba(15, 44, 80, 0.08);
    padding: 11px 12px;
}

body[data-theme="vsrf"] .department-inspector__compact-facts dd,
body[data-theme="vsrf"] .department-inspector__facts dd,
body[data-theme="vsrf"] .department-inspector__section p {
    color: #0f2c50;
    font-size: 14px;
    font-weight: 700;
    margin: 5px 0 0;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .department-inspector__tabs {
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 44, 80, 0.1);
    display: flex;
    gap: 6px;
    margin: 0;
    overflow-x: auto;
    padding: 12px 18px 0;
}

body[data-theme="vsrf"] .department-inspector__tab {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: #5e6f86;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    padding: 10px 12px 12px;
    white-space: nowrap;
}

body[data-theme="vsrf"] .department-inspector__tab--active {
    border-bottom-color: #0d6efd;
    color: #0d56d9;
}

body[data-theme="vsrf"] .department-inspector__panel {
    display: grid;
    gap: 16px;
    overflow: auto;
    padding: 18px;
}

body[data-theme="vsrf"] .department-inspector__panel[hidden] {
    display: none !important;
}

body[data-theme="vsrf"] .department-inspector__facts,
body[data-theme="vsrf"] .department-inspector__summary-grid,
body[data-theme="vsrf"] .department-inspector__form-grid {
    display: grid !important;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector__panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

body[data-theme="vsrf"] .department-inspector__panel .association-picker__body {
    max-height: 330px;
    overflow: auto;
}

body[data-theme="vsrf"] .department-inspector__actions {
    border-top: 1px solid rgba(15, 44, 80, 0.1);
    margin: 0 !important;
    padding: 14px 18px !important;
}

body[data-theme="vsrf"] .department-inspector__actions .btn {
    min-width: 150px;
}

@media (max-width: 980px) {
    body[data-theme="vsrf"] .department-inspector--workspace,
    body[data-theme="vsrf"] .department-inspector__facts,
    body[data-theme="vsrf"] .department-inspector__summary-grid,
    body[data-theme="vsrf"] .department-inspector__form-grid {
        grid-template-columns: 1fr !important;
    }

    body[data-theme="vsrf"] .department-inspector--workspace {
        max-height: none !important;
        overflow: auto !important;
    }

    body[data-theme="vsrf"] .department-inspector__workspace,
    body[data-theme="vsrf"] .department-inspector__sidebar {
        overflow: visible;
    }
}

/* --- Базовые элементы --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: #f5f6fa;
}

code {
    font-family: monospace;
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
}

.container {
    width: 100% !important;
    max-width: 100% !important;
}

/* --- Шапка --- */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--light-text);
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    margin: 10px 10px;
    padding: 0 20px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.header-top {
    width: 100%;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* --- Пользователь в шапке --- */
.user-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.user-greeting {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.user-role {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-admin    { background: var(--success-color);  color: white; }
.role-superadmin { background: var(--warning-color); color: var(--dark-text); }
.role-user     { background: var(--secondary-color); color: white; }

/* --- Навигация в шапке --- */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    color: var(--light-text);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-links a:hover { background-color: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.nav-links a.active { background-color: rgba(255, 255, 255, 0.2); }

.notification-badge {
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 5px;
}

/* --- Основной контент и футер --- */
main {
    margin: 30px 30px;
    padding: 0 20px;
    min-height: calc(100vh - 200px);
}

footer {
    background: var(--primary-color);
    color: var(--light-text);
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

/* --- Flash-сообщения --- */
.flash-messages { display: none; }

.app-notification-container {
    display: grid;
    gap: 10px;
    left: 50%;
    max-width: min(720px, calc(100vw - 24px));
    pointer-events: none;
    position: fixed;
    top: 12px;
    transform: translateX(-50%);
    width: max-content;
    z-index: 5000;
}

.app-notification {
    align-items: flex-start;
    background: #fff;
    border: 1px solid rgba(15, 44, 80, 0.14);
    border-left: 5px solid #2f6fa3;
    border-radius: 8px;
    box-shadow: 0 16px 38px rgba(15, 44, 80, 0.24);
    color: #10243f;
    display: grid;
    gap: 10px;
    grid-template-columns: 22px minmax(0, 1fr) 28px;
    min-width: min(520px, calc(100vw - 24px));
    padding: 12px 12px 12px 14px;
    pointer-events: auto;
}

.app-notification--leaving {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-notification__icon {
    align-items: center;
    display: inline-flex;
    height: 22px;
    justify-content: center;
    margin-top: 1px;
    width: 22px;
}

.app-notification__icon::before {
    font-family: "Font Awesome 7 Free";
    font-weight: 900;
}

.app-notification__body {
    font-size: 0.92rem;
    line-height: 1.35;
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-notification__close {
    align-items: center;
    background: transparent;
    border: 0;
    color: #667085;
    display: inline-flex;
    height: 28px;
    justify-content: center;
    padding: 0;
    width: 28px;
}

.app-notification__close:hover,
.app-notification__close:focus {
    color: #10243f;
    outline: none;
}

.app-notification--success {
    border-left-color: #198754;
}

.app-notification--success .app-notification__icon::before {
    color: #198754;
    content: "\f058";
}

.app-notification--error {
    border-left-color: #dc3545;
}

.app-notification--error .app-notification__icon::before {
    color: #dc3545;
    content: "\f06a";
}

.app-notification--warning {
    border-left-color: #d97706;
}

.app-notification--warning .app-notification__icon::before {
    color: #d97706;
    content: "\f071";
}

.app-notification--info .app-notification__icon::before {
    color: #2f6fa3;
    content: "\f05a";
}

.bootstrap-sync-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 0 0 1rem;
    padding: 0.875rem 1rem;
    border: 1px solid #c7d8ef;
    border-radius: 14px;
    background: #f2f7ff;
    color: #14365f;
    box-shadow: 0 12px 28px rgba(15, 55, 97, 0.08);
}

.bootstrap-sync-banner__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #1f68bd;
    color: #fff;
}

.bootstrap-sync-banner__body {
    display: block;
    line-height: 1.45;
}

.bootstrap-sync-banner__body strong {
    display: block;
    margin-bottom: 0.125rem;
}

.bootstrap-sync-banner__stage {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 0.2rem;
    opacity: 0.78;
}

.bootstrap-sync-banner--failed {
    border-color: #f0b7b7;
    background: #fff4f4;
    color: #7a1d1d;
}

.bootstrap-sync-banner--failed .bootstrap-sync-banner__icon {
    background: #c92a2a;
}

.flash {
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flash::before { font-family: 'Font Awesome 7 Free'; font-weight: 900; }

.flash.error   { background: #ffebee; color: #c62828; border-left: 4px solid #f44336; }
.flash.success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #4caf50; }
.flash.info    { background: #e3f2fd; color: #1565c0; border-left: 4px solid #2196f3; }

/* --- Кнопки (legacy) --- */
.button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #4caf50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.button.danger { background-color: #f44336; }

/* --- Навигационная полоса создателя --- */
#navigation-bar-creator {
    display: flex;
    flex-direction: row;
    padding: 15px;
}

/* --- Таблица словарей --- */
.vocabulary-table th:last-child  { width: 200px; }
.vocabulary-table th:first-child { width: 100px; }

.vocabulary-table tr td:last-child {
    width: 200px;
    display: flex;
    flex-direction: column;
}

.vocabulary-table tr td:last-child button { width: 90%; margin: 1px; }

/* --- Строка "непрочитано" --- */
tr.row-unread {
    --bs-table-bg:         #ffdd78 !important;
    --bs-table-striped-bg: #ffdd78 !important;
    --bs-table-hover-bg:   #a08b4b !important;
}

/* --- Фильтры (legacy-компонент) --- */
.filter-card {
    background: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    border: none;
}

.filter-header {
    background: #6c757d;
    color: white;
    border-radius: 10px 10px 0 0 !important;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
}

.filter-body  { padding: 1.5rem; }
.filter-group { margin-bottom: 1rem; }

.filter-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.filter-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: all 0.3s;
}

.filter-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.filter-button {
    background: #4e73df;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.filter-button:hover { background: #2e59d9; transform: translateY(-1px); }

/* --- Контейнер и заголовок API-страницы --- */
.api-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.api-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.api-header h1 { font-size: 2rem; font-weight: 300; margin: 0; }
.api-header p  { margin: 0.5rem 0 0 0; opacity: 0.9; }

/* --- Карточки статистики --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); }
.stat-card i  { font-size: 2.5rem; margin-bottom: 0.5rem; }
.stat-card h5 { font-size: 1.75rem; font-weight: 600; margin: 0.5rem 0; }
.stat-card p  { color: #6c757d; margin: 0; font-size: 0.9rem; }

/* --- Организации и фильтры (страница API) --- */
.org-selector-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.org-info h5    { color: #495057; margin-bottom: 0.25rem; }
.org-info small { color: #6c757d; }

.filters-card {
    background: white;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters-card .card-header { background: #f8f9fa; border-bottom: 1px solid #dee2e6; padding: 1rem 1.5rem; }
.filters-card .card-body   { padding: 1.5rem; }

body[data-theme="vsrf"] .legal-entity-filter-grid {
    display: grid;
    grid-template-columns:
        minmax(320px, 1.55fr)
        minmax(320px, 1.35fr)
        minmax(170px, 0.55fr)
        minmax(120px, 0.35fr)
        auto;
    gap: 0.9rem 1rem;
    align-items: end;
}

body[data-theme="vsrf"] .legal-entity-filter-field {
    min-width: 0;
}

body[data-theme="vsrf"] .legal-entity-filter-field .form-control,
body[data-theme="vsrf"] .legal-entity-filter-field .form-select,
body[data-theme="vsrf"] .legal-entity-status-filter > .btn {
    min-height: 46px;
}

body[data-theme="vsrf"] .legal-entity-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

body[data-theme="vsrf"] .legal-entity-filter-actions .btn {
    min-height: 40px;
}

body[data-theme="vsrf"] .legal-entity-filter-chips {
    grid-column: 2 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-height: 0;
}

body[data-theme="vsrf"] .legal-entity-filter-chips:empty {
    display: none;
}

@media (max-width: 1320px) {
    body[data-theme="vsrf"] .legal-entity-filter-grid {
        grid-template-columns: minmax(280px, 1.35fr) minmax(280px, 1fr) minmax(160px, 0.55fr) minmax(110px, 0.4fr);
    }

    body[data-theme="vsrf"] .legal-entity-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .legal-entity-filter-chips {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    body[data-theme="vsrf"] .legal-entity-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    body[data-theme="vsrf"] .legal-entity-filter-field--search,
    body[data-theme="vsrf"] .legal-entity-filter-field--statuses,
    body[data-theme="vsrf"] .legal-entity-filter-actions,
    body[data-theme="vsrf"] .legal-entity-filter-chips {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    body[data-theme="vsrf"] .legal-entity-filter-grid {
        grid-template-columns: 1fr;
    }

    body[data-theme="vsrf"] .legal-entity-filter-actions {
        flex-wrap: wrap;
    }
}

/* --- Таблица пользователей (API) --- */
.users-table-container {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.users-table        { width: 100%; margin: 0; }
.users-table thead  { background: #f8f9fa; }

.users-table th {
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem;
    white-space: nowrap;
}

.users-table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

.users-table tbody tr:hover  { background-color: #f8f9fa; }
.users-table button          { display: flex; align-items: center; justify-content: center; }
.users-table td > span       { display: flex; align-items: center; }

/* --- Таблица предпросмотра импорта --- */
.import-preview-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.import-preview-overview-card {
    border: 1px solid #d8e2ef;
    border-radius: 6px;
    background: #f8fafc;
    padding: 0.75rem 0.85rem;
}

.import-preview-overview-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.55rem;
}

.import-preview-overview-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: #586b81;
}

.import-preview-path {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border: 1px solid #c8d6e8;
    border-radius: 999px;
    background: #ffffff;
    color: #183a5c;
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    line-height: 1.25;
}

.import-preview-path-muted {
    background: #eef3f9;
    color: #607089;
}

.import-preview-filterbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.import-preview-filterbar .btn {
    border-radius: 999px;
}

.import-object-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.import-object-results-card {
    border: 1px solid #d8e2ef;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.import-object-results-title {
    border-bottom: 1px solid #e3ebf5;
    background: #f5f8fc;
    color: #183a5c;
    font-weight: 700;
    padding: 0.55rem 0.75rem;
}

.import-object-results-card .table th,
.import-object-results-card .table td {
    padding: 0.45rem 0.75rem;
    vertical-align: top;
}

.import-preview-table-wrap { max-height: 55vh; }
.import-preview-table      { min-width: 980px; }

.import-preview-table th,
.import-preview-table td {
    display: table-cell !important;
    padding: 0.85rem 1rem;
    vertical-align: top;
    white-space: normal;
}

.import-preview-table th                  { font-weight: 600; white-space: nowrap; }
.import-preview-table tbody tr:hover      { background-color: #f8f9fa; }
.import-preview-table td.text-center,
.import-preview-table th.text-center      { vertical-align: middle; }
.import-preview-table .font-monospace     { font-size: 0.92rem; }

.import-preview-group-row td {
    background: #eef4fb !important;
    color: #183a5c;
    font-weight: 700;
    padding: 0.45rem 0.75rem !important;
}

.import-preview-organization-row td {
    background: #dfeafb !important;
    color: #0c2f55;
    border-top: 2px solid #b9cceb;
}

.import-apply-result {
    border: 1px solid #d8e2ef;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.import-apply-result-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    background: #f5f8fc;
    border-bottom: 1px solid #e3ebf5;
    padding: 0.75rem 0.85rem;
}

.import-apply-result-title {
    color: #183a5c;
    font-weight: 700;
}

.import-apply-result-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
    color: #586b81;
    font-size: 0.82rem;
}

/* --- Компоненты mail-user --- */
.mail-user-layout   { gap: 0; }
.mail-user-toolbar  { justify-content: flex-end; }
.mail-user-toolbar > .d-inline-block { display: inline-flex; }

.mail-user-actionbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mail-user-actionbar-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.mail-user-summary-ribbon {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
}

.mail-user-summary-item { padding: 0.85rem 1rem; }

.mail-user-summary-unbound {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
}

.mail-user-summary-unbound-main { display: flex; align-items: center; gap: 0.85rem; }
.mail-user-actions              { display: flex; align-items: center; gap: 0.35rem; }

.mail-user-action-menu .dropdown-item { display: flex; align-items: center; gap: 0.65rem; }

.mail-user-workspace-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mail-user-workspace-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
}

.mail-user-table-meta   { white-space: nowrap; }
.mail-user-filter-note  { white-space: nowrap; }
.mail-user-col-index    { width: 44px; white-space: nowrap; }

.mail-user-filter-actions       { display: flex; gap: 0.5rem; align-items: stretch; }
.mail-user-filter-actions .btn  { flex: 1 1 0; }

/* --- Статусные бейджи --- */
.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active   { background-color: #d1fae5; color: #065f46; }
.status-inactive { background-color: #fee2e2; color: #991b1b; }

.sync-status   { display: inline-flex; align-items: center; gap: 0.5rem; }
.sync-status i { font-size: 0.875rem; }

/* --- Кнопки действий --- */
.action-buttons     { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.action-buttons .btn { padding: 0.375rem 0.75rem; font-size: 0.875rem; white-space: nowrap; }

/* --- Пагинация --- */
.pagination-container { display: flex; justify-content: center; margin-top: 2rem; }
.pagination-info      { color: #6c757d; font-size: 0.875rem; }

/* --- Административные секции --- */
.admin-section { margin-top: 3rem; }

.admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.admin-card                  { background: white; border-radius: 0.5rem; overflow: hidden; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.admin-card .card-header     { background: #f8f9fa; padding: 1rem 1.5rem; border-bottom: 1px solid #dee2e6; }
.admin-card .card-body       { padding: 1.5rem; }

/* --- Состояние загрузки --- */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6c757d;
}

.loading-spinner { margin-bottom: 1rem; }

/* --- Формы --- */
.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* --- Скроллбар в таблицах --- */
.table-responsive::-webkit-scrollbar       { height: 8px; }
.table-responsive::-webkit-scrollbar-track { background: #f1f1f1; }
.table-responsive::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* --- Прочее --- */
#template-list { overflow-y: scroll; max-height: 300px; }

/* --- Адаптивность --- */
@media (max-width: 992px) {
    .mail-user-actionbar,
    .mail-user-summary-unbound    { flex-direction: column; align-items: flex-start; }
    .mail-user-summary-ribbon     { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .header-top   { flex-direction: column; gap: 15px; text-align: center; }
    .main-nav     { flex-direction: column; gap: 15px; }
    .nav-links    { flex-direction: column; gap: 10px; width: 100%; }
    .nav-links a  { justify-content: center; padding: 12px; }

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

    .users-table              { font-size: 0.875rem; }
    .users-table th,
    .users-table td           { padding: 0.5rem; }

    .action-buttons           { flex-direction: column; }
    .filter-body              { padding: 1rem; }
    .mail-user-summary-ribbon { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .api-container  { padding: 1rem; }
    .api-header     { padding: 1.5rem; }
    .api-header h1  { font-size: 1.5rem; }
}

/* =====================================================
   VSRF
   ===================================================== */

body[data-theme="vsrf"] {
    --vsrf-navy-950: #1b3655;
    --vsrf-navy-900: #284d75;
    --vsrf-navy-800: #3b678f;
    --vsrf-gold-500: #b9934f;
    --vsrf-gold-200: #e8d6ae;
    --vsrf-accent: #1f66d1;
    --vsrf-paper: #f3f5f7;
    --vsrf-surface: #ffffff;
    --vsrf-surface-soft: #f8fafc;
    --vsrf-line: #d7e0e8;
    --vsrf-line-strong: #c6d1dc;
    --vsrf-text: #20364c;
    --vsrf-text-muted: #66798c;
    --vsrf-success: #2b7a57;
    --vsrf-warning: #9a6b14;
    --vsrf-danger: #a64242;
    --vsrf-white: #ffffff;
    background:
        radial-gradient(circle at top right, rgba(185, 147, 79, 0.08), transparent 22%),
        linear-gradient(180deg, #f7f8fa 0%, #eef2f5 100%);
    color: var(--vsrf-text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 0 !important;
    padding: 0 !important;
}

body[data-theme="vsrf"] .header-title,
body[data-theme="vsrf"] h1,
body[data-theme="vsrf"] h2,
body[data-theme="vsrf"] h3,
body[data-theme="vsrf"] h4,
body[data-theme="vsrf"] h5,
body[data-theme="vsrf"] h6 {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.01em;
}

body[data-theme="vsrf"] {

}

body[data-theme="vsrf"] .mail-user-col-select {
    width: 42px;
    text-align: center;
}

body[data-theme="vsrf"] .mail-user-import-conflict-options {
    border: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

body[data-theme="vsrf"] .app-scroll-top {
    align-items: center;
    background: #1d4f8f;
    border: 0;
    border-radius: 999px;
    bottom: 24px;
    box-shadow: 0 12px 28px rgba(15, 44, 80, 0.24);
    color: #fff;
    display: inline-flex;
    height: 44px;
    justify-content: center;
    opacity: 1;
    position: fixed;
    right: 24px;
    transform: translateY(0);
    transition: opacity 0.18s ease, transform 0.18s ease;
    width: 44px;
    z-index: 1250;
}

body[data-theme="vsrf"] .app-scroll-top:hover,
body[data-theme="vsrf"] .app-scroll-top:focus {
    background: #163f73;
}

body[data-theme="vsrf"] .app-scroll-top--hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

body[data-theme="vsrf"].modal-open .app-scroll-top {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 900px) {
    body[data-theme="vsrf"] .app-scroll-top {
        bottom: 18px;
        right: 18px;
    }
}

body[data-theme="vsrf"] header {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
        linear-gradient(135deg, var(--vsrf-navy-950), var(--vsrf-navy-900));
    border-bottom: 2px solid var(--vsrf-gold-500);
    box-shadow: 0 16px 34px rgba(16, 39, 63, 0.16);
    margin: 0 !important;
    width: 100%;
}

body[data-theme="vsrf"] .header-container {
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding: 0 36px;
}

body[data-theme="vsrf"] .header-top {
    justify-content: space-between;
    gap: 24px;
    padding: 20px 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

body[data-theme="vsrf"] .header-title {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

body[data-theme="vsrf"] .header-title i {
    color: var(--vsrf-gold-200);
    font-size: 1.2rem;
}

body[data-theme="vsrf"] .user-info {
    margin-left: auto;
}

body[data-theme="vsrf"] .user-greeting {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    row-gap: 8px;
    font-size: 0.9rem;
}

body[data-theme="vsrf"] .main-nav {
    justify-content: flex-start;
    padding: 14px 0 16px;
}

body[data-theme="vsrf"] .nav-links {
    gap: 12px;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .nav-links a {
    padding: 10px 14px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.94);
    font-weight: 600;
    gap: 8px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

body[data-theme="vsrf"] .nav-links a:hover,
body[data-theme="vsrf"] .nav-links a.active {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    transform: none;
}

body[data-theme="vsrf"] .notification-badge {
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--vsrf-gold-500);
    color: #233241;
    border-radius: 999px;
    padding: 0 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

body[data-theme="vsrf"] main {
    width: 100%;
    max-width: none;
    margin: 10px 0 32px;
    padding: 0 16px;
    min-height: calc(100vh - 220px);
}

body[data-theme="vsrf"] main > .container,
body[data-theme="vsrf"] main > .container-fluid {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

body[data-theme="vsrf"] .theme-switcher {
    display: inline-flex;
    gap: 4px;
    margin-right: 8px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

body[data-theme="vsrf"] .theme-switcher-btn {
    min-width: 78px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    box-shadow: none !important;
}

body[data-theme="vsrf"] .theme-switcher-btn.active {
    background: var(--vsrf-gold-500);
    color: #1f2d3d;
}

body[data-theme="vsrf"] .user-role {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

body[data-theme="vsrf"] .role-admin {
    background: rgba(61, 138, 102, 0.14);
    color: #e7fff2;
}

body[data-theme="vsrf"] .role-superadmin {
    background: rgba(185, 147, 79, 0.24);
    color: #fff7e6;
}

body[data-theme="vsrf"] .role-user {
    background: rgba(132, 179, 222, 0.18);
    color: #eef7ff;
}

body[data-theme="vsrf"] footer {
    margin-top: 28px;
    padding: 22px 36px;
    background: linear-gradient(180deg, var(--vsrf-navy-950), #16314d);
    border-top: 2px solid var(--vsrf-gold-500);
    color: rgba(255, 255, 255, 0.92);
    width: 100%;
}

body[data-theme="vsrf"] .flash {
    border-radius: 14px;
    border-left-width: 5px;
    box-shadow: 0 8px 22px rgba(20, 45, 71, 0.08);
}

body[data-theme="vsrf"] .flash.success {
    background: #eef7f1;
    border-left-color: #6d9a74;
    color: #315a38;
}

body[data-theme="vsrf"] .flash.error {
    background: #fff2f0;
    border-left-color: #ca6a63;
    color: #8f2f28;
}

body[data-theme="vsrf"] .flash.info {
    background: #eef4fb;
    border-left-color: #668ab0;
    color: var(--vsrf-navy-900);
}

body[data-theme="vsrf"] .card,
body[data-theme="vsrf"] .modal-content,
body[data-theme="vsrf"] .table-responsive,
body[data-theme="vsrf"] .list-group-item {
    border-radius: 16px;
}

body[data-theme="vsrf"] .card,
body[data-theme="vsrf"] .modal-content {
    background: var(--vsrf-surface);
    border: 1px solid var(--vsrf-line) !important;
    box-shadow: 0 14px 34px rgba(20, 45, 71, 0.07) !important;
    overflow: hidden;
}

body[data-theme="vsrf"] .card-header,
body[data-theme="vsrf"] .modal-header {
    background: linear-gradient(180deg, #fbfcfe, #f3f7fa) !important;
    border-bottom: 1px solid var(--vsrf-line) !important;
    color: var(--vsrf-navy-950) !important;
}

body[data-theme="vsrf"] .card-header {
    padding: 1rem 1.25rem;
}

body[data-theme="vsrf"] .card-body {
    padding: 1.25rem 1.35rem;
}

body[data-theme="vsrf"] .modal-header.bg-primary,
body[data-theme="vsrf"] .modal-header.bg-info,
body[data-theme="vsrf"] .modal-header.bg-success,
body[data-theme="vsrf"] .modal-header.bg-danger {
    background: linear-gradient(135deg, var(--vsrf-navy-950), var(--vsrf-navy-800)) !important;
    color: var(--vsrf-white) !important;
}

body[data-theme="vsrf"] .table,
body[data-theme="vsrf"] .users-table {
    --bs-table-bg: #ffffff;
    --bs-table-color: var(--vsrf-text);
    --bs-table-hover-bg: #f5f8fb;
    --bs-table-border-color: var(--vsrf-line);
}

body[data-theme="vsrf"] .table-light,
body[data-theme="vsrf"] .users-table thead {
    --bs-table-bg: #eef3f7;
    color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .table > :not(caption) > * > * {
    padding: 0.9rem 1rem;
    border-bottom-color: var(--vsrf-line);
}

body[data-theme="vsrf"] .table thead th {
    background: linear-gradient(180deg, #fafcfe, #eef3f7);
    color: var(--vsrf-navy-950);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

body[data-theme="vsrf"] .table-hover tbody tr:hover {
    --bs-table-hover-bg: #f3f7fb;
}

body[data-theme="vsrf"] .row-unread {
    --bs-table-bg: #f5edd9 !important;
    --bs-table-striped-bg: #f5edd9 !important;
    --bs-table-hover-bg: #ecdfbf !important;
}

body[data-theme="vsrf"] .btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: none !important;
}

body[data-theme="vsrf"] .btn:hover {
    transform: none;
}

body[data-theme="vsrf"] .btn-primary,
body[data-theme="vsrf"] .btn-success,
body[data-theme="vsrf"] .btn-info {
    background: linear-gradient(135deg, var(--vsrf-navy-900), var(--vsrf-navy-800));
    border-color: var(--vsrf-navy-900);
    color: var(--vsrf-white);
}

body[data-theme="vsrf"] .btn-primary:hover,
body[data-theme="vsrf"] .btn-success:hover,
body[data-theme="vsrf"] .btn-info:hover {
    background: linear-gradient(135deg, var(--vsrf-navy-950), var(--vsrf-navy-900));
    border-color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .btn-warning {
    background: linear-gradient(135deg, #c49f5c, var(--vsrf-gold-500));
    border-color: #c49f5c;
    color: #233241;
}

body[data-theme="vsrf"] .btn-danger {
    background: linear-gradient(135deg, #c45d56, var(--vsrf-danger));
    border-color: #b45049;
}

body[data-theme="vsrf"] .btn-secondary,
body[data-theme="vsrf"] .btn-outline-secondary {
    border-color: var(--vsrf-line-strong);
}

body[data-theme="vsrf"] .btn-outline-primary {
    color: var(--vsrf-navy-900);
    border-color: rgba(40, 77, 117, 0.25);
    background: var(--vsrf-white);
}

body[data-theme="vsrf"] .btn-outline-primary:hover {
    background: #edf3f9;
    color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .form-label {
    color: var(--vsrf-text);
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

body[data-theme="vsrf"] .form-control,
body[data-theme="vsrf"] .form-select,
body[data-theme="vsrf"] .select2-container--default .select2-selection--single,
body[data-theme="vsrf"] .select2-container--default .select2-selection--multiple,
body[data-theme="vsrf"] .input-group-text {
    min-height: 46px;
    border-color: var(--vsrf-line);
    background: #fbfcfd;
}

body[data-theme="vsrf"] .form-control,
body[data-theme="vsrf"] .form-select,
body[data-theme="vsrf"] .input-group-text {
    border-radius: 10px;
}

body[data-theme="vsrf"] .input-group > .form-control {
    border-left: 0;
}

body[data-theme="vsrf"] .input-group-text {
    background: var(--vsrf-white);
    color: var(--vsrf-text-muted);
}

body[data-theme="vsrf"] .form-control:focus,
body[data-theme="vsrf"] .form-select:focus {
    border-color: var(--vsrf-navy-800);
    box-shadow: 0 0 0 0.18rem rgba(59, 103, 143, 0.15);
}

body[data-theme="vsrf"] .text-muted,
body[data-theme="vsrf"] .form-text {
    color: var(--vsrf-text-muted) !important;
}

body[data-theme="vsrf"] .status-active,
body[data-theme="vsrf"] .badge-success {
    background: #e5f3ea !important;
    color: #26563d !important;
}

body[data-theme="vsrf"] .status-inactive,
body[data-theme="vsrf"] .badge-danger {
    background: #f8e2e1 !important;
    color: #8a3131 !important;
}

body[data-theme="vsrf"] .badge-warning {
    background: #f2e4c2 !important;
    color: #6c511a !important;
}

body[data-theme="vsrf"] .alert-info {
    background: #eef4fb;
    border-color: #cad7e5;
    color: var(--vsrf-navy-900);
}

body[data-theme="vsrf"] .alert-success {
    background: #edf6ef;
    border-color: #cfddcf;
    color: #315a38;
}

body[data-theme="vsrf"] .alert-warning {
    background: #faf4e8;
    border-color: #e3d3af;
    color: #6d5422;
}

body[data-theme="vsrf"] .alert-danger {
    background: #fff1ef;
    border-color: #e4c2be;
    color: #8c2f28;
}

body[data-theme="vsrf"] .filter-toolbar {
    row-gap: 0.85rem !important;
}

body[data-theme="vsrf"] .filter-toolbar .btn[type="submit"] {
    min-height: 46px;
}

body[data-theme="vsrf"] .pagination .page-link {
    border-color: var(--vsrf-line);
    color: var(--vsrf-navy-900);
}

body[data-theme="vsrf"] .pagination .page-item.active .page-link {
    background: var(--vsrf-navy-900);
    border-color: var(--vsrf-navy-900);
    color: var(--vsrf-white);
}

body[data-theme="vsrf"] .nav-tabs,
body[data-theme="vsrf"] .nav-pills {
    gap: 0.45rem;
    border-bottom: 0;
}

body[data-theme="vsrf"] .nav-tabs .nav-link,
body[data-theme="vsrf"] .nav-pills .nav-link {
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--vsrf-navy-900);
    font-weight: 600;
    padding: 0.55rem 0.95rem;
}

body[data-theme="vsrf"] .nav-tabs .nav-link.active,
body[data-theme="vsrf"] .nav-pills .nav-link.active {
    background: var(--vsrf-navy-900);
    color: var(--vsrf-white);
    border-color: var(--vsrf-navy-900);
}

body[data-theme="vsrf"] .list-group-item {
    border-color: var(--vsrf-line);
}

body[data-theme="vsrf"] .row.mb-4 > [class*="col-"] > .card .card-body {
    min-height: 118px;
}

body[data-theme="vsrf"] .row.mb-4 > [class*="col-"] > .card .fa-2x {
    font-size: 1.5rem !important;
    margin-bottom: 0.6rem !important;
}

body[data-theme="vsrf"] .row.mb-4 > [class*="col-"] > .card .card-title {
    font-size: 1.95rem;
    font-weight: 700;
    line-height: 1.05;
}

body[data-theme="vsrf"] .row.mb-4 > [class*="col-"] > .card .card-text {
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.35;
}

body[data-theme="vsrf"] .popover {
    border: 1px solid var(--vsrf-line);
    box-shadow: 0 18px 34px rgba(19, 43, 69, 0.12);
}

body[data-theme="vsrf"] .mail-user-layout {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

body[data-theme="vsrf"] .mail-user-layout > * {
    margin-bottom: 0 !important;
}

body[data-theme="vsrf"] .mail-user-org-panel {
    order: 1;
}

body[data-theme="vsrf"] .mail-user-filter-panel {
    order: 2;
}

body[data-theme="vsrf"] .mail-user-table-panel {
    order: 3;
}

body[data-theme="vsrf"] .mail-user-stats-panel {
    order: 4;
    --bs-gutter-x: 0.9rem;
    --bs-gutter-y: 0.9rem;
}

body[data-theme="vsrf"] .mail-user-admin-panel {
    order: 5;
    margin-top: 0 !important;
}

body[data-theme="vsrf"] .mail-user-template-panel {
    order: 6;
}

body[data-theme="vsrf"] .mail-user-org-panel .card-body {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

body[data-theme="vsrf"] .mail-user-workspace-label {
    color: var(--vsrf-text-muted);
    margin-bottom: 0.35rem;
}

body[data-theme="vsrf"] .mail-user-workspace-actions {
    justify-content: flex-end;
}

body[data-theme="vsrf"] .mail-user-workspace-actions .btn {
    min-height: 40px;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

body[data-theme="vsrf"] .mail-user-filter-panel .card-body {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

body[data-theme="vsrf"] .mail-user-table-panel .card-header {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

body[data-theme="vsrf"] .mail-user-toolbar {
    align-items: center;
    gap: 0.5rem !important;
}

body[data-theme="vsrf"] .mail-user-toolbar .btn {
    min-height: 42px;
}

body[data-theme="vsrf"] .mail-user-table-meta {
    color: var(--vsrf-text-muted) !important;
    font-size: 0.84rem !important;
    font-weight: 600;
}

body[data-theme="vsrf"] .mail-user-filter-note {
    color: var(--vsrf-text-muted) !important;
    font-size: 0.82rem !important;
    font-weight: 600;
}

body[data-theme="vsrf"] .mail-user-filter-actions .btn {
    min-height: 44px;
}

body[data-theme="vsrf"] .mail-user-table-panel .table-responsive {
    overflow-x: auto;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table {
    width: 100%;
    min-width: 1520px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table tr,
body[data-theme="vsrf"] .mail-user-table-panel .users-table thead tr,
body[data-theme="vsrf"] .mail-user-table-panel .users-table tbody tr {
    display: table-row !important;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table th,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td {
    display: table-cell !important;
    vertical-align: middle;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td {
    line-height: 1.35;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-index {
    width: 104px;
    white-space: nowrap;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-name {
    width: 19%;
    word-break: break-word;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-position {
    width: 12%;
    word-break: break-word;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-oa {
    width: 9%;
    word-break: break-word;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-email {
    width: 18%;
    word-break: break-word;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-status {
    width: 9%;
    white-space: nowrap;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-sync {
    width: 11%;
    word-break: break-word;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-deletion {
    width: 10%;
    white-space: nowrap;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-actions {
    width: 12%;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-actions > .d-flex {
    justify-content: flex-start;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .mail-user-stats-panel {
    --bs-gutter-x: 0.6rem;
    --bs-gutter-y: 0.6rem;
}

body[data-theme="vsrf"] .mail-user-stats-panel .card .card-body {
    gap: 0.7rem;
    padding: 0.75rem 0.85rem;
}

body[data-theme="vsrf"] .mail-user-stats-panel .card-title {
    font-size: 1.2rem !important;
}

body[data-theme="vsrf"] .mail-user-stats-panel .card-text {
    font-size: 0.76rem !important;
}

body[data-theme="vsrf"] .mail-user-stats-panel > [class*="col-"] {
    display: flex;
}

body[data-theme="vsrf"] .mail-user-stats-panel > [class*="col-"] > .card {
    width: 100%;
}

body[data-theme="vsrf"] .mail-user-stats-panel .card {
    box-shadow: 0 8px 18px rgba(20, 45, 71, 0.05) !important;
}

body[data-theme="vsrf"] .mail-user-stats-panel .card .card-body {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: auto !important;
    padding: 0.9rem 1rem;
    text-align: left !important;
}

body[data-theme="vsrf"] .mail-user-stats-panel .fa-2x {
    flex: 0 0 auto;
    font-size: 1.2rem !important;
    margin-bottom: 0 !important;
}

body[data-theme="vsrf"] .mail-user-stats-panel .card-title {
    margin: 0 !important;
    font-size: 1.45rem !important;
    font-weight: 700;
}

body[data-theme="vsrf"] .mail-user-stats-panel .card-text {
    margin: 0 !important;
    font-size: 0.82rem !important;
    line-height: 1.3;
}

body[data-theme="vsrf"] .mail-user-stats-panel .col-md-12 .card .card-body {
    display: grid;
    grid-template-columns: auto auto minmax(180px, 1fr) auto;
    align-items: center;
    gap: 1rem;
}

body[data-theme="vsrf"] .mail-user-stats-panel .col-md-12 .card-title {
    font-size: 1.55rem !important;
}

body[data-theme="vsrf"] .mail-user-stats-panel .col-md-12 .card-text,
body[data-theme="vsrf"] .mail-user-stats-panel .col-md-12 #bind-unbound-hint {
    font-size: 0.84rem !important;
}

body[data-theme="vsrf"] .mail-user-stats-panel .col-md-12 #bind-unbound-btn {
    white-space: nowrap;
}

body[data-theme="vsrf"] .mail-user-admin-panel .row {
    --bs-gutter-y: 0.9rem;
}

body[data-theme="vsrf"] .mail-user-admin-panel .card-body {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

@media (max-width: 992px) {
    body[data-theme="vsrf"] .header-container,
    body[data-theme="vsrf"] main {
        padding-left: 18px;
        padding-right: 18px;
    }

    body[data-theme="vsrf"] .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    body[data-theme="vsrf"] .user-info,
    body[data-theme="vsrf"] .user-greeting {
        width: 100%;
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .header-title {
        font-size: 1.75rem;
    }

    body[data-theme="vsrf"] .mail-user-stats-panel .col-md-12 .card .card-body {
        grid-template-columns: 1fr;
        text-align: left !important;
    }

    body[data-theme="vsrf"] .mail-user-workspace-actions {
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .mail-user-filter-note,
    body[data-theme="vsrf"] .mail-user-table-meta {
        display: none;
    }

    body[data-theme="vsrf"] .mail-user-filter-actions {
        width: 100%;
    }
}

@media (max-width: 768px) {
    body[data-theme="vsrf"] .nav-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    body[data-theme="vsrf"] .nav-links a {
        justify-content: center;
    }

    body[data-theme="vsrf"] .theme-switcher {
        width: 100%;
        justify-content: stretch;
    }

    body[data-theme="vsrf"] .theme-switcher-btn {
        flex: 1 1 auto;
    }

    body[data-theme="vsrf"] .row.mb-4 > [class*="col-"] > .card .card-body {
        min-height: auto;
    }

    body[data-theme="vsrf"] .mail-user-toolbar {
        justify-content: stretch;
    }

    body[data-theme="vsrf"] .mail-user-toolbar > .d-inline-block {
        flex: 1 1 100%;
    }

    body[data-theme="vsrf"] .mail-user-toolbar .btn {
        width: 100%;
    }

    body[data-theme="vsrf"] .header-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    body[data-theme="vsrf"] footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    body[data-theme="vsrf"] .mail-user-table-panel .users-table {
        min-width: 1280px;
    }
}

body[data-theme="vsrf"] .header-container {
    padding-left: 24px;
    padding-right: 24px;
}

body[data-theme="vsrf"] main {
    margin-top: 0;
    padding-left: 20px;
    padding-right: 20px;
}

body[data-theme="vsrf"] footer {
    padding-left: 24px;
    padding-right: 24px;
}

body[data-theme="vsrf"] .mail-user-layout {
    width: min(100%, 1740px);
    margin: 0 auto;
    padding-top: 0.5rem;
}

body[data-theme="vsrf"] .mail-user-actionbar-panel {
    order: 2;
}

body[data-theme="vsrf"] .mail-user-filter-panel {
    order: 3;
}

body[data-theme="vsrf"] .mail-user-table-panel {
    order: 4;
}

body[data-theme="vsrf"] .mail-user-summary-panel {
    order: 5;
}

body[data-theme="vsrf"] .mail-user-admin-panel {
    order: 6;
}

body[data-theme="vsrf"] .mail-user-template-panel {
    order: 7;
}

body[data-theme="vsrf"] .mail-user-stats-panel {
    display: none;
}

body[data-theme="vsrf"] .mail-user-actionbar-panel .card-body,
body[data-theme="vsrf"] .mail-user-org-panel .card-body,
body[data-theme="vsrf"] .mail-user-filter-panel .card-body {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

body[data-theme="vsrf"] .mail-user-actionbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

body[data-theme="vsrf"] .mail-user-actionbar-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vsrf-text-muted);
    margin-bottom: 0.2rem;
}

body[data-theme="vsrf"] .mail-user-actionbar-note {
    color: var(--vsrf-text-muted);
    font-size: 0.9rem;
}

body[data-theme="vsrf"] .mail-user-actionbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

body[data-theme="vsrf"] .mail-user-actionbar-actions .btn {
    min-height: 42px;
    padding: 0.65rem 1rem;
}

body[data-theme="vsrf"] .mail-user-filter-actions {
    display: flex;
    gap: 0.5rem;
}

body[data-theme="vsrf"] .mail-user-filter-actions .btn {
    flex: 1 1 auto;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-status {
    width: 8%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-sync {
    width: 12%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-deletion {
    width: 9%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-actions {
    width: 13%;
}

body[data-theme="vsrf"] .mail-user-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
}

body[data-theme="vsrf"] .mail-user-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(40, 77, 117, 0.18);
    background: #f8fbfe;
    color: var(--vsrf-navy-900);
}

body[data-theme="vsrf"] .mail-user-action-btn:hover,
body[data-theme="vsrf"] .mail-user-action-btn:focus {
    background: #eef4fb;
    color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .mail-user-action-btn-accent {
    background: #edf4fb;
}

body[data-theme="vsrf"] .mail-user-action-btn-danger {
    background: #fff5f3;
    border-color: rgba(166, 66, 66, 0.18);
    color: var(--vsrf-danger);
}

body[data-theme="vsrf"] .mail-user-action-btn-danger:hover,
body[data-theme="vsrf"] .mail-user-action-btn-danger:focus {
    background: #feeceb;
    color: #8f2f28;
}

body[data-theme="vsrf"] .mail-user-action-toggle::after {
    display: none;
}

body[data-theme="vsrf"] .mail-user-action-menu {
    min-width: 250px;
    border-radius: 12px;
    border: 1px solid var(--vsrf-line);
    box-shadow: 0 18px 40px rgba(20, 45, 71, 0.14);
    padding: 0.4rem;
}

body[data-theme="vsrf"] .mail-user-action-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    color: var(--vsrf-text);
    font-size: 0.9rem;
}

body[data-theme="vsrf"] .mail-user-action-menu .dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--vsrf-navy-800);
}

body[data-theme="vsrf"] .mail-user-action-menu .dropdown-item:hover,
body[data-theme="vsrf"] .mail-user-action-menu .dropdown-item:focus {
    background: #eef4fb;
    color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .mail-user-summary-panel .card-body {
    padding: 0.9rem 1rem;
}

body[data-theme="vsrf"] .mail-user-summary-ribbon {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.65rem;
}

body[data-theme="vsrf"] .mail-user-summary-item {
    min-height: 86px;
    border: 1px solid var(--vsrf-line);
    border-radius: 10px;
    background: #fbfcfe;
    padding: 0.7rem 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

body[data-theme="vsrf"] .mail-user-summary-item-warning {
    background: #fffaf0;
}

body[data-theme="vsrf"] .mail-user-summary-item-danger {
    background: #fff5f3;
}

body[data-theme="vsrf"] .mail-user-summary-label {
    color: var(--vsrf-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

body[data-theme="vsrf"] .mail-user-summary-value {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .mail-user-summary-meta {
    color: var(--vsrf-text-muted);
    font-size: 0.82rem;
}

body[data-theme="vsrf"] .mail-user-summary-unbound {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid var(--vsrf-line);
    border-radius: 10px;
    background: #fbfcfe;
    padding: 0.85rem 1rem;
}

body[data-theme="vsrf"] .mail-user-summary-unbound-main {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

body[data-theme="vsrf"] .mail-user-summary-unbound-icon {
    color: var(--vsrf-warning);
    font-size: 1.15rem;
}

body[data-theme="vsrf"] .mail-user-summary-unbound-copy {
    min-width: 0;
}

body[data-theme="vsrf"] .mail-user-summary-unbound-row {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .mail-user-summary-unbound .btn {
    white-space: nowrap;
}

body[data-theme="vsrf"] .modal {
    --bs-modal-border-radius: 12px;
}

body[data-theme="vsrf"] .modal-backdrop.show {
    opacity: 0.5;
}

body[data-theme="vsrf"] .modal-dialog {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

body[data-theme="vsrf"] .modal-content {
    border-radius: 12px;
    border: 1px solid rgba(40, 77, 117, 0.18) !important;
    box-shadow: 0 24px 54px rgba(14, 35, 56, 0.24) !important;
    overflow: hidden;
}

body[data-theme="vsrf"] .modal-header {
    padding: 0.95rem 1.2rem;
    background: linear-gradient(135deg, var(--vsrf-navy-950), var(--vsrf-navy-900)) !important;
    color: var(--vsrf-white) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="vsrf"] .modal-title {
    font-size: 1.2rem;
}

body[data-theme="vsrf"] .modal-body {
    padding: 1.1rem 1.2rem;
    background: #fbfcfe;
}

body[data-theme="vsrf"] .modal-body .border.rounded,
body[data-theme="vsrf"] .modal-body .alert,
body[data-theme="vsrf"] .modal-body .table-responsive {
    border-radius: 10px !important;
}

body[data-theme="vsrf"] .modal-footer {
    padding: 0.9rem 1.2rem;
    background: #f7f9fc;
    border-top: 1px solid var(--vsrf-line) !important;
}

body[data-theme="vsrf"] .modal .btn-close {
    filter: invert(1);
    opacity: 0.8;
}

body[data-theme="vsrf"] .modal .btn-group[role="group"] {
    padding: 0.25rem;
    background: #f3f7fb;
    border: 1px solid var(--vsrf-line);
    border-radius: 10px;
}

body[data-theme="vsrf"] .modal .btn-group[role="group"] .btn {
    border-radius: 8px !important;
    border: 0;
}

@media (max-width: 992px) {
    body[data-theme="vsrf"] .mail-user-actionbar {
        flex-direction: column;
        align-items: flex-start;
    }

    body[data-theme="vsrf"] .mail-user-actionbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .mail-user-summary-ribbon {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body[data-theme="vsrf"] .mail-user-summary-unbound {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    body[data-theme="vsrf"] main {
        padding-left: 12px;
        padding-right: 12px;
    }

    body[data-theme="vsrf"] .mail-user-summary-ribbon {
        grid-template-columns: 1fr;
    }
}

body[data-theme="vsrf"] .mail-user-layout,
body[data-theme="vsrf"] .requests-page-layout,
body[data-theme="vsrf"] .admin-page-layout {
    width: min(100%, 1760px);
    margin: 0 auto;
    padding-top: 0.35rem;
}

body[data-theme="vsrf"] .mail-user-page-head,
body[data-theme="vsrf"] .requests-page-head,
body[data-theme="vsrf"] .admin-page-head {
    margin-bottom: 1rem;
}

body[data-theme="vsrf"] .mail-user-page-title,
body[data-theme="vsrf"] .requests-page-title,
body[data-theme="vsrf"] .admin-page-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 2.05rem;
    font-weight: 700;
    color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .mail-user-page-title i {
    color: var(--vsrf-accent);
    font-size: 1.45rem;
}

body[data-theme="vsrf"] .mail-user-page-subtitle,
body[data-theme="vsrf"] .requests-page-subtitle,
body[data-theme="vsrf"] .admin-page-subtitle {
    margin: 0.3rem 0 0;
    color: var(--vsrf-text-muted);
    font-size: 0.98rem;
}

body[data-theme="vsrf"] .mail-user-topbar-panel .card-body {
    padding: 0.95rem 1rem;
}

body[data-theme="vsrf"] .mail-user-topbar {
    display: grid;
    grid-template-columns: minmax(210px, 280px) minmax(280px, 360px) 1fr;
    gap: 1rem;
    align-items: end;
}

body[data-theme="vsrf"] .mail-user-topbar-current,
body[data-theme="vsrf"] .mail-user-topbar-switch,
body[data-theme="vsrf"] .mail-user-topbar-actions {
    min-width: 0;
}

body[data-theme="vsrf"] .mail-user-topbar-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vsrf-text-muted);
    margin-bottom: 0.35rem;
}

body[data-theme="vsrf"] .mail-user-topbar-org {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--vsrf-accent);
    line-height: 1.1;
}

body[data-theme="vsrf"] .mail-user-topbar-domain {
    margin-top: 0.2rem;
    color: var(--vsrf-text-muted);
    font-size: 0.9rem;
}

body[data-theme="vsrf"] .mail-user-topbar-switch .form-label {
    margin-bottom: 0.35rem;
    color: var(--vsrf-text-muted);
    font-size: 0.82rem;
}

body[data-theme="vsrf"] .mail-user-topbar-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

body[data-theme="vsrf"] .mail-user-topbar-actions .btn {
    min-height: 40px;
    padding: 0.62rem 0.95rem;
}

body[data-theme="vsrf"] .mail-user-filter-panel .card-header,
body[data-theme="vsrf"] .requests-filter-panel .card-header,
body[data-theme="vsrf"] .requests-table-panel .card-header,
body[data-theme="vsrf"] .admin-table-panel .card-header,
body[data-theme="vsrf"] .admin-toolbar-panel .card-header {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

body[data-theme="vsrf"] .mail-user-filter-panel .card-body,
body[data-theme="vsrf"] .requests-filter-panel .card-body,
body[data-theme="vsrf"] .admin-toolbar-panel .card-body {
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
}

body[data-theme="vsrf"] .requests-filter-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .domain-chip-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

body[data-theme="vsrf"] .domain-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.28rem 0.55rem;
    border: 1px solid var(--vsrf-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--vsrf-text);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.1;
    white-space: normal;
    word-break: break-word;
}

body[data-theme="vsrf"] .domain-chip::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    margin-right: 0.4rem;
    border-radius: 999px;
    background: var(--bs-success);
    flex: 0 0 auto;
}

body[data-theme="vsrf"] .domain-chip--warning {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(255, 247, 237, 0.85);
}

body[data-theme="vsrf"] .domain-chip--warning::before {
    background: var(--bs-warning);
}

body[data-theme="vsrf"] .domain-chip--disabled {
    border-color: rgba(220, 53, 69, 0.35);
    background: rgba(248, 249, 250, 0.9);
    color: var(--vsrf-text-muted);
    text-decoration: line-through;
}

body[data-theme="vsrf"] .domain-chip--disabled::before {
    background: var(--bs-danger);
}

body[data-theme="vsrf"] .organization-stats {
    display: grid;
    gap: 0.18rem;
    font-size: 0.82rem;
    line-height: 1.2;
}

body[data-theme="vsrf"] .organization-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    margin-left: 0.35rem;
    border-radius: 999px;
    font-size: 0.78rem;
    vertical-align: middle;
}

body[data-theme="vsrf"] .organization-warning--warning {
    background: rgba(255, 193, 7, 0.18);
    color: #9a6700;
}

body[data-theme="vsrf"] .organization-warning--danger {
    background: rgba(220, 53, 69, 0.14);
    color: var(--bs-danger);
}

body[data-theme="vsrf"] .admin-table-shell th a {
    color: inherit;
    text-decoration: none;
}

body[data-theme="vsrf"] .admin-table-shell th a:hover {
    color: var(--bs-primary);
    text-decoration: underline;
}

body[data-theme="vsrf"] .admin-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--vsrf-border);
    background: rgba(248, 250, 252, 0.7);
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-email {
    width: 18%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-name {
    width: 18%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-position {
    width: 11%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-actions {
    width: 11%;
}

body[data-theme="vsrf"] .mail-user-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #ffffff;
    color: var(--vsrf-navy-800);
}

body[data-theme="vsrf"] .mail-user-action-btn-accent {
    background: #ffffff;
}

body[data-theme="vsrf"] .mail-user-action-btn-danger {
    background: var(--vsrf-white);
    color: var(--vsrf-danger);
}

body[data-theme="vsrf"] .mail-user-action-menu {
    min-width: 240px;
    padding: 0.35rem;
    z-index: 2055;
}

body[data-theme="vsrf"] .mail-user-summary-panel .card-body {
    padding: 0.75rem 0.9rem;
}

body[data-theme="vsrf"] .mail-user-summary-ribbon {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

body[data-theme="vsrf"] .mail-user-summary-item {
    min-height: auto;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    background: #f7f9fc;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: baseline;
    gap: 0.55rem;
}

body[data-theme="vsrf"] .mail-user-summary-label,
body[data-theme="vsrf"] .mail-user-summary-meta {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8rem;
    font-weight: 600;
}

body[data-theme="vsrf"] .mail-user-summary-value {
    margin-top: 0;
    font-size: 1.05rem;
}

body[data-theme="vsrf"] .mail-user-summary-unbound {
    margin-top: 0.6rem;
    padding: 0.7rem 0.9rem;
}

body[data-theme="vsrf"] .mail-user-summary-unbound .btn {
    min-height: 38px;
}

body[data-theme="vsrf"] .modal {
    --bs-modal-border-radius: 8px;
}

body[data-theme="vsrf"] .modal-dialog {
    margin-top: 1.2rem;
    margin-bottom: 1.2rem;
}

body[data-theme="vsrf"] .modal-content {
    border-radius: 8px;
    border: 1px solid rgba(32, 58, 88, 0.22) !important;
    box-shadow: 0 26px 60px rgba(14, 35, 56, 0.3) !important;
}

body[data-theme="vsrf"] .modal-header.modal-work-header {
    padding: 0.95rem 1.15rem;
}

body[data-theme="vsrf"] .modal-work-body {
    padding: 1rem 1.15rem;
    background: #f7f9fc;
}

body[data-theme="vsrf"] .modal-work-footer {
    padding: 0.85rem 1.15rem;
}

body[data-theme="vsrf"] .modal-section {
    background: #ffffff;
    border: 1px solid var(--vsrf-line);
    border-radius: 8px;
    padding: 0.9rem 0.95rem;
}

body[data-theme="vsrf"] .modal-section + .modal-section {
    margin-top: 0.9rem;
}

body[data-theme="vsrf"] .modal-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

body[data-theme="vsrf"] .modal-section-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--vsrf-navy-950);
}

body[data-theme="vsrf"] .modal-section-note {
    margin: 0.2rem 0 0;
    color: var(--vsrf-text-muted);
    font-size: 0.86rem;
}

body[data-theme="vsrf"] .department-delete-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

body[data-theme="vsrf"] .department-delete-step {
    border: 1px solid var(--vsrf-line);
    border-radius: 999px;
    background: #f7f9fc;
    color: var(--vsrf-text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.28rem 0.65rem;
}

body[data-theme="vsrf"] .department-delete-step.is-active {
    border-color: var(--vsrf-blue-600);
    background: #eaf2ff;
    color: var(--vsrf-blue-800);
}

body[data-theme="vsrf"] .department-delete-step.is-done {
    border-color: #8fc7a8;
    background: #edf8f1;
    color: #276749;
}

body[data-theme="vsrf"] .department-delete-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

body[data-theme="vsrf"] .department-delete-summary-grid span,
body[data-theme="vsrf"] .department-delete-reassignment-row {
    border: 1px solid var(--vsrf-line);
    border-radius: 6px;
    background: #f7f9fc;
    padding: 0.5rem 0.6rem;
}

body[data-theme="vsrf"] .department-delete-order-list {
    max-height: 120px;
    overflow: auto;
    color: var(--vsrf-text-muted);
    font-size: 0.86rem;
}

body[data-theme="vsrf"] .department-delete-reassignment-list {
    display: grid;
    gap: 0.55rem;
}

body[data-theme="vsrf"] .department-delete-reassignment-row {
    display: grid;
    grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1.2fr);
    gap: 0.75rem;
    align-items: center;
}

body[data-theme="vsrf"] .department-delete-reassignment-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

body[data-theme="vsrf"] .department-delete-reassignment-label span {
    color: var(--vsrf-text-muted);
    font-size: 0.82rem;
}

body[data-theme="vsrf"] .modal-soft-panel {
    border: 1px solid var(--vsrf-line);
    border-radius: 8px;
    background: #f8fbfe;
    padding: 0.85rem 0.9rem;
}

body[data-theme="vsrf"] .modal-switch {
    margin: 0;
    min-width: 0;
    padding-left: 2.6rem;
}

body[data-theme="vsrf"] .modal-switch .form-check-input {
    width: 2.2rem;
    height: 1.2rem;
    margin-left: -2.6rem;
}

body[data-theme="vsrf"] .modal-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

body[data-theme="vsrf"] .modal-mode-switcher {
    padding: 0.22rem;
    background: #edf2f7;
    border-radius: 8px;
}

body[data-theme="vsrf"] .modal-mode-switcher .btn {
    min-height: 42px;
}

body[data-theme="vsrf"] .requests-page-shell,
body[data-theme="vsrf"] .admin-page-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

body[data-theme="vsrf"] .admin-page-shell > .admin-toolbar-panel {
    order: 20;
}

body[data-theme="vsrf"] .admin-page-shell > .mail-user-filter-panel {
    order: 30;
}

body[data-theme="vsrf"] .admin-page-shell > .admin-table-panel {
    order: 40;
}

body[data-theme="vsrf"] .requests-page-tabs,
body[data-theme="vsrf"] #navigation-bar-admin,
body[data-theme="vsrf"] #navigation-bar-admin-chains {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

body[data-theme="vsrf"] .requests-page-tabs .btn,
body[data-theme="vsrf"] #navigation-bar-admin .btn,
body[data-theme="vsrf"] #navigation-bar-admin-chains .btn {
    border-radius: 999px;
    padding: 0.6rem 0.95rem !important;
}

body[data-theme="vsrf"] .admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

body[data-theme="vsrf"] .requests-modal-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    color: var(--vsrf-text);
}

@media (max-width: 1200px) {
    body[data-theme="vsrf"] .mail-user-topbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    body[data-theme="vsrf"] .mail-user-topbar-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    body[data-theme="vsrf"] .mail-user-page-title,
    body[data-theme="vsrf"] .requests-page-title,
    body[data-theme="vsrf"] .admin-page-title {
        font-size: 1.65rem;
    }

    body[data-theme="vsrf"] .modal-section-head,
    body[data-theme="vsrf"] .admin-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

body[data-theme="vsrf"] header {
    background: linear-gradient(180deg, #355b84 0%, #24486f 100%);
    border-bottom: 0;
    box-shadow: none;
    border-radius: 0;
}

body[data-theme="vsrf"] .header-container {
    padding: 0;
    margin: 0 !important;
}

body[data-theme="vsrf"] .header-top,
body[data-theme="vsrf"] .main-nav {
    max-width: 1760px;
    margin: 0 auto;
    padding-left: 28px;
    padding-right: 28px;
}

body[data-theme="vsrf"] .header-top {
    padding-top: 18px;
    padding-bottom: 14px;
    border-bottom: 0;
}

body[data-theme="vsrf"] .main-nav {
    padding-top: 0;
    padding-bottom: 16px;
}

body[data-theme="vsrf"] .nav-links {
    gap: 8px;
}

body[data-theme="vsrf"] .nav-links a {
    border-radius: 10px;
    padding: 9px 12px;
}

body[data-theme="vsrf"] main {
    margin: 0;
    padding: 0 18px 24px;
    min-height: calc(100vh - 188px);
}

body[data-theme="vsrf"] footer {
    margin: 20px 0 0 !important;
    padding: 0;
    background: #1f4063;
    border-top: 0;
    border-radius: 0;
}

body[data-theme="vsrf"] .footer-container {
    max-width: 1760px;
    margin: 0 auto;
    padding: 18px 28px;
}

body[data-theme="vsrf"] footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
}

body[data-theme="vsrf"] .mail-user-layout {
    width: min(100%, 1760px);
    margin: 0 auto;
    padding-top: 0.25rem;
    gap: 0;
}

body[data-theme="vsrf"] .mail-user-workspace-panel {
    order: 1;
    margin-bottom: 0 !important;
}

body[data-theme="vsrf"] .mail-user-workspace-panel .card-body {
    padding: 0.9rem 1rem;
}

body[data-theme="vsrf"] .mail-user-workspace-panel,
body[data-theme="vsrf"] .mail-user-table-panel,
body[data-theme="vsrf"] .mail-user-summary-panel {
    border-radius: 12px;
}

body[data-theme="vsrf"] .mail-user-workspace-panel {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

body[data-theme="vsrf"] .mail-user-table-panel {
    border-top: 0 !important;
    border-radius: 0;
    margin-bottom: 0 !important;
}

body[data-theme="vsrf"] .mail-user-summary-panel {
    border-top: 0 !important;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-bottom: 1rem !important;
}

body[data-theme="vsrf"] .mail-user-template-panel {
    order: 7;
    margin-top: 0 !important;
}

body[data-theme="vsrf"] .mail-user-workspace-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    margin-bottom: 0.85rem;
}

body[data-theme="vsrf"] .mail-user-page-title {
    gap: 0.65rem;
    font-size: 1.85rem;
}

body[data-theme="vsrf"] .mail-user-page-subtitle {
    margin-top: 0.15rem;
    font-size: 0.92rem;
}

body[data-theme="vsrf"] .mail-user-workspace-row {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr minmax(300px, 420px);
    gap: 1rem;
    align-items: end;
    margin-bottom: 0.7rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--vsrf-line);
}

body[data-theme="vsrf"] .mail-user-topbar-current,
body[data-theme="vsrf"] .mail-user-topbar-switch {
    min-width: 0;
}

body[data-theme="vsrf"] .mail-user-topbar-switch {
    grid-column: 3;
    justify-self: end;
    width: min(100%, 420px);
}

body[data-theme="vsrf"] .mail-user-topbar-kicker {
    margin-bottom: 0.2rem;
}

body[data-theme="vsrf"] .mail-user-topbar-org {
    font-size: 1.25rem;
}

body[data-theme="vsrf"] .mail-user-topbar-domain {
    font-size: 0.86rem;
}

body[data-theme="vsrf"] .mail-user-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

body[data-theme="vsrf"] .mail-user-topbar-actions .btn {
    min-height: 40px;
    padding: 0.6rem 0.9rem;
}

body[data-theme="vsrf"] .mail-user-compact-filters {
    display: grid !important;
    grid-template-columns: minmax(220px, 2.1fr) minmax(150px, 1.45fr) minmax(150px, 1.05fr) minmax(170px, 1.15fr) minmax(170px, 1.15fr) auto;
    column-gap: 0.65rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--vsrf-line);
    row-gap: 0.55rem !important;
    margin: 0 !important;
    align-items: end;
}

body[data-theme="vsrf"] .mail-user-compact-filters > [class*="col-"] {
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: none !important;
}

body[data-theme="vsrf"] .mail-user-compact-filters .form-label {
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}

body[data-theme="vsrf"] .mail-user-compact-filters .form-control,
body[data-theme="vsrf"] .mail-user-compact-filters .form-select,
body[data-theme="vsrf"] .mail-user-compact-filters .input-group-text {
    min-height: 42px;
}

body[data-theme="vsrf"] .mail-user-filter-actions {
    justify-content: flex-start;
    gap: 0.45rem;
    flex-wrap: nowrap;
}

body[data-theme="vsrf"] .mail-user-filter-actions .btn {
    flex: 0 0 auto;
    min-width: 104px;
    min-height: 40px;
    padding-left: 0.8rem;
    padding-right: 0.8rem;
}

body[data-theme="vsrf"] .mail-user-table-panel .card-header {
    padding: 0.75rem 1rem;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-status,
body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-sync,
body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-deletion,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-status,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion {
    text-align: center;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-status .badge,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync .badge,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    text-align: center;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync > .d-inline-block,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-status > .d-inline-block,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion > .d-inline-block {
    display: inline-flex !important;
    justify-content: center;
    max-width: 100%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-status {
    width: 10%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-sync {
    width: 12%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-deletion {
    width: 11%;
}

body[data-theme="vsrf"] .mail-user-table-panel .table-responsive {
    overflow-x: visible;
    overflow-y: visible !important;
    position: relative;
}

body[data-theme="vsrf"] .mail-user-table-panel .card-body,
body[data-theme="vsrf"] .mail-user-table-panel,
body[data-theme="vsrf"] .mail-user-table-panel .users-actions,
body[data-theme="vsrf"] .mail-user-table-panel .dropdown {
    overflow: visible !important;
}

body[data-theme="vsrf"] .mail-user-summary-panel .card-body {
    padding: 0.75rem 0.85rem;
}

body[data-theme="vsrf"] .mail-user-summary-ribbon {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
}

body[data-theme="vsrf"] .mail-user-summary-item {
    min-height: 88px;
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem;
}

body[data-theme="vsrf"] .mail-user-summary-label {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

body[data-theme="vsrf"] .mail-user-summary-meta {
    font-size: 0.78rem;
    line-height: 1.3;
}

body[data-theme="vsrf"] .mail-user-summary-value {
    font-size: 1.25rem;
}

body[data-theme="vsrf"] .mail-user-summary-item-accent {
    background: #f6f9fc;
}

body[data-theme="vsrf"] .mail-user-summary-item-unbound .mail-user-summary-unbound-inline {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
}

body[data-theme="vsrf"] .mail-user-summary-item-unbound .mail-user-summary-meta {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.76rem;
}

body[data-theme="vsrf"] .mail-user-summary-item-unbound .btn {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0.35rem 0.7rem;
}

@media (max-width: 1200px) {
    body[data-theme="vsrf"] .mail-user-workspace-head,
    body[data-theme="vsrf"] .mail-user-workspace-row {
        grid-template-columns: 1fr;
    }

    body[data-theme="vsrf"] .mail-user-topbar-switch {
        grid-column: auto;
        justify-self: stretch;
        width: 100%;
    }

    body[data-theme="vsrf"] .mail-user-topbar-actions {
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .mail-user-compact-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body[data-theme="vsrf"] .mail-user-summary-ribbon {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    body[data-theme="vsrf"] .header-top,
    body[data-theme="vsrf"] .main-nav,
    body[data-theme="vsrf"] .footer-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    body[data-theme="vsrf"] main {
        padding-left: 12px;
        padding-right: 12px;
    }

    body[data-theme="vsrf"] .mail-user-workspace-panel .card-body {
        padding: 0.8rem 0.85rem;
    }

    body[data-theme="vsrf"] .mail-user-summary-ribbon {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body[data-theme="vsrf"] .mail-user-compact-filters {
        grid-template-columns: 1fr;
    }

    body[data-theme="vsrf"] .mail-user-filter-actions .btn {
        flex: 1 1 100%;
    }

    body[data-theme="vsrf"] .mail-user-table-panel .table-responsive {
        overflow-x: auto;
    }
}

body[data-theme="vsrf"] .header-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

body[data-theme="vsrf"] .user-greeting {
    display: flex;
    align-items: center;
    row-gap: 6px;
}

body[data-theme="vsrf"] .mail-user-workspace-panel .card-body {
    padding: 0.8rem 1rem;
}

body[data-theme="vsrf"] .mail-user-workspace-row {
    margin-bottom: 0.55rem;
}

body[data-theme="vsrf"] .mail-user-compact-filters {
    padding-top: 0.55rem;
}

body[data-theme="vsrf"] .mail-user-compact-filters .form-label {
    margin-bottom: 0.22rem;
    font-size: 0.76rem;
}

body[data-theme="vsrf"] .mail-user-compact-filters .form-control,
body[data-theme="vsrf"] .mail-user-compact-filters .form-select,
body[data-theme="vsrf"] .mail-user-compact-filters .input-group-text {
    min-height: 40px;
}

body[data-theme="vsrf"] .mail-user-table-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
}

body[data-theme="vsrf"] .mail-user-table-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

body[data-theme="vsrf"] .mail-user-table-actions .btn {
    min-height: 38px;
    padding: 0.5rem 0.8rem;
}

body[data-theme="vsrf"] .mail-user-summary-item {
    min-height: 76px;
    padding: 0.55rem 0.75rem;
    gap: 0.2rem;
}

body[data-theme="vsrf"] .mail-user-summary-label {
    font-size: 0.76rem;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 700;
    line-height: 1.25;
}

body[data-theme="vsrf"] .mail-user-summary-value {
    font-size: 1.35rem;
}

body[data-theme="vsrf"] .mail-user-summary-ribbon {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

body[data-theme="vsrf"] .mail-user-summary-item-unbound .mail-user-summary-unbound-inline {
    justify-content: flex-end;
}

@media (max-width: 1200px) {
    body[data-theme="vsrf"] .mail-user-table-toolbar {
        grid-template-columns: 1fr;
    }

    body[data-theme="vsrf"] .mail-user-table-actions {
        justify-content: flex-start;
    }
}

body[data-theme="vsrf"] .header-top {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) auto;
    gap: 1.25rem;
}

body[data-theme="vsrf"] .header-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: var(--vsrf-white);
    min-width: 0;
}

body[data-theme="vsrf"] .header-brand:hover {
    color: var(--vsrf-white);
}

body[data-theme="vsrf"] .header-brand-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--vsrf-gold-200);
    flex: 0 0 auto;
}

body[data-theme="vsrf"] .header-brand-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

body[data-theme="vsrf"] .main-nav {
    justify-self: center;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0;
}

body[data-theme="vsrf"] .nav-links {
    justify-content: center;
    gap: 0.55rem;
}

body[data-theme="vsrf"] .nav-links a {
    min-height: 40px;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
}

body[data-theme="vsrf"] .user-info {
    justify-self: end;
    min-width: 0;
}

body[data-theme="vsrf"] .user-greeting {
    justify-content: flex-end;
    gap: 0.5rem;
}

body[data-theme="vsrf"] .header-user-name {
    color: rgba(255, 255, 255, 0.94);
    font-size: 0.9rem;
    white-space: nowrap;
}

body[data-theme="vsrf"] .header-utility-btn {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--vsrf-white);
}

body[data-theme="vsrf"] .header-utility-btn:hover,
body[data-theme="vsrf"] .header-utility-btn:focus {
    background: rgba(255, 255, 255, 0.16);
    color: var(--vsrf-white);
}

body[data-theme="vsrf"] .header-logout-btn {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
}

body[data-theme="vsrf"] .mail-user-workspace-row {
    padding-top: 0;
    border-top: 0;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-status {
    width: 8.5%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-sync {
    width: 9.5%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-deletion {
    width: 9%;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-status .badge,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync .badge,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion .badge {
    padding: 0.28rem 0.52rem;
    font-size: 0.7rem;
    line-height: 1.1;
    border-radius: 999px;
    gap: 0.28rem;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync .badge i,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion .badge i {
    font-size: 0.68rem;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-status,
body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-sync,
body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-deletion {
    font-size: 0.84rem;
}

@media (max-width: 1400px) {
    body[data-theme="vsrf"] .header-top {
        grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    }

    body[data-theme="vsrf"] .user-info {
        grid-column: 1 / -1;
        justify-self: end;
    }
}

@media (max-width: 1200px) {
    body[data-theme="vsrf"] .header-top {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    body[data-theme="vsrf"] .main-nav,
    body[data-theme="vsrf"] .user-info {
        justify-self: stretch;
    }

    body[data-theme="vsrf"] .nav-links,
    body[data-theme="vsrf"] .user-greeting {
        justify-content: flex-start;
    }
}

/* Final workspace and shell overrides */
body[data-theme="vsrf"] header,
body[data-theme="vsrf"] footer {
    width: 100%;
    margin: 0;
    border: 0 !important;
    box-shadow: none !important;
}

body[data-theme="vsrf"] header {
    background: linear-gradient(180deg, #33557d 0%, #2c4f77 100%);
}

body[data-theme="vsrf"] footer {
    background: var(--vsrf-navy-900);
}

body[data-theme="vsrf"] .header-container,
body[data-theme="vsrf"] .footer-container {
    max-width: none;
    width: 100%;
    padding-left: 2rem;
    padding-right: 2rem;
}

body[data-theme="vsrf"] .header-top {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr) auto;
    min-height: 84px;
    gap: 1.5rem;
    align-items: center;
}

body[data-theme="vsrf"] .header-brand {
    align-self: center;
    min-width: 0;
}

body[data-theme="vsrf"] .header-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
}

body[data-theme="vsrf"] .main-nav {
    justify-self: center;
    align-self: center;
}

body[data-theme="vsrf"] .nav-links {
    align-items: center;
    gap: 0.35rem;
}

body[data-theme="vsrf"] .nav-links a {
    padding: 0.55rem 0.85rem;
    min-height: 38px;
    border-radius: 10px;
}

body[data-theme="vsrf"] .user-info {
    justify-self: end;
    align-self: center;
}

body[data-theme="vsrf"] .user-greeting {
    gap: 0.45rem;
    align-items: center;
    flex-wrap: nowrap;
}

body[data-theme="vsrf"] .theme-switcher {
    margin-right: 0.3rem;
}

body[data-theme="vsrf"] .header-user-name {
    font-size: 0.9rem;
}

body[data-theme="vsrf"] .header-utility-btn {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
    color: #f7fbff;
}

body[data-theme="vsrf"] .header-utility-btn:hover,
body[data-theme="vsrf"] .header-utility-btn:focus {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.45);
}

body[data-theme="vsrf"] .header-logout-btn {
    background: #c85848;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--vsrf-white);
}

body[data-theme="vsrf"] .header-logout-btn:hover,
body[data-theme="vsrf"] .header-logout-btn:focus {
    background: #b84a3b;
    color: var(--vsrf-white);
}

body[data-theme="vsrf"] .footer-container {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body[data-theme="vsrf"] .footer-container p {
    margin: 0;
}

body[data-theme="vsrf"] .mail-user-layout {
    gap: 0;
}

body[data-theme="vsrf"] .mail-user-workspace-panel {
    margin-bottom: 0 !important;
    border-radius: 24px 24px 0 0;
}

body[data-theme="vsrf"] .mail-user-workspace-panel .card-body {
    padding: 0.9rem 1rem 0.8rem;
    display: grid;
    gap: 0.8rem;
}

body[data-theme="vsrf"] .mail-user-workspace-row,
body[data-theme="vsrf"] .mail-user-compact-filters {
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none;
}

body[data-theme="vsrf"] .mail-user-workspace-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 1rem;
    align-items: end;
}

body[data-theme="vsrf"] .mail-user-topbar-switch {
    justify-self: end;
    width: min(360px, 100%);
}

body[data-theme="vsrf"] .mail-user-topbar-switch .form-label {
    text-align: left;
}

body[data-theme="vsrf"] .mail-user-compact-filters {
    display: grid;
    grid-template-columns: minmax(250px, 1.45fr) minmax(180px, 1.1fr) repeat(3, minmax(150px, 0.92fr)) auto;
    gap: 0.65rem;
    align-items: end;
}

body[data-theme="vsrf"] .mail-user-compact-filters > [class*="col-"] {
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

body[data-theme="vsrf"] .mail-user-compact-filters .form-label {
    margin-bottom: 0.22rem;
    font-size: 0.75rem;
}

body[data-theme="vsrf"] .mail-user-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
}

body[data-theme="vsrf"] .mail-user-filter-actions .btn {
    min-height: 40px;
    padding: 0.5rem 0.85rem;
}

body[data-theme="vsrf"] .mail-user-table-panel {
    margin-top: -1px;
    margin-bottom: 0 !important;
    border-radius: 0;
    overflow: visible;
}

body[data-theme="vsrf"] .mail-user-table-panel .card-header {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

body[data-theme="vsrf"] .mail-user-table-panel .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-status,
body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-sync,
body[data-theme="vsrf"] .mail-user-table-panel .users-table th.mail-user-col-deletion,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-status,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-status {
    width: 8%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-sync {
    width: 8.5%;
}

body[data-theme="vsrf"] .mail-user-table-panel .mail-user-col-deletion {
    width: 8%;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-status .badge,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync .badge,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    padding: 0.24rem 0.48rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
}

body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-sync .badge i,
body[data-theme="vsrf"] .mail-user-table-panel .users-table td.mail-user-col-deletion .badge i {
    display: none;
}

body[data-theme="vsrf"] .mail-user-actions {
    justify-content: center;
}

body[data-theme="vsrf"] .mail-user-actions .dropdown {
    position: relative;
}

body[data-theme="vsrf"] .mail-user-action-menu {
    position: absolute;
    z-index: 2200;
    min-width: 220px;
}

body[data-theme="vsrf"] .mail-user-summary-panel {
    margin-top: -1px;
    margin-bottom: 0 !important;
    border-radius: 0 0 24px 24px;
}

body[data-theme="vsrf"] .mail-user-summary-panel .card-body {
    padding: 0.8rem 1rem 1rem;
}

body[data-theme="vsrf"] .mail-user-summary-ribbon {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.55rem;
}

body[data-theme="vsrf"] .mail-user-summary-item {
    min-height: 68px;
    padding: 0.55rem 0.7rem;
}

body[data-theme="vsrf"] .mail-user-summary-label {
    font-size: 0.73rem;
    line-height: 1.25;
}

body[data-theme="vsrf"] .mail-user-summary-value {
    font-size: 1.28rem;
}

body[data-theme="vsrf"] .mail-user-summary-unbound-inline {
    justify-content: center;
}

body[data-theme="vsrf"] .mail-user-template-panel {
    margin-top: 0.9rem !important;
}

@media (max-width: 1600px) {
    body[data-theme="vsrf"] .mail-user-compact-filters {
        grid-template-columns: minmax(240px, 1.2fr) minmax(180px, 1fr) repeat(3, minmax(145px, 0.9fr)) auto;
    }
}

@media (max-width: 1400px) {
    body[data-theme="vsrf"] .header-top {
        grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    }

    body[data-theme="vsrf"] .user-info {
        grid-column: 1 / -1;
        justify-self: end;
    }

    body[data-theme="vsrf"] .mail-user-compact-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body[data-theme="vsrf"] .mail-user-filter-actions {
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .mail-user-summary-ribbon {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    body[data-theme="vsrf"] .header-top {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    body[data-theme="vsrf"] .main-nav,
    body[data-theme="vsrf"] .user-info {
        justify-self: stretch;
    }

    body[data-theme="vsrf"] .nav-links,
    body[data-theme="vsrf"] .user-greeting {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    body[data-theme="vsrf"] .mail-user-workspace-row,
    body[data-theme="vsrf"] .mail-user-compact-filters {
        grid-template-columns: 1fr;
    }

    body[data-theme="vsrf"] .mail-user-topbar-switch {
        justify-self: stretch;
        width: 100%;
    }

    body[data-theme="vsrf"] .mail-user-summary-ribbon {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Header and workspace corrections */
body[data-theme="vsrf"] .header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    min-height: 84px;
}

body[data-theme="vsrf"] .header-brand {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

body[data-theme="vsrf"] .main-nav {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

body[data-theme="vsrf"] .nav-links {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: auto;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

body[data-theme="vsrf"] .nav-links li {
    flex: 0 0 auto;
}

body[data-theme="vsrf"] .nav-links::-webkit-scrollbar {
    display: none;
}

body[data-theme="vsrf"] .nav-links a {
    white-space: nowrap;
}

body[data-theme="vsrf"] .user-info {
    flex: 0 0 auto;
}

body[data-theme="vsrf"] .mail-user-workspace-row {
    padding-bottom: 0.85rem !important;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--vsrf-line) !important;
}

body[data-theme="vsrf"] .mail-user-table-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
}

body[data-theme="vsrf"] .mail-user-table-toolbar-divider {
    width: 100%;
    height: 1px;
    margin-top: 0.7rem;
    background: var(--vsrf-line);
}

body[data-theme="vsrf"] .mail-user-table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.7rem;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .mail-user-table-action-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .mail-user-table-action-group-admin .btn {
    border-color: rgba(41, 84, 128, 0.3);
    background: rgba(41, 84, 128, 0.05);
}

body[data-theme="vsrf"] .mail-user-table-action-group-admin .btn:first-child {
    border-color: rgba(41, 84, 128, 0.22);
    background: rgba(41, 84, 128, 0.02);
}

body[data-theme="vsrf"] .mail-user-table-action-divider {
    width: 1px;
    height: 28px;
    background: var(--vsrf-line);
    display: inline-block;
}

body[data-theme="vsrf"] .mail-user-toolbar-status {
    margin-top: 0.7rem;
}

body[data-theme="vsrf"] .mail-user-toolbar-status:empty {
    display: none;
}

body[data-theme="vsrf"] .mail-user-summary-item {
    min-height: 72px;
}

body[data-theme="vsrf"] .mail-user-summary-value {
    font-size: clamp(1.05rem, 1vw, 1.28rem);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

body[data-theme="vsrf"] .mail-user-summary-label {
    min-height: 2.3em;
}

@media (max-width: 1280px) {
    body[data-theme="vsrf"] .header-top {
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    body[data-theme="vsrf"] .main-nav {
        order: 0;
        flex: 1 1 auto;
        justify-content: center;
    }

    body[data-theme="vsrf"] .nav-links {
        flex-wrap: nowrap;
        justify-content: center;
    }
}

@media (max-width: 1100px) {
    body[data-theme="vsrf"] .mail-user-table-toolbar {
        grid-template-columns: 1fr;
    }

    body[data-theme="vsrf"] .mail-user-table-actions {
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .mail-user-table-action-divider {
        display: none;
    }
}

/* Header final: brand/top controls on first row, nav on second row */
body[data-theme="vsrf"] .header-top {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    grid-template-areas:
        "brand user"
        "nav nav";
    align-items: center;
    row-gap: 0.75rem;
    column-gap: 1rem;
    min-height: auto;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

body[data-theme="vsrf"] .header-brand {
    grid-area: brand;
}

body[data-theme="vsrf"] .user-info {
    grid-area: user;
    justify-self: end;
}

body[data-theme="vsrf"] .main-nav {
    grid-area: nav;
    width: 100%;
    justify-self: stretch;
    justify-content: flex-start;
    overflow: visible;
}

body[data-theme="vsrf"] .nav-links {
    width: 100%;
    justify-content: flex-start;
    gap: 0.5rem;
    overflow: visible;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .user-greeting {
    justify-content: flex-end;
}

@media (max-width: 1200px) {
    body[data-theme="vsrf"] .header-top {
        grid-template-columns: 1fr;
        grid-template-areas:
            "brand"
            "user"
            "nav";
    }

    body[data-theme="vsrf"] .user-info,
    body[data-theme="vsrf"] .main-nav {
        justify-self: stretch;
    }

    body[data-theme="vsrf"] .user-greeting,
    body[data-theme="vsrf"] .nav-links {
        justify-content: flex-start;
    }
}

/* Final header layout after removing theme switcher */
body[data-theme="vsrf"] .header-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.7rem;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

body[data-theme="vsrf"] .header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 0;
    padding: 0;
}

body[data-theme="vsrf"] .header-brand {
    flex: 0 0 auto;
}

body[data-theme="vsrf"] .user-info {
    flex: 0 0 auto;
    justify-self: auto;
}

body[data-theme="vsrf"] .user-greeting {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .main-nav {
    display: block;
    width: 100%;
    justify-self: stretch;
}

body[data-theme="vsrf"] .nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    overflow: visible;
    margin: 0;
    padding: 0;
}

body[data-theme="vsrf"] .nav-links a {
    white-space: nowrap;
}

@media (max-width: 1100px) {
    body[data-theme="vsrf"] .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    body[data-theme="vsrf"] .user-info {
        width: 100%;
    }

    body[data-theme="vsrf"] .user-greeting {
        justify-content: flex-start;
    }
}

/* Final header alignment fix */
body[data-theme="vsrf"] header {
    padding-top: 0;
    padding-bottom: 0;
}

body[data-theme="vsrf"] .header-container {
    max-width: none;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding: 0.85rem 2rem 0.75rem;
}

body[data-theme="vsrf"] .header-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 0;
    margin: 0;
}

body[data-theme="vsrf"] .header-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

body[data-theme="vsrf"] .user-info {
    margin-left: auto;
}

body[data-theme="vsrf"] .user-greeting {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
}

body[data-theme="vsrf"] .main-nav {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    overflow: visible;
}

body[data-theme="vsrf"] .nav-links {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: visible;
}

body[data-theme="vsrf"] .nav-links li {
    flex: 0 0 auto;
}

@media (max-width: 1180px) {
    body[data-theme="vsrf"] .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    body[data-theme="vsrf"] .user-info {
        margin-left: 0;
        width: 100%;
    }

    body[data-theme="vsrf"] .user-greeting,
    body[data-theme="vsrf"] .main-nav,
    body[data-theme="vsrf"] .nav-links {
        justify-content: flex-start;
    }
}

/* Hard final override for production header alignment */
body[data-theme="vsrf"] header .header-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.9rem 2rem 0.75rem !important;
    gap: 0.7rem !important;
}

body[data-theme="vsrf"] header .header-top {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 1rem !important;
}

body[data-theme="vsrf"] header .header-brand {
    grid-column: 1 !important;
    align-self: center !important;
}

body[data-theme="vsrf"] header .user-info {
    grid-column: 3 !important;
    justify-self: end !important;
    margin: 0 !important;
    width: auto !important;
}

body[data-theme="vsrf"] header .user-greeting {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0.45rem !important;
    flex-wrap: wrap !important;
}

body[data-theme="vsrf"] header .main-nav {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

body[data-theme="vsrf"] header .nav-links {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    gap: 0.5rem !important;
    overflow: visible !important;
}

body[data-theme="vsrf"] header .nav-links li {
    flex: 0 0 auto !important;
}

@media (max-width: 1180px) {
    body[data-theme="vsrf"] header .header-top {
        grid-template-columns: 1fr !important;
        justify-items: start !important;
    }

    body[data-theme="vsrf"] header .header-brand,
    body[data-theme="vsrf"] header .user-info {
        grid-column: 1 !important;
        justify-self: start !important;
    }

    body[data-theme="vsrf"] header .user-greeting,
    body[data-theme="vsrf"] header .main-nav,
    body[data-theme="vsrf"] header .nav-links {
        justify-content: flex-start !important;
    }
}

@media (max-width: 520px) {
    body[data-theme="vsrf"] header .header-brand {
        max-width: calc(100vw - 64px);
    }

    body[data-theme="vsrf"] .header-brand-title {
        display: block;
        font-size: 1.22rem;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Departments concept fidelity pass. Keep this block last for the /departments surface. */
body[data-theme="vsrf"] .department-page {
    max-width: 1510px;
}

body[data-theme="vsrf"] .department-page-head {
    margin: 0 0 12px;
}

body[data-theme="vsrf"] .department-kicker,
body[data-theme="vsrf"] .department-subtitle,
body[data-theme="vsrf"] .department-panel-head,
body[data-theme="vsrf"] .department-dnd-hint {
    display: none !important;
}

body[data-theme="vsrf"] .department-title {
    font-size: 1.78rem;
    margin: 0;
}

body[data-theme="vsrf"] .department-tree-panel {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

body[data-theme="vsrf"] .department-tree-toolbar {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 8px;
    box-shadow: none;
    margin: 0 0 10px;
    padding: 12px;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
    align-items: flex-end;
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 0;
}

body[data-theme="vsrf"] .department-tree-filter-field {
    flex: 0 0 124px;
}

body[data-theme="vsrf"] .department-tree-filter-field--wide {
    flex: 0 1 170px;
    order: -10;
}

body[data-theme="vsrf"] .department-tree-filter-field--wide label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

body[data-theme="vsrf"] .department-tree-filter-field label {
    color: #50627a;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

body[data-theme="vsrf"] .department-tree-filter-field .form-control,
body[data-theme="vsrf"] .department-tree-filter-field .form-select {
    border-color: rgba(15, 44, 80, 0.14);
    border-radius: 7px;
    box-shadow: none;
    font-size: 0.82rem;
    height: 36px;
}

body[data-theme="vsrf"] .department-tree-filter-field--wide .form-control {
    padding-left: 12px;
}

body[data-theme="vsrf"] .department-tree-filter-check {
    align-items: center;
    background: transparent;
    border: 0;
    color: #40536d;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 7px;
    height: 36px;
    padding: 0;
    white-space: nowrap;
}

body[data-theme="vsrf"] .department-tree-filter-check input {
    height: 15px;
    width: 15px;
}

body[data-theme="vsrf"] .department-tree-filter-group {
    display: none;
}

body[data-theme="vsrf"] .department-tree-toolbar [data-department-filter-reset] {
    flex: 0 0 auto;
    height: 36px;
    margin-left: 2px;
    min-width: 78px;
}

body[data-theme="vsrf"] .department-tree-filter-reset-scope {
    align-items: center;
    display: inline-flex;
    gap: 6px;
    height: 36px;
    margin-left: auto;
    white-space: nowrap;
}

body[data-theme="vsrf"] .department-workspace {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 8px;
    box-shadow: none;
    display: grid;
    gap: 0;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 455px);
    margin-top: 0;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-workspace__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden !important;
}

body[data-theme="vsrf"] .department-workspace__main > .department-tree-scope-bar {
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    min-height: 44px;
    padding: 0 12px;
}

body[data-theme="vsrf"] .department-tree-scope-path {
    font-size: 0.86rem;
    gap: 7px;
}

body[data-theme="vsrf"] .department-tree-scope-label,
body[data-theme="vsrf"] .department-tree-scope-path a {
    font-weight: 900;
}

body[data-theme="vsrf"] .department-workspace__main > .department-tree-scope-bar .department-tree-scope-reset {
    display: none;
}

body[data-theme="vsrf"] .department-tree-table {
    border: 0;
    border-radius: 0;
    overflow: hidden !important;
}

body[data-theme="vsrf"] .department-tree-header,
body[data-theme="vsrf"] .department-tree-item {
    gap: 8px;
    grid-template-columns: minmax(220px, 1fr) 72px 52px 66px 66px minmax(88px, 0.45fr) 98px;
}

body[data-theme="vsrf"] .department-tree-header {
    background: #fbfdff;
    border-bottom: 1px solid rgba(15, 44, 80, 0.1);
    color: #607084;
    font-size: 0.74rem;
    font-weight: 900;
    gap: 12px;
    height: 46px;
    letter-spacing: 0;
    padding: 0 12px;
    text-transform: none;
}

body[data-theme="vsrf"] .department-tree {
    background: #ffffff;
    border-radius: 0;
    display: block;
    padding: 0;
}

body[data-theme="vsrf"] .department-tree-node,
body[data-theme="vsrf"] .department-tree-row {
    margin: 0;
}

body[data-theme="vsrf"] .department-tree-children {
    border-left: 0;
    display: block;
    margin: 0;
    padding: 0;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-cell--name {
    padding-left: 28px;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 56px;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 84px;
}

body[data-theme="vsrf"] .department-tree-item {
    align-items: center;
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid rgba(15, 44, 80, 0.08);
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
    gap: 12px;
    min-height: 52px;
    padding: 0 12px;
    width: 100%;
}

body[data-theme="vsrf"] .department-tree-item:hover {
    background: #f8fbff;
    border-left: 0;
}

body[data-theme="vsrf"] .department-tree-item--selected {
    background: #edf6ff;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

body[data-theme="vsrf"] .department-tree-cell--name {
    gap: 9px;
}

body[data-theme="vsrf"] .department-tree-toggle {
    align-items: center;
    background: transparent;
    color: #607084;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    height: 30px;
    justify-content: flex-start;
    width: auto;
}

body[data-theme="vsrf"] .department-tree-chevron {
    color: #607084;
    font-size: 0.72rem;
    width: 10px;
}

body[data-theme="vsrf"] .department-tree-node--collapsed > .department-tree-row > .department-tree-item .department-tree-chevron {
    transform: rotate(-90deg);
}

body[data-theme="vsrf"] .department-tree-node-icon {
    align-items: center;
    background: #eaf8f1;
    border-radius: 8px;
    color: #059669;
    display: inline-flex;
    height: 28px;
    justify-content: center;
    width: 28px;
}

body[data-theme="vsrf"] .department-tree-node[data-department-filter-type="root"] > .department-tree-row > .department-tree-item .department-tree-node-icon {
    background: #eef5ff;
    color: #1d4ed8;
}

body[data-theme="vsrf"] .department-tree-node[data-department-filter-type="group"] > .department-tree-row > .department-tree-item .department-tree-node-icon {
    background: #fff7df;
    color: #d97706;
}

body[data-theme="vsrf"] .department-tree-node[data-department-filter-type="regular"] > .department-tree-row > .department-tree-item .department-tree-node-icon {
    background: #eef2f7;
    color: #8aa2bd;
}

body[data-theme="vsrf"] .department-tree-title-block {
    display: block;
    min-width: 0;
}

body[data-theme="vsrf"] .department-tree-name {
    color: #10243f;
    display: block;
    font-size: 0.88rem;
    font-weight: 900;
    line-height: 1.22;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body[data-theme="vsrf"] .department-tree-cell--type .department-tree-type-label {
    background: transparent;
    border: 0;
    border-radius: 0;
    color: #52647d;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0;
}

body[data-theme="vsrf"] .department-tree-cell--metric {
    color: #52647d;
    font-size: 0.82rem;
    gap: 4px;
}

body[data-theme="vsrf"] .department-tree-cell--metric span {
    display: none;
}

body[data-theme="vsrf"] .department-tree-cell--metric strong {
    color: #19365a;
    font-weight: 800;
}

body[data-theme="vsrf"] .department-tree-cell--metric small {
    display: none;
}

body[data-theme="vsrf"] .department-tree-cell--status {
    gap: 6px;
}

body[data-theme="vsrf"] .department-tree-sync-text {
    align-items: center;
    color: #52647d;
    display: inline-flex;
    font-size: 0.82rem;
    gap: 7px;
    min-width: 0;
}

body[data-theme="vsrf"] .department-tree-sync-text .department-icon-badge {
    height: 8px;
    min-width: 8px;
    width: 8px;
}

body[data-theme="vsrf"] .department-tree-sync-text .department-icon-badge i {
    display: none;
}

body[data-theme="vsrf"] .department-tree-inline-actions--row {
    background: transparent;
    border: 0;
    display: flex;
    gap: 5px;
    justify-content: flex-end;
    padding: 0;
    position: static !important;
    transform: none !important;
}

body[data-theme="vsrf"] .department-tree-inline-actions--row .btn {
    background: #ffffff;
    border-color: rgba(15, 44, 80, 0.14);
    border-radius: 6px;
    color: #315a86;
    height: 26px;
    min-width: 26px;
}

body[data-theme="vsrf"] .department-inspector {
    align-self: stretch;
    background: #ffffff;
    border: 0;
    border-left: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: none;
    min-height: 100%;
    overflow: auto;
    padding: 0;
    position: sticky;
    top: var(--app-sticky-top, calc(var(--app-sticky-header-offset, 64px) + 8px));
}

body[data-theme="vsrf"] .department-inspector__head {
    align-items: flex-start;
    display: grid;
    gap: 12px;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    padding: 20px 18px 14px;
}

body[data-theme="vsrf"] .department-inspector__titlemark {
    align-items: center;
    background: #eaf8f1;
    border-radius: 8px;
    color: #059669;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    width: 30px;
}

body[data-theme="vsrf"] .department-inspector h2 {
    color: #10243f;
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1.18;
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector__head p {
    color: #607084;
    font-size: 0.82rem;
    margin: 4px 0 0;
}

body[data-theme="vsrf"] .department-inspector__close {
    color: #607084;
    font-size: 1rem;
}

body[data-theme="vsrf"] .department-inspector__metrics {
    border-bottom: 1px solid rgba(15, 44, 80, 0.09);
    display: grid;
    gap: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 0 18px 16px;
}

body[data-theme="vsrf"] .department-inspector__metrics div {
    background: transparent;
    border: 0;
    border-right: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 0;
    min-width: 0;
    padding: 0 10px;
}

body[data-theme="vsrf"] .department-inspector__metrics div:first-child {
    padding-left: 0;
}

body[data-theme="vsrf"] .department-inspector__metrics div:last-child {
    border-right: 0;
    padding-right: 0;
}

body[data-theme="vsrf"] .department-inspector__metrics span {
    color: #607084;
    font-size: 0.72rem;
    font-weight: 850;
}

body[data-theme="vsrf"] .department-inspector__metrics strong {
    color: #10243f;
    display: flex;
    font-size: 1rem;
    font-weight: 900;
    gap: 6px;
    line-height: 1.1;
    margin-top: 7px;
}

body[data-theme="vsrf"] .department-inspector__sync {
    align-items: center;
    color: #52647d !important;
    font-size: 0.78rem !important;
}

body[data-theme="vsrf"] .department-inspector__notice {
    align-items: center;
    border: 1px solid rgba(217, 119, 6, 0.24);
    border-radius: 8px;
    color: #7c4a03;
    display: flex;
    font-size: 0.82rem;
    font-weight: 850;
    gap: 8px;
    margin: 16px 18px 0;
    padding: 10px 12px;
}

body[data-theme="vsrf"] .department-inspector__tabs {
    border-bottom: 1px solid rgba(15, 44, 80, 0.1);
    display: flex;
    gap: 20px;
    margin: 18px 18px 0;
    overflow-x: auto;
}

body[data-theme="vsrf"] .department-inspector__tab {
    color: #52647d;
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 850;
    padding: 0 0 10px;
}

body[data-theme="vsrf"] .department-inspector__tab--active {
    border-bottom: 2px solid #2563eb;
    color: #1d4ed8;
}

body[data-theme="vsrf"] .department-inspector__facts {
    display: grid;
    gap: 12px;
    margin: 18px;
}

body[data-theme="vsrf"] .department-inspector__facts div {
    display: grid;
    gap: 12px;
    grid-template-columns: 112px minmax(0, 1fr);
}

body[data-theme="vsrf"] .department-inspector__facts dt {
    color: #607084;
    font-size: 0.82rem;
    font-weight: 900;
}

body[data-theme="vsrf"] .department-inspector__facts dd {
    color: #30445e;
    font-size: 0.82rem;
    margin: 0;
    overflow-wrap: anywhere;
}

body[data-theme="vsrf"] .department-inspector__link,
body[data-theme="vsrf"] .department-inspector__section {
    margin: 0 18px 14px;
}

body[data-theme="vsrf"] .department-inspector__actions {
    border-top: 1px solid rgba(15, 44, 80, 0.1);
    margin-top: auto;
    padding: 18px;
}

body[data-theme="vsrf"] .department-inspector__actions h3 {
    color: #10243f;
    font-size: 1rem;
    font-weight: 900;
    margin: 0 0 12px;
}

body[data-theme="vsrf"] .department-inspector__action-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-theme="vsrf"] .department-inspector__action-grid .btn,
body[data-theme="vsrf"] .department-inspector__action-grid form,
body[data-theme="vsrf"] .department-inspector__action-grid form .btn {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    justify-content: center;
    min-height: 38px;
    width: 100%;
}

body[data-theme="vsrf"] .department-inspector .department-tree-node-details {
    display: none;
}

@media (max-width: 1180px) {
    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
        flex-wrap: wrap;
    }

    body[data-theme="vsrf"] .department-tree-filter-reset-scope {
        margin-left: 0;
    }
}

@media (max-width: 900px) {
    body[data-theme="vsrf"] .department-workspace {
        display: flex;
        flex-direction: column;
    }

    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body[data-theme="vsrf"] .department-tree-filter-field,
    body[data-theme="vsrf"] .department-tree-filter-field--wide,
    body[data-theme="vsrf"] .department-tree-filter-check,
    body[data-theme="vsrf"] .department-tree-toolbar [data-department-filter-reset],
    body[data-theme="vsrf"] .department-tree-filter-reset-scope {
        flex: initial;
        margin: 0;
        min-width: 0;
        width: 100%;
    }

    body[data-theme="vsrf"] .department-tree-filter-field--wide {
        grid-column: 1 / -1;
    }

    body[data-theme="vsrf"] .department-tree-header {
        display: none;
    }

    body[data-theme="vsrf"] .department-tree-item {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto !important;
        min-height: 0;
        padding: 10px 12px;
        width: 100% !important;
    }

    body[data-theme="vsrf"] .department-tree-cell--name,
    body[data-theme="vsrf"] .department-tree-cell--status,
    body[data-theme="vsrf"] .department-tree-inline-actions--row {
        grid-column: 1 / -1;
    }

    body[data-theme="vsrf"] .department-tree-cell--type {
        display: none;
    }

    body[data-theme="vsrf"] .department-tree-cell--metric {
        background: transparent;
        padding: 0;
    }

    body[data-theme="vsrf"] .department-tree-cell--status {
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .department-tree-inline-actions--row {
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .department-inspector {
        border-left: 0;
        border-top: 1px solid rgba(15, 44, 80, 0.12);
        position: static;
    }
}

@media (max-width: 520px) {
    body[data-theme="vsrf"] .department-page {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
        grid-template-columns: 1fr;
    }

    body[data-theme="vsrf"] .department-inspector__metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 14px;
    }

    body[data-theme="vsrf"] .department-inspector__metrics div {
        border-right: 0;
        padding: 0;
    }

    body[data-theme="vsrf"] .department-inspector__facts div,
    body[data-theme="vsrf"] .department-inspector__action-grid {
        grid-template-columns: 1fr;
    }
}

/* Final content width expansion */
body[data-theme="vsrf"] main {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

body[data-theme="vsrf"] .mail-user-layout {
    width: min(100%, 1880px) !important;
    max-width: none !important;
    margin: 0 auto !important;
}

body[data-theme="vsrf"] .mail-user-workspace-panel,
body[data-theme="vsrf"] .mail-user-table-panel,
body[data-theme="vsrf"] .mail-user-summary-panel,
body[data-theme="vsrf"] .mail-user-template-panel {
    width: 100% !important;
}

/* Final modal scroll fix */
body[data-theme="vsrf"] .modal-dialog.modal-dialog-scrollable {
    height: calc(100% - 2rem) !important;
}

body[data-theme="vsrf"] .modal-work-dialog {
    max-width: min(1080px, 96vw) !important;
}

body[data-theme="vsrf"] .modal-work-dialog.import-preview-dialog {
    max-width: min(1440px, 98vw) !important;
}

body[data-theme="vsrf"] .modal-dialog.modal-dialog-scrollable .modal-content {
    max-height: 100% !important;
    overflow: hidden !important;
}

body[data-theme="vsrf"] .modal-dialog.modal-dialog-scrollable .modal-body,
body[data-theme="vsrf"] .modal-dialog.modal-dialog-scrollable .modal-work-body {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

body[data-theme="vsrf"] .modal-dialog.modal-dialog-scrollable .modal-work-body {
    max-height: calc(100vh - 180px) !important;
    padding: 0.85rem 1rem !important;
    background: #ffffff !important;
}

body[data-theme="vsrf"] .modal-work-footer {
    background: #ffffff !important;
}

body[data-theme="vsrf"] .modal-section {
    border-radius: 6px !important;
    padding: 0.75rem 0.85rem !important;
    background: #ffffff !important;
}

body[data-theme="vsrf"] .modal-section + .modal-section {
    margin-top: 0.7rem !important;
}

body[data-theme="vsrf"] .modal-section-head {
    margin-bottom: 0.55rem !important;
    align-items: center !important;
}

body[data-theme="vsrf"] .modal-section-title {
    font-size: 1rem !important;
}

body[data-theme="vsrf"] .modal-section-note {
    display: none !important;
}

body[data-theme="vsrf"] .modal-soft-panel {
    border-radius: 6px !important;
    padding: 0.7rem 0.8rem !important;
    background: #f7f9fc !important;
}

body[data-theme="vsrf"] .modal-sync-summary {
    padding-top: 0.6rem !important;
    padding-bottom: 0.6rem !important;
    font-size: 0.9rem;
}

body[data-theme="vsrf"] .modal-switch {
    padding-left: 2.3rem !important;
    margin-bottom: 0 !important;
}

body[data-theme="vsrf"] .modal-switch .form-check-label {
    font-size: 0.92rem;
}

body[data-theme="vsrf"] .modal-work-body .row.g-3 {
    --bs-gutter-y: 0.7rem;
    --bs-gutter-x: 0.85rem;
}

body[data-theme="vsrf"] .modal-work-body textarea.form-control {
    min-height: 92px;
}

body[data-theme="vsrf"] .modal-work-body .form-text {
    margin-top: 0.25rem;
    font-size: 0.78rem;
}

body[data-theme="vsrf"] .mail-user-modal-dialog {
    max-width: min(1180px, 98vw) !important;
}

body[data-theme="vsrf"] .mail-user-edit-modal .modal-work-body {
    max-height: calc(100vh - 150px) !important;
}

body[data-theme="vsrf"] .mail-user-edit-modal .modal-section {
    padding: 0.65rem 0.8rem !important;
}

body[data-theme="vsrf"] .mail-user-edit-modal .modal-section-title {
    font-size: 0.98rem !important;
}

body[data-theme="vsrf"] .mail-user-edit-modal .form-label {
    margin-bottom: 0.25rem;
    font-size: 0.86rem;
}

body[data-theme="vsrf"] .mail-user-edit-modal .form-control,
body[data-theme="vsrf"] .mail-user-edit-modal .form-select {
    min-height: 42px;
}

body[data-theme="vsrf"] .mail-user-inline-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 32px;
}

body[data-theme="vsrf"] .mail-user-inline-actions .form-text {
    margin: 0;
}

body[data-theme="vsrf"] .mail-user-scope-binding {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

body[data-theme="vsrf"] .mail-user-department-link {
    border-radius: 9px;
    font-weight: 700;
    white-space: normal;
    text-align: left;
}

body[data-theme="vsrf"] .association-picker {
    border-color: rgba(15, 44, 80, 0.1) !important;
    border-radius: 14px !important;
    overflow: hidden;
}

body[data-theme="vsrf"] .association-picker__head {
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
}

body[data-theme="vsrf"] .association-picker__description {
    color: #607084;
    font-size: 0.84rem;
    line-height: 1.35;
    margin-top: 0.25rem;
    max-width: 720px;
}

body[data-theme="vsrf"] .association-picker [data-role="association-search"] {
    border-color: rgba(15, 44, 80, 0.16);
    border-radius: 999px;
}

body[data-theme="vsrf"] .association-picker__item {
    align-items: flex-start;
    border-color: rgba(15, 44, 80, 0.1) !important;
    border-radius: 12px !important;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

body[data-theme="vsrf"] .association-picker__item:hover {
    background: #f8fbff !important;
    border-color: rgba(37, 99, 235, 0.34) !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

body[data-theme="vsrf"] .association-picker__item:has(input[type="checkbox"]:checked) {
    background: #ecfdf5 !important;
    border-color: rgba(5, 150, 105, 0.28) !important;
}

body[data-theme="vsrf"] .association-picker__body {
    max-height: min(52vh, 520px);
    overflow-y: auto;
}

body[data-theme="vsrf"] .admin-checkbox-panel {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 14px;
    display: grid;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
    padding: 10px;
}

body[data-theme="vsrf"] .admin-checkbox-panel__item {
    align-items: flex-start;
    background: #fff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 9px 10px;
}

body[data-theme="vsrf"] .admin-checkbox-panel__item:has(input[type="checkbox"]:checked) {
    background: #e8f3ff;
    border-color: rgba(15, 76, 129, 0.32);
}

body[data-theme="vsrf"] .admin-checkbox-panel__item small {
    color: #607084;
    display: block;
    font-size: 0.78rem;
    margin-top: 2px;
}

body[data-theme="vsrf"] .admin-user-org-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 360px;
}

body[data-theme="vsrf"] .admin-user-org-badge {
    background: #eef6ff;
    border: 1px solid rgba(37, 99, 235, 0.16);
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 800;
    max-width: 220px;
    overflow: hidden;
    padding: 0.25rem 0.55rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-page {
    max-width: 1480px;
}

.department-page-head {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.department-kicker {
    color: #607084;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.department-title {
    color: #10243f;
    font-size: 2rem;
    font-weight: 800;
    margin: 4px 0;
}

.department-subtitle {
    color: #607084;
    margin: 0;
}

.department-org-switch {
    min-width: 320px;
}

.department-tree-panel {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(16, 36, 63, 0.08);
}

.department-tree-panel {
    padding: 20px;
}

.department-panel-head {
    border-bottom: 1px solid rgba(15, 44, 80, 0.08);
    margin-bottom: 16px;
    padding-bottom: 14px;
}

.department-panel-head h2 {
    color: #10243f;
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 4px;
}

.department-panel-head p {
    color: #607084;
    margin: 0;
}

.department-tree,
.department-tree-children {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.department-tree-children {
    border-left: 2px solid rgba(37, 99, 235, 0.14);
    margin-left: 14px;
    padding-left: 16px;
}

.department-tree-node {
    margin: 10px 0;
}

.department-tree-item {
    align-items: flex-start;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-left-width: 4px;
    border-radius: 12px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 72px;
    min-width: 0;
    overflow: visible;
    padding: 14px 184px 46px 14px;
    position: relative;
    text-decoration: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.department-tree-node[data-department-filter-type="root"] > .department-tree-row > .department-tree-item {
    border-left-color: #2563eb;
}

.department-tree-node[data-department-filter-type="legal_entity"] > .department-tree-row > .department-tree-item {
    border-left-color: #059669;
}

.department-tree-node[data-department-filter-type="group"] > .department-tree-row > .department-tree-item {
    border-left-color: #f59e0b;
}

.department-tree-node[data-department-filter-type="regular"] > .department-tree-row > .department-tree-item {
    border-left-color: #8aa2bd;
}

.department-tree-item:hover {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.department-tree-item[draggable="true"] {
    cursor: grab;
}

.department-tree-node--dragging > .department-tree-row > .department-tree-item {
    opacity: 0.55;
}

.department-tree-item--drop-target {
    border-color: rgba(5, 150, 105, 0.8) !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18), 0 14px 32px rgba(5, 150, 105, 0.12) !important;
}

.department-tree-item--drop-invalid {
    border-color: rgba(220, 38, 38, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.department-tree-item--selected {
    background: linear-gradient(135deg, #e8f0ff 0%, #ffffff 100%);
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.14);
}

.department-tree-item--archived {
    background: #f3f5f7;
    opacity: 0.72;
}

.department-tree-item--pending-deletion {
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
    border-color: rgba(234, 88, 12, 0.38);
    border-left-color: #dc2626 !important;
    box-shadow: 0 10px 24px rgba(234, 88, 12, 0.08);
}

.department-tree-main {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    min-width: 0;
    width: 100%;
}

.department-tree-toggle {
    align-items: center;
    background: #e8f0ff;
    border-radius: 12px;
    color: #2454a6;
    cursor: pointer;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.department-tree-toggle[data-department-type="root"] {
    background: #e8f0ff;
    color: #1d4ed8;
}

.department-tree-toggle[data-department-type="legal_entity"] {
    background: #ecfdf5;
    color: #047857;
}

.department-tree-toggle[data-department-type="group"] {
    background: #fef3c7;
    color: #92400e;
}

.department-tree-toggle[data-department-type="regular"] {
    background: #eef3f8;
    color: #355f8c;
}

.department-tree-toggle--empty {
    cursor: default;
    opacity: 0.55;
}

.department-tree-node--collapsed > .department-tree-children {
    display: none;
}

.department-tree-node--collapsed > .department-tree-row > .department-tree-item .department-tree-toggle {
    background: #eef3f8;
    color: #607084;
}

.department-tree-name {
    color: #10243f;
    font-weight: 800;
}

.department-tree-meta {
    color: #6b7a90;
    font-size: 0.84rem;
}

.department-tree-inline-metrics {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.department-tree-inline-metrics span {
    align-items: center;
    background: rgba(248, 251, 255, 0.95);
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 999px;
    color: #46566d;
    display: inline-flex;
    font-size: 0.74rem;
    font-weight: 800;
    gap: 5px;
    line-height: 1.1;
    padding: 0.22rem 0.48rem;
}

.department-tree-preview {
    align-items: stretch;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 7px;
    max-width: min(760px, 100%);
}

.department-tree-preview__item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: #52647c;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 700;
    gap: 5px;
    line-height: 1.2;
    max-width: 620px;
    overflow: hidden;
    padding: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-tree-preview__item i,
.department-tree-inline-metrics i {
    color: #2454a6;
}

.department-tree-preview__item .fa-user-shield {
    color: #7c3aed;
}

.department-tree-legal-link {
    align-items: center;
    background: #eef6ff;
    border: 1px solid rgba(37, 99, 235, 0.16);
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 800;
    gap: 6px;
    margin-top: 6px;
    max-width: 100%;
    padding: 0.24rem 0.55rem;
    text-decoration: none;
}

.department-tree-legal-link:hover {
    background: #dbeafe;
    color: #1e40af;
}

.department-tree-badges {
    cursor: pointer;
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    justify-content: flex-end;
    max-width: 172px;
    min-width: 0;
    position: absolute;
    right: 12px;
    top: 12px;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.department-tree-badges > span:not(.department-icon-badge) {
    display: inline-flex;
}

.department-icon-badge {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.72rem;
    height: 24px;
    justify-content: center;
    width: 24px;
}

.department-icon-badge i {
    line-height: 1;
}

.department-icon-badge--success,
.department-icon-badge--active {
    background: #059669;
}

.department-icon-badge--active {
    background: #d1fae5;
    color: #047857;
}

.department-icon-badge--warning {
    background: #f59e0b;
    color: #1f2937;
}

.department-icon-badge--danger {
    background: #dc2626;
}

.department-icon-badge--deletion-requested {
    background: #fee2e2;
    border-color: rgba(220, 38, 38, 0.24);
    color: #b91c1c;
}

.department-icon-badge--muted {
    background: #64748b;
}

.department-icon-badge--info {
    background: #0ea5e9;
}

.department-icon-badge--root {
    background: #2563eb;
}

.department-icon-badge--legal {
    background: #ecfdf5;
    border-color: rgba(4, 120, 87, 0.22);
    color: #047857;
}

.department-icon-badge--group {
    background: #fef3c7;
    border-color: rgba(146, 64, 14, 0.2);
    color: #92400e;
}

.department-icon-badge--regular {
    background: #eef3f8;
    border-color: rgba(53, 95, 140, 0.16);
    color: #355f8c;
}

.department-detail-list {
    color: #334155;
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
}

.department-details-meta,
.department-linked-note,
.department-empty-note {
    color: #68788e;
    font-size: 0.9rem;
}

.department-create-form {
    display: grid;
    gap: 0.75rem;
}

.department-create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 0.75rem;
}

.department-create-note {
    color: #68788e;
    font-size: 0.85rem;
}

.department-detail-section {
    border-top: 1px solid rgba(15, 44, 80, 0.08);
    margin-top: 16px;
    padding-top: 16px;
}

.department-detail-section-title {
    color: #10243f;
    font-weight: 800;
    margin-bottom: 10px;
}

.department-detail-metrics {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.department-detail-metrics div {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 12px;
    padding: 10px;
}

.department-detail-metrics dt {
    color: #607084;
    font-size: 0.78rem;
    font-weight: 700;
}

.department-detail-metrics dd {
    color: #10243f;
    font-size: 1.3rem;
    font-weight: 900;
    margin: 2px 0 0;
}

.department-linked-card,
.department-template-policy {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 12px;
    padding: 12px;
}

.department-linked-title {
    color: #10243f;
    font-weight: 800;
}

.department-operator-list {
    color: #334155;
    margin: 8px 0 0;
    padding-left: 20px;
}

.department-template-policy {
    color: #10243f;
    font-weight: 800;
}

.department-template-policy--override {
    background: #ecfdf5;
    border-color: rgba(5, 150, 105, 0.22);
}

.department-template-policy--disabled {
    background: #fff7ed;
    border-color: rgba(234, 88, 12, 0.24);
}

.department-template-policy span {
    color: #68788e;
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 3px;
}

.department-template-policy .department-template-policy__label {
    color: #10243f;
    font-weight: 800;
    margin-top: 0;
}

.department-template-list-head {
    color: #607084;
    font-size: 0.84rem;
    font-weight: 700;
    margin: 12px 0 8px;
}

.department-policy-form {
    margin-top: 14px;
}

.department-policy-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.department-policy-override .form-label {
    color: #607084;
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.department-policy-override-row {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.department-template-list {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.department-template-item {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 12px;
    padding: 10px 12px;
}

.department-template-item--selected {
    border-color: rgba(5, 150, 105, 0.35);
    box-shadow: inset 0 0 0 1px rgba(5, 150, 105, 0.12);
}

.department-template-item--inactive {
    opacity: 0.72;
}

.department-template-pattern {
    color: #10243f;
    font-weight: 800;
}

.department-template-meta {
    color: #68788e;
    font-size: 0.84rem;
    margin-top: 2px;
}

.department-sync-card,
.department-review-card,
.department-deletion-request-card {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 12px;
    padding: 12px;
}

.department-sync-card {
    display: grid;
    gap: 10px;
}

.department-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.department-sync-meta {
    color: #68788e;
    display: grid;
    gap: 4px;
    font-size: 0.84rem;
}

.department-review-card {
    margin-top: 12px;
}

.department-deletion-request-card {
    background: #fff7ed;
    border-color: rgba(234, 88, 12, 0.22);
    margin-top: 12px;
}

.department-review-title {
    color: #10243f;
    font-weight: 800;
}

.department-deletion-request-title {
    color: #9a3412;
    font-weight: 900;
}

.department-review-meta {
    color: #68788e;
    font-size: 0.84rem;
    margin-top: 4px;
}

.department-deletion-request-meta,
.department-deletion-request-text {
    color: #7c2d12;
    font-size: 0.84rem;
    margin-top: 4px;
}

.department-deletion-request-text {
    font-weight: 700;
}

.department-review-diff-list {
    color: #334155;
    margin: 10px 0 0;
    padding-left: 20px;
}

.department-review-diff-list li + li {
    margin-top: 4px;
}

.department-review-old {
    color: #6b7280;
}

.department-review-new {
    color: #0f766e;
    font-weight: 700;
}

.department-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.department-tree-panel--single {
    padding: 20px;
}

.department-panel-head--compact {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.department-panel-head--compact > div:first-child {
    min-width: 280px;
}

.department-tree-page-stats {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    max-width: 720px;
}

.department-tree-page-stats span {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 999px;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.35rem 0.7rem;
}

.department-tree-page-stats form {
    display: inline-flex;
}

.department-tree-page-stats .btn {
    border-radius: 999px;
    font-weight: 800;
    white-space: nowrap;
}

.department-dnd-hint {
    align-items: center;
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 999px;
    color: #607084;
    display: inline-flex;
    gap: 8px;
    font-size: 0.84rem;
    font-weight: 700;
    margin-top: 10px;
    padding: 0.42rem 0.75rem;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.department-dnd-hint--scoped {
    background: #fff7ed;
    border-color: rgba(234, 88, 12, 0.22);
    color: #9a3412;
    flex-wrap: wrap;
}

.department-dnd-hint a {
    color: inherit;
    font-weight: 900;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.department-dnd-hint--active {
    background: #ecfdf5;
    border-color: rgba(5, 150, 105, 0.26);
    color: #047857;
}

.department-dnd-hint--invalid {
    background: #fff7ed;
    border-color: rgba(234, 88, 12, 0.28);
    color: #c2410c;
}

.department-tree-filter-bar {
    align-items: end;
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 14px;
    padding: 12px;
}

.department-tree-filter-field {
    display: grid;
    gap: 4px;
    min-width: 170px;
}

.department-tree-filter-field--wide {
    min-width: min(340px, 100%);
}

.department-tree-filter-field label,
.department-tree-filter-check {
    color: #607084;
    font-size: 0.78rem;
    font-weight: 800;
}

.department-tree-filter-check {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 999px;
    display: inline-flex;
    gap: 7px;
    min-height: 32px;
    padding: 0.35rem 0.7rem;
}

.department-tree-filter-group {
    position: relative;
}

.department-tree-filter-group summary {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 999px;
    color: #17324d;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    gap: 7px;
    list-style: none;
    min-height: 32px;
    padding: 0.35rem 0.8rem;
}

.department-tree-filter-group summary::-webkit-details-marker {
    display: none;
}

.department-tree-filter-group[open] summary {
    border-color: rgba(37, 99, 235, 0.32);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}

.department-tree-filter-group__body {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(16, 36, 63, 0.14);
    display: grid;
    gap: 5px;
    left: 0;
    margin-top: 8px;
    max-height: 280px;
    min-width: 260px;
    overflow: auto;
    padding: 10px;
    position: absolute;
    top: 100%;
    z-index: 20;
}

.department-tree-filter-option {
    align-items: center;
    border-radius: 9px;
    color: #17324d;
    display: flex;
    font-size: 0.86rem;
    gap: 8px;
    padding: 6px 8px;
}

.department-tree-filter-option:hover {
    background: #f3f7fb;
}

.department-tree-node-details {
    background: #ffffff;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(16, 36, 63, 0.06);
    margin: 8px 0 12px 42px;
    padding: 12px;
}

.department-tree-node-details--attention {
    background: #fffdf5;
    border-color: rgba(245, 158, 11, 0.25);
}

.department-tree-node-details__title {
    align-items: center;
    color: #92400e;
    display: flex;
    font-size: 0.82rem;
    font-weight: 900;
    gap: 7px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.department-tree-row {
    padding-bottom: 0;
    position: relative;
    transition: padding-bottom 0.16s ease;
}

.department-tree-row:hover .department-tree-badges {
    transform: none;
}

.department-tree-title-block {
    min-width: 0;
    width: 100%;
}

.department-tree-link-note {
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 1px;
}

.department-tree-add-child {
    align-items: center;
    background: #ffffff;
    border: 1px dashed rgba(37, 99, 235, 0.35);
    border-radius: 10px;
    color: #2454a6;
    display: flex;
    gap: 8px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 12px;
    pointer-events: none;
    position: absolute;
    bottom: 2px;
    left: 42px;
    right: 0;
    transform: translateY(-4px);
    transition: max-height 0.16s ease, opacity 0.16s ease, padding 0.16s ease, transform 0.16s ease;
    z-index: 4;
}

.department-tree-row:hover .department-tree-add-child,
.department-tree-add-child:focus {
    max-height: 42px;
    opacity: 1;
    padding: 8px 12px;
    pointer-events: auto;
    transform: translateY(0);
}

.department-tree-row:has(.department-tree-add-child):hover,
.department-tree-row:has(.department-tree-add-child:focus) {
    padding-bottom: 42px;
}

.department-tree-add-child:hover {
    background: #f8fbff;
    border-color: rgba(37, 99, 235, 0.58);
}

.department-tree-inline-actions {
    align-items: center;
    background: rgba(248, 251, 255, 0.94);
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 999px;
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    justify-content: flex-end;
    opacity: 0;
    padding: 5px;
    pointer-events: none;
    position: absolute;
    right: 12px;
    bottom: 9px;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    z-index: 3;
}

.department-tree-row:hover .department-tree-inline-actions,
.department-tree-inline-actions:focus-within {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.department-tree-inline-actions .btn {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-weight: 800;
    gap: 0;
    justify-content: center;
    height: 30px;
    min-height: 30px;
    min-width: 30px;
    padding: 0;
    white-space: nowrap;
    width: 30px;
}

.department-tree-inline-actions .department-tree-action--focus {
    background: linear-gradient(135deg, #1f5f9f 0%, #2f7abf 100%);
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(31, 95, 159, 0.22);
    color: #ffffff;
}

.department-tree-inline-actions .department-tree-action--focus:hover,
.department-tree-inline-actions .department-tree-action--focus:focus {
    background: linear-gradient(135deg, #194f86 0%, #2569a8 100%);
    color: #ffffff;
}

.department-tree-inline-actions form {
    display: inline-flex;
}

.department-inline-feedback {
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 800;
    margin: 8px 0 0 42px;
    padding: 8px 10px;
}

.department-inline-feedback--success {
    background: #ecfdf5;
    color: #047857;
}

.department-inline-feedback--warning {
    background: #fffbeb;
    color: #92400e;
}

.department-inline-feedback--error {
    background: #fef2f2;
    color: #b91c1c;
}

.department-selected-warnings {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.department-selected-warning {
    align-items: flex-start;
    background: #fff7ed;
    border: 1px solid rgba(234, 88, 12, 0.24);
    border-radius: 10px;
    color: #9a3412;
    display: inline-flex;
    gap: 8px;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.35;
    padding: 0.45rem 0.65rem;
}

.department-selected-warning--danger {
    background: #fef2f2;
    border-color: rgba(220, 38, 38, 0.24);
    color: #991b1b;
}

.department-linked-label {
    color: #607084;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.department-tree-scope-bar {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 14px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin: 12px 0;
    padding: 10px 12px;
}

.department-tree-scope-path {
    align-items: center;
    color: #607084;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.department-tree-scope-label {
    color: #0f2c50;
    font-weight: 800;
}

.department-tree-scope-path a {
    color: #1f5f9f;
    font-weight: 800;
    text-decoration: none;
}

.department-tree-scope-path a:hover {
    text-decoration: underline;
}

.department-tree-scope-current {
    color: #0f2c50;
    font-weight: 900;
}

.department-tree-scope-separator {
    color: #9aa8b8;
}

.department-workspace {
    align-items: flex-start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
}

.department-workspace__main {
    min-width: 0;
    overflow: hidden;
}

.department-tree-toolbar {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 26px rgba(16, 36, 63, 0.08);
    margin: 12px 0;
    padding: 10px;
}

.department-tree-toolbar .department-tree-filter-bar {
    align-items: end;
    background: transparent;
    border: 0;
    border-radius: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: 170px minmax(220px, 1fr) 170px 170px;
    margin: 0;
    padding: 0 0 36px;
}

.department-tree-toolbar .department-tree-filter-check,
.department-tree-toolbar .department-tree-filter-group,
.department-tree-toolbar [data-department-filter-reset] {
    align-self: end;
}

.department-tree-toolbar .department-tree-scope-bar {
    background: #f8fbff;
    border-radius: 10px;
    margin: 14px 0 0;
    padding: 8px 10px;
    position: relative;
    z-index: 1;
}

.department-tree-table {
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: visible;
}

.department-tree-header {
    align-items: center;
    background: #f8fbff;
    border-bottom: 1px solid rgba(15, 44, 80, 0.08);
    color: #607084;
    display: grid;
    font-size: 0.72rem;
    font-weight: 900;
    gap: 8px;
    grid-template-columns: minmax(220px, 1fr) 64px 72px 54px 54px 92px 170px;
    letter-spacing: 0.02em;
    min-height: 34px;
    padding: 0 10px;
    text-transform: uppercase;
}

.department-tree {
    background: #ffffff;
    border-radius: 0 0 12px 12px;
    display: grid;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.department-tree-children {
    border-left: 1px solid rgba(37, 99, 235, 0.18);
    display: grid;
    gap: 0;
    list-style: none;
    margin: 0 0 0 18px;
    padding: 0 0 0 14px;
}

.department-tree-node {
    margin: 0;
}

.department-tree-row {
    position: relative;
}

.department-tree-item {
    align-items: center;
    background: #ffffff;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
    box-shadow: none;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(220px, 1fr) 64px 72px 54px 54px 92px 170px;
    min-height: 42px;
    padding: 4px 10px;
    position: relative;
    transition: background-color 0.14s ease, border-color 0.14s ease;
}

.department-tree-item:hover {
    background: #f8fbff;
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: none;
    transform: none;
}

.department-tree-item--selected {
    background: #edf4ff;
    border-color: #2563eb;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.department-tree-item--archived {
    background: #f6f7f9;
    opacity: 0.7;
}

.department-tree-item--pending-deletion {
    background: #fff7ed;
    border-left-color: #dc2626 !important;
    box-shadow: none;
}

.department-tree-cell {
    align-items: center;
    display: flex;
    min-width: 0;
}

.department-tree-cell--name {
    gap: 8px;
}

.department-tree-title-block {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.department-tree-name {
    color: #10243f;
    display: block;
    font-size: 0.9rem;
    font-weight: 850;
    overflow: hidden;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-tree-name:hover {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.department-tree-toggle {
    border: 0;
    border-radius: 7px;
    flex: 0 0 28px;
    height: 28px;
    width: 28px;
}

.department-tree-toggle--empty {
    pointer-events: none;
}

.department-tree-type-label {
    background: #f3f7fb;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 999px;
    color: #334155;
    font-size: 0.74rem;
    font-weight: 800;
    max-width: 100%;
    overflow: hidden;
    padding: 0.18rem 0.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-tree-cell--metric {
    color: #46566d;
    font-size: 0.78rem;
    gap: 5px;
}

.department-tree-cell--metric span,
.department-tree-cell--metric i {
    color: #607084;
}

.department-tree-cell--metric strong {
    color: #10243f;
    font-weight: 850;
}

.department-tree-cell--metric small {
    color: #8a97a8;
    font-size: 0.68rem;
}

.department-tree-cell--status {
    gap: 5px;
}

.department-tree-badges {
    display: contents;
}

.department-tree-inline-actions {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    justify-content: flex-end;
    opacity: 1;
    pointer-events: auto;
    position: static;
    transform: none;
}

.department-tree-inline-actions .btn {
    align-items: center;
    border-radius: 7px;
    display: inline-flex;
    height: 26px;
    justify-content: center;
    min-width: 26px;
    padding: 0;
}

.department-tree-add-child,
.department-tree-preview,
.department-tree-inline-metrics {
    display: none;
}

.department-tree-legal-link {
    align-items: center;
    color: #2563eb;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-inspector {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 12px;
    box-shadow: 0 12px 26px rgba(16, 36, 63, 0.08);
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 132px);
    overflow: auto;
    padding: 14px;
    position: sticky;
    top: var(--app-sticky-top, calc(var(--app-sticky-header-offset, 64px) + 8px));
}

.department-inspector__head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.department-inspector__label {
    color: #607084;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.department-inspector h2 {
    color: #10243f;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.25;
    margin: 3px 0 0;
}

.department-inspector__status,
.department-inspector__actions .department-tree-inline-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.department-inspector__metrics {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.department-inspector__metrics div {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 8px;
    display: grid;
    gap: 2px;
    padding: 8px;
}

.department-inspector__metrics span,
.department-inspector__mini-list span {
    color: #607084;
    font-size: 0.72rem;
    font-weight: 850;
}

.department-inspector__metrics strong {
    color: #10243f;
    font-size: 1.1rem;
    line-height: 1;
}

.department-inspector__actions {
    border-top: 1px solid rgba(15, 44, 80, 0.08);
    padding-top: 10px;
}

.department-inspector__section {
    display: grid;
    gap: 8px;
}

.department-inspector__mini-list {
    border-top: 1px solid rgba(15, 44, 80, 0.08);
    display: grid;
    gap: 4px;
    padding-top: 8px;
}

.department-inspector__mini-list p {
    color: #10243f;
    font-size: 0.82rem;
    margin: 0;
}

.department-inspector__link {
    align-items: center;
    background: #f8fbff;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 8px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 850;
    gap: 7px;
    padding: 8px;
    text-decoration: none;
}

.department-inspector__empty {
    align-items: center;
    color: #607084;
    display: grid;
    gap: 8px;
    justify-items: center;
    min-height: 220px;
    text-align: center;
}

.department-inspector__empty i {
    color: #8aa2bd;
    font-size: 1.8rem;
}

.department-inspector__empty strong {
    color: #10243f;
}

.department-inspector .department-tree-node-details {
    border-radius: 10px;
    box-shadow: none;
    margin: 0;
}

body[data-theme="vsrf"] .department-workspace {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 12px;
    box-shadow: 0 18px 38px rgba(16, 36, 63, 0.08);
    gap: 0;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    overflow: hidden;
}

body[data-theme="vsrf"] .department-workspace__main {
    overflow: visible;
}

body[data-theme="vsrf"] .department-tree-toolbar {
    border: 0;
    border-bottom: 1px solid rgba(15, 44, 80, 0.09);
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 10px 12px;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
}

body[data-theme="vsrf"] .department-tree-filter-field {
    flex: 0 1 132px;
}

body[data-theme="vsrf"] .department-tree-filter-field--wide {
    flex: 1 1 220px;
}

body[data-theme="vsrf"] .department-tree-filter-field label {
    color: #607084;
    font-size: 0.72rem;
    font-weight: 850;
    margin-bottom: 4px;
}

body[data-theme="vsrf"] .department-tree-filter-field .form-control,
body[data-theme="vsrf"] .department-tree-filter-field .form-select,
body[data-theme="vsrf"] .department-tree-filter-check,
body[data-theme="vsrf"] .department-tree-filter-group summary,
body[data-theme="vsrf"] .department-tree-toolbar [data-department-filter-reset] {
    min-height: 36px;
}

body[data-theme="vsrf"] .department-tree-filter-check {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #46566d;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 7px;
    padding: 0 2px;
}

body[data-theme="vsrf"] .department-tree-filter-group {
    flex: 0 0 auto;
}

body[data-theme="vsrf"] .department-tree-filter-group summary {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.13);
    border-radius: 8px;
    padding: 0.42rem 0.68rem;
}

body[data-theme="vsrf"] .department-tree-toolbar [data-department-filter-reset] {
    margin-left: auto;
    min-width: 92px;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-scope-bar {
    align-items: center;
    background: #f8fbff;
    border: 0;
    border-top: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 0;
    display: flex;
    justify-content: space-between;
    margin: 10px -12px -10px;
    min-height: 44px;
    padding: 8px 12px;
}

body[data-theme="vsrf"] .department-tree-table {
    border: 0;
    border-radius: 0;
    overflow: visible;
}

body[data-theme="vsrf"] .department-tree-header,
body[data-theme="vsrf"] .department-tree-item {
    grid-template-columns: minmax(320px, 1.7fr) 96px 72px 82px 82px 128px 112px;
}

body[data-theme="vsrf"] .department-tree-header {
    min-height: 40px;
    padding: 0 12px;
}

body[data-theme="vsrf"] .department-tree {
    border-radius: 0;
    padding: 0;
}

body[data-theme="vsrf"] .department-tree-children {
    margin-left: 26px;
    padding-left: 16px;
}

body[data-theme="vsrf"] .department-tree-item {
    border-bottom: 1px solid rgba(15, 44, 80, 0.06);
    min-height: 50px;
    padding: 7px 12px;
}

body[data-theme="vsrf"] .department-tree-name {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    font-size: 0.9rem;
    line-height: 1.22;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

body[data-theme="vsrf"] .department-tree-cell--name .department-tree-legal-link {
    display: none;
}

body[data-theme="vsrf"] .department-tree-inline-actions--row {
    gap: 5px;
}

body[data-theme="vsrf"] .department-tree-inline-actions--row .btn {
    height: 30px;
    min-width: 30px;
}

body[data-theme="vsrf"] .department-inspector {
    align-self: stretch;
    border: 0;
    border-left: 1px solid rgba(15, 44, 80, 0.1);
    border-radius: 0;
    box-shadow: none;
    max-height: none;
    min-height: 100%;
    padding: 18px 16px;
    position: sticky;
}

body[data-theme="vsrf"] .department-inspector__empty {
    min-height: 360px;
}

.department-linked-card--inline {
    align-items: center;
    display: flex;
    margin: 12px 0;
}

.department-tree-link-note--selected {
    margin-top: 4px;
}

.organization-selector {
    --organization-selector-rail: 46px;
    position: static;
    z-index: 2980;
}

body[data-theme="vsrf"] {
    --organization-selector-top: 116px;
    --organization-selector-bottom: 58px;
    --organization-selector-rail: 46px;
    --quick-actions-top: 116px;
    --user-actions-top: 164px;
}

body[data-theme="vsrf"].has-organization-selector main {
    padding-left: calc(var(--organization-selector-rail, 46px) + 20px) !important;
}

.quick-actions {
    align-items: center;
    display: flex;
    justify-content: center;
    left: 0;
    position: fixed;
    top: var(--quick-actions-top);
    width: var(--organization-selector-rail, 46px);
    z-index: 1044;
}

.user-actions {
    align-items: center;
    display: flex;
    justify-content: center;
    left: 0;
    position: fixed;
    top: var(--user-actions-top);
    width: var(--organization-selector-rail, 46px);
    z-index: 1044;
}

.quick-actions--open,
.user-actions--open {
    z-index: 1043;
}

.quick-actions__toggle {
    align-items: center;
    background: #184f7f;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 44, 80, 0.18);
    color: #fff;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    margin-top: 6px;
    width: 38px;
}

.user-actions__toggle {
    background: #0b6b8f;
}

.quick-actions__toggle:hover,
.quick-actions__toggle:focus {
    background: #0f3d66;
    color: #fff;
    outline: none;
}

.user-actions__toggle:hover,
.user-actions__toggle:focus {
    background: #095978;
}

.quick-actions__panel {
    background: #fff;
    border: 1px solid rgba(15, 44, 80, 0.14);
    border-radius: 8px;
    box-shadow: 18px 20px 46px rgba(15, 44, 80, 0.18);
    display: none;
    gap: 4px;
    left: calc(var(--organization-selector-rail, 46px) + 10px);
    padding: 10px;
    position: absolute;
    top: 6px;
    width: min(340px, calc(100vw - var(--organization-selector-rail, 46px) - 24px));
}

.quick-actions--open .quick-actions__panel {
    display: grid;
}

.user-actions--open .user-actions__panel {
    display: grid;
}

.quick-actions__title {
    color: #10243f;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0;
    padding: 2px 8px 6px;
    text-transform: uppercase;
}

.quick-actions__form {
    margin: 0;
}

.quick-actions__item {
    align-items: flex-start;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #10243f;
    display: flex;
    gap: 10px;
    padding: 9px 8px;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

.quick-actions__item:hover,
.quick-actions__item:focus {
    background: #f2f7fc;
    color: #0f4c81;
    outline: none;
}

.quick-actions__icon {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    flex: 0 0 30px;
    height: 30px;
    justify-content: center;
    width: 30px;
}

.quick-actions__icon--sync {
    background: #e8f6ef;
    color: #0b7b4b;
}

.quick-actions__icon--app-user {
    background: #edf1ff;
    color: #2f55b8;
}

.quick-actions__icon--mail-user {
    background: #e9f7fb;
    color: #067082;
}

.quick-actions__icon--batch {
    background: #fff4df;
    color: #986008;
}

.quick-actions__icon--legal {
    background: #f1ecff;
    color: #6740a8;
}

.quick-actions__icon--mailbox {
    background: #e7f6ff;
    color: #0b6b8f;
}

.quick-actions__item-title,
.quick-actions__item-note {
    display: block;
}

.quick-actions__item-title {
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1.2;
}

.quick-actions__item-note {
    color: #68788e;
    font-size: 0.76rem;
    line-height: 1.25;
    margin-top: 2px;
}

.organization-selector__toggle {
    align-items: center;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5fc 100%);
    border: 0;
    border-right: 1px solid rgba(15, 44, 80, 0.14);
    bottom: var(--organization-selector-bottom);
    box-shadow: 10px 0 28px rgba(15, 44, 80, 0.08);
    color: #0f2c50;
    display: flex;
    flex-direction: column;
    font-weight: 800;
    gap: 16px;
    justify-content: flex-start;
    left: 0;
    padding: 16px 0 18px;
    position: fixed;
    top: var(--organization-selector-top);
    width: var(--organization-selector-rail);
    z-index: 2980;
}

.organization-selector__toggle:hover,
.organization-selector__toggle:focus {
    background: linear-gradient(180deg, #ffffff 0%, #e8f3ff 100%);
    color: #0f4c81;
    outline: none;
}

.organization-selector__toggle-icon {
    align-items: center;
    background: #0f4c81;
    border-radius: 12px;
    color: #fff;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    width: 30px;
}

.organization-selector__toggle-text {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    justify-content: center;
    left: 50%;
    max-width: calc(100vh - var(--organization-selector-top, 116px) - var(--organization-selector-bottom, 58px) - 96px);
    min-height: 0;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: rotate(-90deg);
    transform-origin: center;
    translate: -50% -50%;
    width: max-content;
}

.organization-selector__toggle-label,
.organization-selector__toggle-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.organization-selector__toggle-label {
    max-width: 260px;
}

.organization-selector__toggle-meta {
    color: #607084;
    font-size: 0.72rem;
    font-weight: 800;
    max-width: 140px;
}

.organization-selector__panel {
    background: #fff;
    border: 0;
    border-right: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 0 20px 20px 0;
    bottom: var(--organization-selector-bottom);
    box-shadow: 18px 0 48px rgba(15, 44, 80, 0.18);
    display: none;
    left: 0;
    max-height: none;
    max-width: calc(100vw - 28px);
    overflow: hidden;
    position: fixed;
    top: var(--organization-selector-top);
    width: 360px;
    z-index: 2980;
}

.organization-selector--open .organization-selector__panel {
    display: block;
}

.organization-selector--open .organization-selector__toggle {
    display: none;
}

.organization-selector__head {
    align-items: flex-start;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(15, 44, 80, 0.08);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 16px;
}

.organization-selector__title {
    color: #10243f;
    font-weight: 900;
}

.organization-selector__subtitle {
    color: #68788e;
    font-size: 0.84rem;
    margin-top: 2px;
}

.organization-selector__close {
    align-items: center;
    background: #fff;
    border: 1px solid rgba(15, 44, 80, 0.12);
    border-radius: 10px;
    color: #0f4c81;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.organization-selector__search {
    padding: 12px 14px;
    position: relative;
}

.organization-selector__search i {
    color: #68788e;
    left: 26px;
    position: absolute;
    top: 24px;
}

.organization-selector__search .form-control {
    border-radius: 12px;
    padding-left: 34px;
}

.organization-selector__list {
    display: grid;
    gap: 8px;
    max-height: calc(100vh - var(--organization-selector-top) - var(--organization-selector-bottom) - 116px);
    overflow: auto;
    padding: 0 14px 14px;
}

.organization-selector__item {
    background: #f8fbff;
    border: 1px solid rgba(15, 44, 80, 0.08);
    border-radius: 14px;
    color: #10243f;
    display: grid;
    gap: 2px;
    padding: 11px 12px;
    text-decoration: none;
}

.organization-selector__item:hover {
    border-color: rgba(15, 76, 129, 0.32);
    color: #0f4c81;
}

.organization-selector__item--active {
    background: #e8f3ff;
    border-color: rgba(15, 76, 129, 0.42);
    box-shadow: inset 0 0 0 1px rgba(15, 76, 129, 0.1);
}

.organization-selector__item-name {
    font-weight: 800;
}

.organization-selector__item-meta {
    color: #68788e;
    font-size: 0.82rem;
}

@media (max-width: 900px) {
    body[data-theme="vsrf"].has-organization-selector main {
        padding-left: 10px !important;
    }

    .organization-selector__toggle {
        border-radius: 0 14px 14px 0;
        bottom: auto;
        min-height: 160px;
        top: var(--organization-selector-top);
    }

    .quick-actions__panel {
        max-height: calc(100vh - var(--quick-actions-top, 116px) - 18px);
        overflow: auto;
        width: min(320px, calc(100vw - var(--organization-selector-rail, 46px) - 18px));
    }

    .organization-selector__panel {
        bottom: auto;
        max-height: calc(100vh - var(--organization-selector-top) - 16px);
        width: min(340px, calc(100vw - 18px));
    }

    .organization-selector__list {
        max-height: calc(100vh - var(--organization-selector-top) - 132px);
    }
}

@media (max-width: 1100px) {
    .department-page-head {
        display: block;
    }

    .department-org-switch {
        margin-top: 16px;
    }
}

/* Chrome contract: edge-to-edge header/footer/sidebar, content stays page-scoped. */
body[data-theme="vsrf"] {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

body[data-theme="vsrf"] header,
body[data-theme="vsrf"] footer {
    flex: 0 0 auto;
    left: 0;
    margin: 0 !important;
    max-width: none !important;
    right: 0;
    width: 100% !important;
}

body[data-theme="vsrf"] header {
    border-radius: 0 !important;
    box-shadow: 0 2px 0 rgba(15, 44, 80, 0.08) !important;
    position: sticky;
    top: 0;
    z-index: 1200;
}

body[data-theme="vsrf"] header .header-container {
    max-width: none !important;
    width: 100% !important;
}

body[data-theme="vsrf"] main {
    flex: 1 0 auto;
}

body[data-theme="vsrf"] footer {
    border-radius: 0 !important;
    box-shadow: 0 -1px 0 rgba(15, 44, 80, 0.08) !important;
    position: relative;
    z-index: 1100;
}

body[data-theme="vsrf"].has-organization-selector main {
    padding-left: calc(var(--organization-selector-rail, 46px) + 20px) !important;
}

body[data-theme="vsrf"] .organization-selector__toggle,
body[data-theme="vsrf"] .organization-selector__panel {
    bottom: var(--organization-selector-bottom, 58px);
    top: var(--organization-selector-top, 116px);
}

body[data-theme="vsrf"] .organization-selector__toggle {
    z-index: 2980;
}

body[data-theme="vsrf"] .organization-selector__panel {
    z-index: 2980;
}

body[data-theme="vsrf"] .organization-selector--open .organization-selector__panel {
    z-index: 2980;
}

/* Bootstrap modals must sit above sticky chrome and organization selector. */
body[data-theme="vsrf"].modal-open .organization-selector {
    pointer-events: none;
}

body[data-theme="vsrf"].modal-open .organization-selector__toggle,
body[data-theme="vsrf"].modal-open .organization-selector__panel {
    opacity: 0;
    pointer-events: none;
}

body[data-theme="vsrf"] .modal-backdrop {
    z-index: 2990 !important;
}

body[data-theme="vsrf"] .modal {
    z-index: 3000 !important;
}

body[data-theme="vsrf"] .dropdown-menu-portal {
    z-index: 3010 !important;
    max-width: min(420px, calc(100vw - 24px));
    max-height: min(70vh, 560px);
    overflow-y: auto;
    overflow-x: hidden;
}

body[data-theme="vsrf"]:not(.modal-open) .dropdown-menu-portal {
    z-index: 1300 !important;
}

body[data-theme="vsrf"] .modal-dialog {
    margin-top: 1.25rem !important;
    margin-bottom: 1.25rem !important;
}

body[data-theme="vsrf"] .app-sticky-controls {
    position: sticky !important;
    top: var(--app-sticky-top, calc(var(--app-sticky-header-offset, 64px) + 8px)) !important;
    z-index: 1090 !important;
}

body[data-theme="vsrf"] .app-sticky-controls.card-header,
body[data-theme="vsrf"] .app-sticky-controls[class*="table"] {
    z-index: 1080 !important;
}

@media (max-width: 900px) {
    body[data-theme="vsrf"].has-organization-selector main {
        padding-left: 10px !important;
    }

    .department-panel-head--compact,
    .department-tree-page-stats,
    .department-review-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .department-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .department-tree-toolbar,
    .department-tree-table,
    .department-inspector {
        border-radius: 10px;
    }

    .department-tree-toolbar {
        position: static !important;
    }

    .department-tree-toolbar .department-tree-filter-bar {
        align-items: stretch;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: 0;
    }

    .department-tree-filter-field,
    .department-tree-filter-field--wide {
        min-width: 0;
    }

    .department-tree-filter-field--wide {
        grid-column: 1 / -1;
    }

    .department-tree-scope-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .department-tree-header {
        display: none;
    }

    .department-tree,
    .department-tree-children {
        min-width: 0;
    }

    .department-tree-children {
        margin-left: 8px;
        padding-left: 8px;
    }

    .department-tree-item {
        gap: 6px;
        grid-template-columns: minmax(0, 1fr) auto auto;
        padding: 8px;
    }

    .department-tree-cell--name {
        grid-column: 1 / -1;
    }

    .department-tree-cell--type {
        display: none;
    }

    .department-tree-cell--metric {
        background: #f8fbff;
        border-radius: 999px;
        justify-content: center;
        min-height: 26px;
        padding: 0 7px;
    }

    .department-tree-cell--status {
        justify-content: flex-start;
    }

    .department-tree-inline-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .department-tree-name {
        white-space: normal;
    }

    .department-inspector {
        max-height: none;
        position: static;
    }

    .department-tree-node-details {
        margin-left: 0;
    }

    .department-tree-badges,
    .department-tree-inline-actions {
        position: static;
        transform: none;
    }

    .department-tree-inline-actions {
        margin: 0;
        opacity: 1;
        pointer-events: auto;
        justify-content: flex-start;
    }

    body[data-theme="vsrf"] .app-sticky-controls {
        position: static !important;
        top: auto !important;
    }

}

/* Final departments layout overrides: must remain at the end of this file. */
body[data-theme="vsrf"] .department-tree-toolbar {
    padding: 14px 14px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
    align-items: end !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field {
    flex: 0 0 118px !important;
    min-width: 0 !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field--wide {
    flex-basis: 168px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field--sync {
    flex-basis: 140px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field .form-control,
body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field .form-select {
    height: 36px !important;
    padding-bottom: 6px !important;
    padding-top: 6px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-check {
    align-self: end !important;
    flex: 0 0 auto !important;
    min-height: 36px !important;
    padding: 0 2px !important;
    white-space: nowrap !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-check .form-check-label {
    font-size: 0.72rem !important;
}

body[data-theme="vsrf"] .department-tree-toolbar [data-department-filter-reset] {
    align-self: end !important;
    flex: 0 0 auto !important;
    height: 36px !important;
    padding-inline: 12px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-reset-scope {
    align-self: end !important;
    flex: 0 0 auto !important;
    height: 36px !important;
    margin-left: auto !important;
    white-space: nowrap !important;
}

body[data-theme="vsrf"] .department-tree-header,
body[data-theme="vsrf"] .department-tree-item {
    gap: 7px !important;
    grid-template-columns: minmax(248px, 1.25fr) 52px 46px 64px 64px minmax(112px, 0.45fr) 84px !important;
}

body[data-theme="vsrf"] .department-workspace__main,
body[data-theme="vsrf"] .department-tree-table {
    overflow: hidden !important;
}

body[data-theme="vsrf"] .department-tree-inline-actions--row {
    background: transparent !important;
    border: 0 !important;
    display: flex !important;
    gap: 5px !important;
    justify-content: flex-end !important;
    padding: 0 !important;
    position: static !important;
    transform: none !important;
}

body[data-theme="vsrf"] .department-tree-inline-actions--row .btn {
    height: 26px !important;
    min-width: 26px !important;
}

body[data-theme="vsrf"] .department-tree-cell--status {
    min-width: 0 !important;
}

body[data-theme="vsrf"] .department-tree-sync-text {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

@media (max-width: 900px) {
    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field,
    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field--wide,
    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field--sync {
        flex-basis: auto !important;
    }

    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-check,
    body[data-theme="vsrf"] .department-tree-toolbar [data-department-filter-reset],
    body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-reset-scope {
        align-self: stretch !important;
        margin-left: 0 !important;
    }

    body[data-theme="vsrf"] .department-tree-item {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto !important;
        width: 100% !important;
    }

    body[data-theme="vsrf"] .department-tree-cell--name,
    body[data-theme="vsrf"] .department-tree-cell--status,
    body[data-theme="vsrf"] .department-tree-inline-actions--row {
        grid-column: 1 / -1 !important;
    }

    body[data-theme="vsrf"] .department-tree-inline-actions--row {
        justify-content: flex-start !important;
    }
}

/* Departments requested refinements: final cascade layer. */
body[data-theme="vsrf"] .department-workspace {
    display: block !important;
    grid-template-columns: none !important;
}

body[data-theme="vsrf"] .department-tree-children {
    border-left: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-cell--name {
    padding-left: 14px !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 28px !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 42px !important;
}

body[data-theme="vsrf"] .department-tree-children .department-tree-children .department-tree-children .department-tree-children .department-tree-cell--name {
    padding-left: 56px !important;
}

body[data-theme="vsrf"] .department-tree-header,
body[data-theme="vsrf"] .department-tree-item {
    gap: 8px !important;
    grid-template-columns: minmax(360px, 1fr) 70px 92px 82px minmax(124px, 0.36fr) 68px !important;
}

body[data-theme="vsrf"] .department-tree-cell--type {
    display: none !important;
}

body[data-theme="vsrf"] .department-workspace__main,
body[data-theme="vsrf"] .department-tree-table {
    overflow: visible !important;
}

body[data-theme="vsrf"] .department-tree-more-menu {
    display: inline-flex !important;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-menu {
    border-color: rgba(15, 44, 80, 0.12);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(16, 36, 63, 0.16);
    min-width: 220px;
    padding: 6px;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-item {
    align-items: center;
    border-radius: 6px;
    display: flex;
    font-size: 0.84rem;
    font-weight: 750;
    gap: 8px;
    min-height: 32px;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-item i {
    color: #315a86;
    width: 16px;
}

body[data-theme="vsrf"] .department-tree-more-menu .dropdown-item.text-danger i {
    color: #dc2626;
}

body[data-theme="vsrf"] .department-tree-action-menu {
    background: #ffffff;
    border: 1px solid rgba(15, 44, 80, 0.14);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(16, 36, 63, 0.18);
    min-width: 222px;
    padding: 6px;
}

body[data-theme="vsrf"] .department-tree-action-menu__item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #25364c;
    cursor: pointer;
    display: flex;
    font-size: 0.88rem;
    font-weight: 760;
    gap: 9px;
    min-height: 34px;
    padding: 7px 10px;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

body[data-theme="vsrf"] .department-tree-action-menu__item:hover,
body[data-theme="vsrf"] .department-tree-action-menu__item:focus {
    background: #f3f7fb;
    color: #10243f;
}

body[data-theme="vsrf"] .department-tree-action-menu__item i {
    color: #315a86;
    width: 17px;
}

body[data-theme="vsrf"] .department-tree-action-menu__item--danger {
    color: #dc2626;
}

body[data-theme="vsrf"] .department-tree-action-menu__item--danger i {
    color: #dc2626;
}

body[data-theme="vsrf"] .department-tree-action-menu__divider {
    border-top: 1px solid rgba(15, 44, 80, 0.1);
    margin: 6px -6px;
}

body[data-theme="vsrf"] .department-tree-row {
    position: relative !important;
}

body[data-theme="vsrf"] .department-tree-hover-tools {
    align-items: center;
    bottom: 4px;
    display: flex;
    gap: 6px;
    left: 64px;
    max-width: calc(100% - 140px);
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translateY(-2px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 2;
}

body[data-theme="vsrf"] .department-tree-row:hover {
    padding-bottom: 40px;
}

body[data-theme="vsrf"] .department-tree-row:hover .department-tree-hover-tools,
body[data-theme="vsrf"] .department-tree-hover-tools:focus-within {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

body[data-theme="vsrf"] .department-tree-hover-action {
    align-items: center;
    background: #ffffff;
    border: 1px dashed rgba(37, 99, 235, 0.34);
    border-radius: 7px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 850;
    gap: 6px;
    min-height: 24px;
    padding: 3px 8px;
    text-decoration: none;
}

body[data-theme="vsrf"] button.department-tree-hover-action {
    cursor: pointer;
}

body[data-theme="vsrf"] .department-tree-hover-action:hover,
body[data-theme="vsrf"] .department-tree-hover-action:focus {
    background: #eef6ff;
    border-style: solid;
}

body[data-theme="vsrf"] .department-tree-ghost-add {
    align-items: center;
    background: rgba(248, 251, 255, 0.92);
    border: 1px dashed rgba(37, 99, 235, 0.32);
    border-radius: 8px;
    color: #1d4ed8;
    cursor: pointer;
    display: inline-grid;
    font-size: 0.8rem;
    font-weight: 850;
    gap: 8px;
    grid-template-columns: 34px 24px auto;
    min-height: 30px;
    padding: 3px 12px 3px 0;
}

body[data-theme="vsrf"] .department-tree-ghost-add__line {
    background: rgba(37, 99, 235, 0.34);
    height: 1px;
    width: 34px;
}

body[data-theme="vsrf"] .department-tree-ghost-add__icon {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 6px;
    display: inline-flex;
    height: 22px;
    justify-content: center;
    width: 22px;
}

body[data-theme="vsrf"] .department-tree-ghost-add:hover,
body[data-theme="vsrf"] .department-tree-ghost-add:focus {
    background: #eef6ff;
    border-style: solid;
}

body[data-theme="vsrf"] .department-tree-item {
    cursor: default !important;
}

body[data-theme="vsrf"] .department-tree-item[draggable="true"] {
    cursor: default !important;
}

body[data-theme="vsrf"] .department-tree-toggle,
body[data-theme="vsrf"] .department-tree-name,
body[data-theme="vsrf"] .department-tree-inline-actions--row .btn,
body[data-theme="vsrf"] .department-tree-action-menu__item,
body[data-theme="vsrf"] .department-tree-ghost-add {
    cursor: pointer !important;
}

body[data-theme="vsrf"] .department-tree-name {
    text-decoration: none !important;
    width: fit-content;
    max-width: 100%;
}

body[data-theme="vsrf"] .department-tree-name:hover,
body[data-theme="vsrf"] .department-tree-name:focus {
    text-decoration: underline !important;
    text-underline-offset: 2px;
}

body[data-theme="vsrf"] .department-tree-branch-hover {
    align-items: center;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.74rem;
    font-weight: 850;
    gap: 5px;
    margin-top: 2px;
    opacity: 0;
    pointer-events: none;
    text-decoration: none;
    transform: translateY(-2px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    width: fit-content;
}

body[data-theme="vsrf"] .department-tree-row:hover .department-tree-branch-hover,
body[data-theme="vsrf"] .department-tree-branch-hover:focus {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

body[data-theme="vsrf"] .department-tree-branch-hover:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-bar {
    align-items: end !important;
    flex-wrap: wrap !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field--wide {
    flex: 1 1 360px !important;
}

body[data-theme="vsrf"] .department-tree-toolbar .department-tree-filter-field:not(.department-tree-filter-field--wide) {
    flex: 0 0 150px !important;
}

body[data-theme="vsrf"] .department-tree-filter-group {
    display: block !important;
}

body[data-theme="vsrf"] .department-tree-filter-group__body {
    z-index: 1310 !important;
}

body[data-theme="vsrf"] .department-inspector-dialog {
    max-width: min(1180px, calc(100vw - 32px)) !important;
}

body[data-theme="vsrf"] .department-inspector-modal .modal-content {
    border: 0;
    border-radius: 12px;
    overflow: hidden;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__head {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector {
    background: #ffffff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: grid !important;
    gap: 16px !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: auto !important;
    padding: 18px !important;
    position: static !important;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    padding: 0 !important;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__facts div {
    grid-template-columns: 130px minmax(0, 1fr);
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__section,
body[data-theme="vsrf"] .department-inspector-modal .department-inspector__link {
    margin: 0;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__actions {
    border-top: 1px solid rgba(15, 44, 80, 0.1);
    justify-content: flex-end;
    margin: 0;
    padding: 14px 18px;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

body[data-theme="vsrf"] .department-inspector-modal .department-inspector__action-grid .btn,
body[data-theme="vsrf"] .department-inspector-modal .department-inspector__action-grid form .btn {
    min-width: 150px;
}

@media (max-width: 900px) {
    body[data-theme="vsrf"] .department-tree-header,
    body[data-theme="vsrf"] .department-tree-item {
        grid-template-columns: minmax(0, 1fr) auto auto !important;
    }

    body[data-theme="vsrf"] .department-tree-row:hover {
        padding-bottom: 0;
    }

    body[data-theme="vsrf"] .department-tree-hover-tools {
        grid-column: 1 / -1;
        left: 0;
        margin-top: 6px;
        max-width: 100%;
        opacity: 1;
        pointer-events: auto;
        position: static;
        transform: none;
    }

    body[data-theme="vsrf"] .department-inspector-modal .department-inspector__metrics,
    body[data-theme="vsrf"] .department-inspector-modal .department-inspector__facts {
        grid-template-columns: 1fr !important;
    }
}
