/* components/com_meetingfeedback/css/structure.css */

/* ============================================================
   ROOT LAYOUT
   ============================================================ */

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
}

.mf-structure {
    display: flex;
    height: calc(100vh - 56px);
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ============================================================
   LEFT PANEL
   ============================================================ */

.mf-structure__left {
    flex: 0 0 320px;
    min-width: 220px;
    max-width: 520px;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--mf-border);
}

.mf-structure__left > .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.mf-structure__left .card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* ============================================================
   RIGHT PANEL
   ============================================================ */

.mf-structure__right {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding-left: 20px;
}

#mf-structure-content {
    height: 100%;
    min-height: 0;
}

#mf-structure-content > .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#mf-structure-content > .card > .card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ============================================================
   RESIZER
   ============================================================ */

.mf-structure__resizer {
    flex: 0 0 6px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: var(--mf-card-2);
    border-left: 1px solid var(--mf-border);
    border-right: 1px solid var(--mf-border);
}

.mf-structure__resizer:hover {
    background: var(--mf-accent-soft, rgba(26, 188, 156, 0.18));
}

/* ============================================================
   TOOLBAR / SEARCH
   ============================================================ */

.mf-structure__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.mf-structure__actions button {
    margin-left: 6px;
}

#mf-structure-search,
#mf-functions-search {
    width: 100%;
}

#mf-structure-search {
    margin-bottom: 6px;
}

/* ============================================================
   TABS
   ============================================================ */

#mf-structure-tabs .nav-link.active {
    box-shadow: 0 -2px 0 var(--mf-accent) inset;
}

#mf-structure-tabs {
    flex: 0 0 auto;
}

#mf-structure-tabs .nav-link {
    cursor: pointer;
    background: var(--mf-card-2) !important;
    color: var(--mf-text-muted) !important;
    border: 1px solid var(--mf-border) !important;
    margin-right: 4px;
    border-radius: 6px 6px 0 0;
}

/* hover */
#mf-structure-tabs .nav-link:hover {
    background: #434a52 !important;
    color: var(--mf-heading) !important;
}

/* АКТИВНА вкладка (ключове) */
#mf-structure-tabs .nav-link.active,
#mf-structure-tabs .nav-link[aria-selected="true"] {
    background: var(--mf-card) !important;   /* світліша */
    color: var(--mf-heading) !important;
    border-bottom: 2px solid var(--mf-accent) !important;
}


#mf-structure-content .mt-3 {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.mf-tab-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: var(--mf-card) !important;
}

.mf-tab-panel[data-panel="people"] {
    display: flex;
    flex-direction: column;
}

/* ============================================================
   ABOUT TAB
   ============================================================ */

.mf-tab-panel[data-panel="about"] {
    overflow: auto;
}

/* ============================================================
   PEOPLE TAB
   ============================================================ */

.mf-structure-people {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#mf-structure-people-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--mf-bg);
    border: 1px solid var(--mf-border);
    border-top: 0;
}

#mf-structure-people-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #394047;
    color: var(--mf-heading);
    border-bottom: 1px solid var(--mf-border);
}

#mf-structure-people-table-wrap .mf-lv__table {
    width: 100%;
    table-layout: fixed;
    color: var(--mf-text);
}

#mf-structure-people-table-wrap .mf-lv__table tbody tr {
    background: #2f3439;
}

#mf-structure-people-table-wrap .mf-lv__table tbody tr:hover {
    background: #383e44;
}

#mf-structure-people-table-wrap .mf-lv__table th,
#mf-structure-people-table-wrap .mf-lv__table td {
    border-color: var(--mf-border);
    color: var(--mf-text);
}

#mf-structure-people-table-wrap .mf-lv__table tbody tr.selected,
#mf-structure-people-table-wrap .mf-lv__table tbody tr.is-selected {
    background: rgba(26, 188, 156, 0.14) !important;
}

/* ============================================================
   JSTREE FIXES — DEPARTMENTS
   ============================================================ */

#mf-dept-tree .jstree-ocl {
    display: none !important;
    width: 0 !important;
}

#mf-dept-tree .jstree-node,
#mf-dept-tree .jstree-anchor {
    white-space: normal !important;
}

#mf-dept-tree .jstree-anchor {
    height: auto !important;
    line-height: 1.35;
    padding-right: 6px;
}

/* ============================================================
   VISUAL UX — DEPARTMENTS
   ============================================================ */

#mf-dept-tree .jstree-parent > .jstree-anchor {
    font-weight: 600;
}


/* ============================================================
   FUNCTIONS TAB LAYOUT
   ============================================================ */

.mf-tab-panel[data-panel="functions"] {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.mf-structure-functions {
    display: flex;
    gap: 20px;
    align-items: stretch;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.mf-structure-functions__left,
.mf-structure-functions__right {
    min-height: 0;
    overflow: hidden;
}

.mf-structure-functions__left {
    flex: 0 0 52%;
    min-width: 320px;
}

.mf-structure-functions__right {
    flex: 1 1 auto;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}

#mf-structure-functions-tree,
#mf-structure-functions-selected {
    min-height: 220px;
    height: 100%;
    max-height: calc(100vh - 360px);
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
}

/* ============================================================
   JSTREE FIXES — FUNCTIONS
   ============================================================ */

#mf-structure-functions-tree .jstree-node,
#mf-structure-functions-tree .jstree-anchor {
    white-space: normal !important;
}

#mf-structure-functions-tree .jstree-anchor {
    height: auto !important;
    line-height: 1.35;
    word-break: break-word;
    padding-right: 6px;
}

#mf-structure-functions-tree .jstree-anchor:not(.jstree-clicked):hover {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

/* ============================================================
   FUNCTIONS TREE STATE COLORS
   ============================================================ */

#mf-structure-functions-tree li.mf-func-node--own > a.jstree-anchor,
#mf-structure-functions-tree li.mf-func-node--has-own > a.jstree-anchor {
    color: #4fd18b !important;
    font-weight: 600;
}

#mf-structure-functions-tree li.mf-func-node--inherited > a.jstree-anchor,
#mf-structure-functions-tree li.mf-func-node--has-inherited > a.jstree-anchor {
    color: #ff7474 !important;
    font-weight: 600;
}

#mf-structure-functions-tree li.mf-func-node--has-both > a.jstree-anchor {
    color: #b78cff !important;
    font-weight: 700;
}

#mf-structure-functions-tree .jstree-checkbox.jstree-undetermined.mf-own-partial {
    background: rgba(79, 209, 139, 0.25);
    border-radius: 3px;
}

#mf-structure-functions-tree .jstree-checkbox.jstree-undetermined.mf-inherited-partial {
    background: rgba(255, 116, 116, 0.25);
    border-radius: 3px;
}

#mf-structure-functions-tree .jstree-checkbox.jstree-undetermined.mf-both-partial {
    background: rgba(183, 140, 255, 0.25);
    border-radius: 3px;
}

/* ============================================================
   SELECTED FUNCTIONS LIST
   ============================================================ */

.mf-func-selected-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mf-func-selected-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--mf-border);
    border-radius: 6px;
    background: var(--mf-card-2);
    color: var(--mf-text);
}

.mf-func-selected-item__title {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.35;
    word-break: break-word;
}

.mf-func-selected-item__remove {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: #ff7c87;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}

.mf-func-selected-item__remove:hover {
    color: #ff4d5f;
}

/* ============================================================
   ABOUT FUNCTIONS TREE
   ============================================================ */

.mf-about-func-tree__node {
    margin-bottom: 8px;
}

.mf-about-func-tree__title {
    margin: 6px 0;
    font-weight: 600;
    line-height: 1.45;
}

.mf-about-func-tree__title-text {
    font-weight: 700;
}

.mf-about-func-tree__title-desc,
.mf-about-func-tree__item-desc {
    color: var(--mf-text-muted);
    font-weight: 400;
}

.mf-about-func-tree__item-title {
    font-weight: 500;
    color: var(--mf-text);
}

.mf-about-func-tree__children {
    margin-left: 18px;
}

.mf-about-func-tree__item {
    position: relative;
    margin: 4px 0;
    padding-right: 28px;
    line-height: 1.45;
    border: none;
    background: none;
    border-radius: 0;
    color: var(--mf-text);
}

.mf-about-func-tree__num {
    margin-right: 6px;
    color: inherit;
    font-weight: 700;
}

.mf-about-func-tree__item .mf-func-selected-item__remove {
    position: absolute;
    top: 0;
    right: 0;
    border: 0;
    background: transparent;
    color: #ff7c87;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.mf-about-func-tree__item .mf-func-selected-item__remove:hover {
    color: #ff4d5f;
}

/* ============================================================
   MODALS
   ============================================================ */

.mf-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.mf-modal.is-open {
    display: block;
}

.mf-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .68);
}

.mf-modal__dialog {
    position: relative;
    background: var(--mf-card);
    color: var(--mf-text);
    margin: 5vh auto;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--mf-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.mf-modal__close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;
    border: 0;
    background: transparent;
    color: var(--mf-text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.mf-modal__close:hover {
    color: var(--mf-accent);
}

.mf-modal__title {
    margin-bottom: 12px;
    padding-right: 28px;
    font-size: 18px;
    font-weight: 600;
    color: var(--mf-heading);
}

/* PHOTO MODAL */

.mf-photo-dialog {
    width: calc(100vw - 32px);
    max-width: 720px;
    text-align: center;
}

#mfPhotoModalImg {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
    border-radius: 10px;
}

/* LIST MODAL */

.mf-list-dialog {
    display: flex;
    flex-direction: column;
    width: 720px;
    max-width: 95vw;
    height: 520px;
    max-height: 90vh;
    overflow: hidden;
    resize: both;
}

.mf-list-header {
    flex: 0 0 auto;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--mf-border);
}

.mf-list-desc {
    margin-top: 4px;
    color: var(--mf-text-muted);
    font-size: 14px;
}

.mf-list-body {
    flex: 1 1 auto;
    padding-top: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.mf-list-scroll {
    max-width: 100%;
}

.mf-list-table {
    width: 100%;
    table-layout: fixed;
    color: var(--mf-text);
}

.mf-list-table th,
.mf-list-table td {
    vertical-align: top;
    border-color: var(--mf-border);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
    .mf-structure-functions {
        flex-direction: column;
        align-items: stretch;
    }

    .mf-structure-functions__left,
    .mf-structure-functions__right {
        flex: 1 1 auto;
        min-width: 0;
    }

    #mf-structure-functions-tree,
    #mf-structure-functions-selected {
        max-height: none;
        height: auto;
    }
}

/* ============================================================
   PEOPLE TABLE COLUMN WIDTH TUNING
   ============================================================ */

/* чекбокс */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(1),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(1) {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

/* № */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(2),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(2) {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    text-align: center;
    white-space: nowrap;
}

/* ПІБ */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(3),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(3) {
    width: 170px;
}

/* Фото */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(4),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(4) {
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    text-align: center;
}

/* Категорія */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(5),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(5) {
    width: 140px;
}

/* Посада / роль */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(6),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(6) {
    width: 120px;
}

/* Телефон */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(7),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(7) {
    width: 125px;
    min-width: 125px;
    max-width: 125px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* TG */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(8),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(8) {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    text-align: center;
    white-space: nowrap;
}

/* Дата нар. */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(9),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(9) {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    text-align: center;
    white-space: nowrap;
}

/* Списки */
#mf-structure-people-table-wrap .mf-lv__table th:nth-child(10),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(10) {
    width: auto;
    min-width: 300px;
}

/* трохи компактніше фото в таблиці */
#mf-structure-people-table-wrap .mf-contact-photo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--mf-border);
}

/* щоб ПІБ і списки нормально переносились */
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(3),
#mf-structure-people-table-wrap .mf-lv__table td:nth-child(10) {
    word-break: break-word;
    white-space: normal;
}

/* вертикальне вирівнювання по верху */
#mf-structure-people-table-wrap .mf-lv__table td {
    vertical-align: top;
}

/* ============================================================
   PEOPLE TABLE COLUMN WIDTH TUNING — CLASS BASED
   ============================================================ */

#mf-structure-people-table-wrap .mf-lv__table .mf-col-check {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-num {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    text-align: center;
    white-space: nowrap;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-name {
    width: 170px;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-photo {
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    text-align: center;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-category {
    width: 140px;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-role {
    width: 120px;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-phone {
    width: 125px;
    min-width: 125px;
    max-width: 125px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-tg {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    text-align: center;
    white-space: nowrap;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-birth {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    text-align: center;
    white-space: nowrap;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-lists {
    width: auto;
    min-width: 300px;
}

#mf-structure-people-table-wrap .mf-lv__table .mf-col-name,
#mf-structure-people-table-wrap .mf-lv__table .mf-col-lists {
    word-break: break-word;
    white-space: normal;
}

/* ============================================================
   PEOPLE TABLE — EXTENDED / GUEST MODE
   ============================================================ */

#mf-structure-people-table-wrap:not(.mf-can-extended) .mf-col-phone,
#mf-structure-people-table-wrap:not(.mf-can-extended) .mf-col-tg,
#mf-structure-people-table-wrap:not(.mf-can-extended) .mf-col-birth {
    display: none;
}

#mf-structure-people-table-wrap.mf-can-extended .mf-col-phone,
#mf-structure-people-table-wrap.mf-can-extended .mf-col-tg,
#mf-structure-people-table-wrap.mf-can-extended .mf-col-birth {
    display: table-cell;
}

#mf-structure-people-table-wrap .mf-list-badge {
    cursor: pointer;
}

#mf-structure-people-table-wrap .mf-list-badge:hover {
    filter: brightness(1.08);
}

.mf-tab-panel[data-panel="about"] .card-body {
    padding-left: 0;
    padding-right: 0;
}



/* ============================================================
   DARK THEME PATCH — STRUCTURE
   ============================================================ */

/* ---------- TABS ---------- */

#mf-structure-tabs.nav-tabs {
    border-bottom: 1px solid var(--mf-border);
}

#mf-structure-tabs .nav-link {
    background: var(--mf-card-2) !important;
    color: var(--mf-text) !important;
    border: 1px solid var(--mf-border) !important;
    border-bottom-color: var(--mf-border) !important;
}

#mf-structure-tabs .nav-link:hover,
#mf-structure-tabs .nav-link:focus {
    background: #434a52 !important;
    color: var(--mf-heading) !important;
}

#mf-structure-tabs .nav-link.active,
#mf-structure-tabs .nav-item.show .nav-link,
#mf-structure-tabs .nav-link[aria-selected="true"] {
    background: var(--mf-card) !important;
    color: var(--mf-heading) !important;
    border-color: var(--mf-border) !important;
    border-bottom: 2px solid var(--mf-accent) !important;
}

/* ---------- PEOPLE TABLE WRAP ---------- */

#mf-structure-people-table-wrap {
    background: #2f3439 !important;
    border: 1px solid var(--mf-border) !important;
    border-top: 0 !important;
}

/* якщо bootstrap/table styles десь дають білий фон */
#mf-structure-people-table-wrap table,
#mf-structure-people-table-wrap .mf-lv__table,
#mf-structure-people-table-wrap .table {
    background: #2f3439 !important;
    color: var(--mf-text) !important;
}

#mf-structure-people-table-wrap .mf-lv__table thead,
#mf-structure-people-table-wrap .mf-lv__table thead tr,
#mf-structure-people-table-wrap .mf-lv__table thead th {
    background: #394047 !important;
    color: var(--mf-heading) !important;
    border-color: var(--mf-border) !important;
}

#mf-structure-people-table-wrap .mf-lv__table tbody,
#mf-structure-people-table-wrap .mf-lv__table tbody tr,
#mf-structure-people-table-wrap .mf-lv__table tbody td {
    background: #2f3439 !important;
    color: var(--mf-text) !important;
    border-color: var(--mf-border) !important;
}

#mf-structure-people-table-wrap .mf-lv__table tbody tr:hover,
#mf-structure-people-table-wrap .mf-lv__table tbody tr:hover td {
    background: #383e44 !important;
}

#mf-structure-people-table-wrap .mf-lv__table tbody tr.selected,
#mf-structure-people-table-wrap .mf-lv__table tbody tr.selected td,
#mf-structure-people-table-wrap .mf-lv__table tbody tr.is-selected,
#mf-structure-people-table-wrap .mf-lv__table tbody tr.is-selected td {
    background: rgba(26, 188, 156, 0.14) !important;
}

/* ---------- PEOPLE TABLE TEXT / BADGES ---------- */

#mf-structure-people-table-wrap .mf-lv__table td a {
    color: #7ddfcd !important;
}

#mf-structure-people-table-wrap .mf-lv__table td a:hover {
    color: #a5efe2 !important;
}

#mf-structure-people-table-wrap .mf-list-badge,
#mf-structure-people-table-wrap .badge {
    background: #40474f !important;
    color: #f2f4f5 !important;
    border: 1px solid #515961 !important;
}

/* ---------- FUNCTIONS TREE ACTIVE NODE ---------- */

#mf-structure-functions-tree .jstree-clicked,
#mf-structure-functions-tree .jstree-anchor.jstree-clicked {
    background: var(--mf-accent) !important;
    color: #081311 !important;
    border-radius: 3px;
    box-shadow: none !important;
}

#mf-structure-functions-tree .jstree-anchor.jstree-clicked *,
#mf-structure-functions-tree .jstree-clicked * {
    color: #081311 !important;
}

#mf-structure-functions-tree .jstree-hovered {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--mf-heading) !important;
    border-radius: 3px;
}

/* щоб кольори own/inherited не вбивали читабельність при active */
#mf-structure-functions-tree li.mf-func-node--own > a.jstree-anchor.jstree-clicked,
#mf-structure-functions-tree li.mf-func-node--has-own > a.jstree-anchor.jstree-clicked,
#mf-structure-functions-tree li.mf-func-node--inherited > a.jstree-anchor.jstree-clicked,
#mf-structure-functions-tree li.mf-func-node--has-inherited > a.jstree-anchor.jstree-clicked,
#mf-structure-functions-tree li.mf-func-node--has-both > a.jstree-anchor.jstree-clicked {
    color: #081311 !important;
    font-weight: 700;
}





/* ---------- ABOUT TEXT FIX ---------- */

.mf-tab-panel[data-panel="about"] {
    color: var(--mf-text);
}

.mf-tab-panel[data-panel="about"] * {
    color: inherit;
}

/* конкретно для цього кейсу */
.mf-tab-panel[data-panel="about"] .text-muted {
    color: var(--mf-text-muted) !important;
}

/* fallback */
.mf-tab-panel[data-panel="about"] p,
.mf-tab-panel[data-panel="about"] div {
    color: var(--mf-text) !important;
}


/* ---------- DEPARTMENT TREE: CLEAN STATES ---------- */

/* базовий вигляд вузлів */
#mf-dept-tree .jstree-anchor {
    height: auto !important;
    line-height: 1.35;
    padding-right: 6px;
    background: transparent !important;
    color: var(--mf-text) !important;
    border-radius: 3px;
}

/* hover повністю вимкнений */
#mf-dept-tree .jstree-anchor:hover,
#mf-dept-tree .jstree-hovered {
    background: transparent !important;
    color: var(--mf-text) !important;
}


/* ---------- DEPARTMENT TREE: CLEAN STATES ---------- */

#mf-dept-tree .jstree-anchor {
    height: auto !important;
    line-height: 1.35;
    padding-right: 6px;
    background: transparent !important;
    color: var(--mf-text) !important;
    border-radius: 3px;
}

/* hover без затирання іконок */
#mf-dept-tree .jstree-anchor:hover,
#mf-dept-tree .jstree-hovered {
    background: transparent !important;
    color: var(--mf-text) !important;
}

/* фіксація іконок */
#mf-dept-tree .jstree-themeicon,
#mf-dept-tree .jstree-icon {
    background-repeat: no-repeat !important;
    background-position: center center !important;
}

/* тільки активний вузол має підсвітку */
#mf-dept-tree .jstree-clicked,
#mf-dept-tree .jstree-anchor.jstree-clicked {
    background: #9fdcff !important;
    color: #081311 !important;
    border-radius: 3px;
}

#mf-dept-tree .jstree-clicked *,
#mf-dept-tree .jstree-anchor.jstree-clicked * {
    color: #081311 !important;
}

/* no wholerow paint */
#mf-dept-tree .jstree-wholerow-hovered,
#mf-dept-tree .jstree-wholerow-clicked {
    background: transparent !important;
}



/* structure: dept tree uses its own active highlight, no wholerow paint */
#mf-dept-tree .jstree-wholerow-hovered {
    background: transparent !important;
}

#mf-dept-tree .jstree-wholerow-clicked {
    background: transparent !important;
}


/* контейнер вкладок */
#mf-structure-tabs {
    background: var(--mf-card) !important;
    padding: 8px 8px 0;
}



/* ============================================================
   DARK THEME PATCH — LIST MODAL
   ============================================================ */

/* сама модалка */
.mf-list-dialog,
.mf-list-dialog .mf-modal__dialog {
    background: var(--mf-card) !important;
    color: var(--mf-text) !important;
    border: 1px solid var(--mf-border) !important;
}

/* верх модалки */
.mf-list-header {
    background: var(--mf-card) !important;
    color: var(--mf-heading) !important;
    border-bottom: 1px solid var(--mf-border) !important;
}

.mf-list-desc {
    color: var(--mf-text-muted) !important;
}

/* тіло */
.mf-list-body,
.mf-list-scroll {
    background: var(--mf-card) !important;
    color: var(--mf-text) !important;
}

/* таблиця повністю */
.mf-list-table,
.mf-list-table.table {
    background: #2f3439 !important;
    color: var(--mf-text) !important;
    border-color: var(--mf-border) !important;
}

/* шапка */
.mf-list-table thead,
.mf-list-table thead tr,
.mf-list-table thead th {
    background: #394047 !important;
    color: var(--mf-heading) !important;
    border-color: var(--mf-border) !important;
}

/* рядки */
.mf-list-table tbody,
.mf-list-table tbody tr,
.mf-list-table tbody td {
    background: #2f3439 !important;
    color: var(--mf-text) !important;
    border-color: var(--mf-border) !important;
}

/* hover */
.mf-list-table tbody tr:hover,
.mf-list-table tbody tr:hover td {
    background: #383e44 !important;
}

/* selected row */
.mf-list-table tbody tr.selected,
.mf-list-table tbody tr.selected td,
.mf-list-table tbody tr.is-selected,
.mf-list-table tbody tr.is-selected td {
    background: rgba(26, 188, 156, 0.14) !important;
}

/* посилання */
.mf-list-table a {
    color: #7ddfcd !important;
}

.mf-list-table a:hover {
    color: #a5efe2 !important;
}

/* СПИСКИ*/

/* badge/мітки всередині таблиці */
.mf-list-table .badge,
.mf-list-table .mf-list-badge {
    background: #40474f !important;
    color: #f2f4f5 !important;
    border: 1px solid #515961 !important;
}

/* checkbox у темній темі */
.mf-list-table input[type="checkbox"] {
    accent-color: var(--mf-accent);
}

/* якщо bootstrap впирається білим фоном */
.mf-list-table.table-striped > tbody > tr:nth-of-type(odd) > *,
.mf-list-table.table-hover > tbody > tr:hover > *,
.mf-list-table.table > :not(caption) > * > * {
    background-color: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
}



#mf-dept-tree .jstree-leaf > .jstree-ocl {
    display: none !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#mf-dept-tree .jstree-leaf > .jstree-anchor {
    padding-left: 0 !important;
}


/* ============================================================
   JSTREE: REMOVE TREE LINES (VERTICAL / CONNECTORS)
   ============================================================ */

/* прибрати всі лінії дерева */
#mf-dept-tree .jstree-node,
#mf-dept-tree .jstree-container-ul,
#mf-dept-tree ul {
    background: none !important;
}

/* прибрати вертикальні/горизонтальні конектори */
#mf-dept-tree .jstree-node::before,
#mf-dept-tree .jstree-node::after {
    display: none !important;
}

/* прибрати службові елементи (якщо ще щось лишиться) */
#mf-dept-tree .jstree-ocl {
    display: none !important;
    width: 0 !important;
}

#mf-dept-tree .jstree-container-ul,
#mf-dept-tree .jstree-node,
#mf-dept-tree ul {
    background: none !important;
}

#mf-dept-tree .jstree-ocl {
    display: none !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}



/* 🔥 ВБИТИ ВСІ ЛІНІЇ jsTree НАХРЕН */
#mf-dept-tree .jstree-node {
    background-image: none !important;
}

#mf-dept-tree .jstree-container-ul {
    background-image: none !important;
}

/* якщо тема підтягує спрайт */
#mf-dept-tree .jstree-icon,
#mf-dept-tree .jstree-themeicon {
    background-image: none !important;
}


/* ================= COLLEGIAL BODIES ================= */

.mf-bodies {
    display: flex;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.mf-bodies__left,
.mf-bodies__right {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* картки всередині */
.mf-bodies__left .card,
.mf-bodies__right .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* ОЦЕ КЛЮЧ */
.mf-bodies__left .card-body,
.mf-bodies__right .card-body {
    overflow: auto;
    min-height: 0;
}



/* ============================================================
   MOBILE LAYOUT — STRUCTURE
   ============================================================ */

@media (max-width: 768px) {
    html,
    body {
        height: auto;
        overflow: auto;
    }

    body {
        overflow-x: hidden;
    }

    .mf-structure {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    .mf-structure__left,
    .mf-structure__right {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 0;
    }

    .mf-structure__left {
        border-right: 0;
        border-bottom: 1px solid var(--mf-border);
    }

    .mf-structure__right {
        padding-left: 0;
        padding-top: 12px;
        overflow: visible;
    }

    .mf-structure__resizer {
        display: none !important;
    }

    .mf-structure__left > .card,
    #mf-structure-content,
    #mf-structure-content > .card,
    #mf-structure-content > .card > .card-body {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .mf-structure__left .card-body,
    .mf-tab-panel,
    .mf-tab-panel[data-panel="about"],
    .mf-tab-panel[data-panel="people"],
    .mf-tab-panel[data-panel="functions"] {
        overflow: visible;
        height: auto;
    }

    /* toolbar у стовпчик */
    .mf-structure__toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .mf-structure__actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .mf-structure__actions button {
        margin-left: 0;
    }

    /* вкладки щоб не ламалися */
    #mf-structure-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 0 0;
    }

    #mf-structure-tabs .nav-link {
        margin-right: 0;
    }

    /* people table — даємо горизонтальний скрол, а не ламаємо все */
    #mf-structure-people-table-wrap {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #mf-structure-people-table-wrap .mf-lv__table {
        min-width: 900px;
        table-layout: fixed;
    }

    /* functions tab теж у стовпчик */
    .mf-structure-functions {
        flex-direction: column;
        gap: 12px;
        height: auto;
        overflow: visible;
    }

    .mf-structure-functions__left,
    .mf-structure-functions__right {
        min-width: 0;
        width: 100%;
        overflow: visible;
    }

    #mf-structure-functions-tree,
    #mf-structure-functions-selected {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    /* модалка списку на телефоні */
    .mf-list-dialog {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        height: auto;
        max-height: 92dvh;
        margin: 4vh auto;
        resize: none;
    }
}


