a {
    font-weight: bold;
    color: var(--href-color-text);
    cursor: pointer;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

head,
meta,
link,
title {
    margin: 0;
    padding: 0;
    display: none;
}

body {
    font-size: 12pt;
    font-family: system-ui;
    color: var(--main-text-color);
    text-align: left;
    font-variant-numeric: proportional-nums;
    font-weight: var(--main-text-weight);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--header-text-color);
    font-weight: var(--header-weight);
}

main {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    /* min-height: calc(100vh - var(--topheader-height) - var(--footer-height) - 2px); */
}

#container {
    flex-grow: 1;
    overflow: auto;
    scroll-margin-top: 10px;
    padding: 10px 30px;
}


footer {
    color: var(--topheader-color-text);
    background-color: var(--topheader-color);
    text-align: center;
    width: 100%;
    /* height: var(--footer-height); */
    border-top: 1px solid var(--primary-color);
}

#topheader {
    width: 100%;
    display: flex;
    background-color: var(--topheader-color);
    justify-content: space-between;
    
    border-bottom: 1px solid var(--primary-color);
    flex-wrap: wrap;
}

#topheader-menu {
    display: flex;
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#topheader-menu>li {
    position: relative;
    align-content: center;
    height: var(--topheader-height);
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius);
}

#topheader-menu a {
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    color: var(--topheader-color-text);
    padding: 0 10px;
    width: 100%;
}

.sumbenu-header{
    text-wrap-mode: nowrap; height: 100%; align-content: center;
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--topheader-color);
    z-index: 20;
    padding: 0;
    list-style: none;
    width: 100%;
    border: 1px solid var(--primary-color);

    border-radius: var(--radius);
}

.submenu.active {
    display: block;
}

.submenu li {
    display: flex;
    text-align: center;
    justify-content: center;
    margin: 0;
    width: 100%;
    align-items: center;
    border-bottom: 1px solid gray;
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submenu a {
    padding: 10px !important;
}

.submenu li:last-child {
    border-bottom: unset;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.submenu li:first-child {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.submenu li:hover {
    background: var(--primary-color-hover);
    transform: translateY(-2px);
    /* Смещение вверх */
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
    /* Мягкая тень */
}

#ovz {
    display: block;
    border-radius: var(--radius);
}

#ovz>* {
    vertical-align: middle;
}

.dropdown:hover,
.ovz:hover {
    box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.15);
}

.menu {
    width: 100%;
}

.logo {
    margin: auto 20px;
}

.logo a {
    text-decoration: none;
    color: var(--primary-color-text);
    font-size: 20px;
    font-weight: bold;
}

/* Контейнер для логотипа */
.logo-wrapper {
    display: flex;
    align-items: center;
    height: var(--topheader-height);
    max-width: 450px;
    /* Ограничиваем по ширине, чтобы длинные лого не давили на меню */
    justify-content: space-between;
    gap: 10px; /* Минимальный зазор между ними */
    width: 100%;
}

/* Универсальный класс для логотипа (и для img, и для div с SVG) */
.vuz-logo-brand {
    height: calc(var(--topheader-height) - 15px);
    width: auto;
    /* Пропорциональная ширина */
    display: flex;
    align-items: center;
}

/* Если внутри div вставлен сырой SVG код */
.vuz-logo-brand svg {
    width: auto !important;
    height: 100% !important;
    display: block;
}

/* Если это обычная картинка (base64) */
.vuz-logo-brand img {
    height: 100%;
    width: auto;
    object-fit: contain;
    /* Чтобы картинка не деформировалась */
}

/* Текст рядом с лого (если логотипа нет) */
.vuz-name-text {
    flex: 1 1 auto;       /* 1: растет, 1: сжимается, auto: база */
    min-width: 0;         /* КРИТИЧЕСКИ ВАЖНО для flex-контейнеров, чтобы текст переносился */
    
    font-size: clamp(14px, 1.5vw, 18px);
    font-weight: bold;
    color: var(--topheader-color-text);

    display: -webkit-box;
    -webkit-box-orient: vertical; 
    -webkit-line-clamp: calc(var(--topheader-height)/20px);
    overflow: hidden;  

    max-height: 3.3rem;         
    line-height: 1.1rem;
    
    white-space: normal; 
}


#visibility {
    width: 22px;
    margin-right: 5px;
}

.block>* {
    margin: 5px 0;
}


.text-content {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    font-size: 0.95rem;
    line-height: 1.5;
}

table {
    width: 100%;
    display: table;
    /* На десктопе это таблица */
    border-collapse: collapse;
    max-width: 100%;
    border-radius: var(--radius);
    font-size: 10pt;
    box-shadow: inset 0px 0px 6px 0px rgba(34, 60, 80, 0.3);
}

/* Скролл-контейнер (если таблица вложена в div) */
.table-responsive {
    overflow-x: auto;
    max-height: 75vh;
    -webkit-box-shadow: 0px 0px 6px 0px rgba(34, 60, 80, 0.3) inset;
    box-shadow: 0px 0px 6px 0px rgba(34, 60, 80, 0.3) inset;
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}

.table-responsive.scroll {
    -webkit-box-shadow: 0 0 15px 6px color-mix(in srgb, var(--primary-color), transparent 70%);
    -moz-box-shadow: 0 0 15px 6px color-mix(in srgb, var(--primary-color), transparent 70%);
    box-shadow: 0 0 15px 6px color-mix(in srgb, var(--primary-color), transparent 70%);
}

.th-container {
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Максимум 3 строки */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 5.2em; /* 1.2 line-height * 3 строки */
    cursor: help;
}

.table-tooltip {
        position: fixed;
        pointer-events: none; /* Чтобы не мешал кликать по таблице */
        background: rgba(0, 0, 0, 0.8);
        color: #fff;
        padding: 5px 12px;
        border-radius: 4px;
        font-size: 12px;
        z-index: 1000;
        display: none; /* Скрыт изначально */
        white-space: nowrap;
        transform: translate(15px, 15px); /* Смещение от курсора */
    }

tr {
    display: table-row;
}

th,
td {
    display: table-cell;
    border: 1px solid lightgray;
    padding: 10px;
    word-wrap: break-word;
    vertical-align: middle;
}

/* Заголовок таблицы (Sticky) */
thead th {
    position: sticky;
    top: -1px;
    z-index: 10;
    background-color: var(--primary-color);
    color: var(--primary-color-text);
    text-align: center;
    box-shadow: 0px 9px 15px -8px rgba(34, 60, 80, 0.2);
}

tbody th {
    background-color: var(--primary-color);
    color: var(--primary-color-text);
    text-align: center;
    box-shadow: 0px 9px 15px -8px rgba(34, 60, 80, 0.2);
}

details {
    border: 1px solid var(--primary-color);
    border-radius: var(--radius);
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
    position: relative;
    overflow-wrap: anywhere;
    word-break: normal;
}

summary:hover{
    box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.15);
}

summary {
    background-color: var(--primary-color);
    color: var(--primary-color-text);
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
    position: relative;
    list-style: none;
    user-select: none;
    min-width: 140px;
    z-index: 2;
    /* Заголовок всегда выше контента */
}

summary::-webkit-details-marker {
    display: none;
}

details[open] summary::before {
    transform: rotate(90deg);
}

/* 
   ХИТРЫЙ ХАК: Линия-разделитель. 
   Появляется только когда details открыт.
   Она "приклеена" к заголовку и не двигается.
*/
details[open] summary::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    /* Цвет линии разделителя */
}

/* Контент */
details>*:not(summary) {
    padding: 10px;
    position: relative;
    z-index: 1;
}

/* Анимация без эффекта "прозрачной полоски" */
details[open]>*:not(summary) {
    animation: svedenReveal 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes svedenReveal {
    0% {
        opacity: 0;
        transform: translateY(-20px);
        /* Начинаем глубже под заголовком */
        /* Убираем clip-path, если он давал артефакты, 
           либо оставляем для эффекта выезда */
        clip-path: inset(0 0 100% 0);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        clip-path: inset(0 0 0% 0);
    }
}


/* ===========================================
   Планшеты (Адаптация)
   =========================================== */

@media (max-width: 1200px) {

    #topheader {
        flex-direction: column;
        align-items: center; /* Центрирует элементы по горизонтали, если нужно */
    }

    .logo {
        margin: 10px 0;      /* Убираем боковые 20px, добавляем отступ сверху/снизу */
        text-align: center;   /* Центрируем содержимое логотипа */
    }

    .vuz-name-text {

        max-height: unset;         
        line-height: unset;
    }

}

/* ===========================================
   Смартфоны (Адаптация)
   =========================================== */

@media (max-width: 768px) {
    body {
        font-size: 11pt;
        font-weight: normal;
        overflow-x: hidden;
    }

    /* Сбрасываем фиксированную высоту main для свободного скролла */
    main {
        display: block;
    }

    #container {
        padding: 15px 10px;
        overflow: visible;
    }

    /* Шапка и Логотип */
    #topheader {
        flex-direction: column;
        height: auto;
        padding: 10px 0;
    }

    .logo-wrapper {
        justify-content: center;
    }

    .logo {
        margin: 0 0 10px 0;
        text-align: center;
        display: flex;
        justify-content: center;
    }

    .vuz-name-text {
        font-size: 18px;
    }

    #topheader {
        flex-direction: column;
        height: auto;
        align-items: center;
    }

    #topheader-menu {
        flex-direction: column;
        text-align: center;
        width: 100%;
        align-items: center;
        flex-shrink: 0;
    }

    .sumbenu-header{
        text-wrap-mode: wrap;
    }

    /* Таблица -> Карточки */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
        width: 100%;
        /* Заменили 100vw на 100% */
        box-sizing: border-box;
    }

    thead {
        display: none;
        /* Скрываем заголовки колонок */
    }

    tr {
        border: 2px solid var(--primary-color);
        border-radius: var(--radius);
        margin-bottom: 15px;
        background: #fff;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        /* Чтобы внутренние td не вылезали за радиус */
    }

    tr:last-child {
        margin-bottom: 0;
    }

    td {
        display: flex;
        justify-content: flex-start;
        /* Изменили, чтобы контролировать отступы */
        align-items: flex-start;
        padding: 12px 10px;
        border: none;
        border-bottom: 1px solid #eee;
        min-width: 0;
        /* ВАЖНО: позволяет контенту сжиматься */
    }

    td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        width: 40%;
        /* Фиксируем ширину "шапки" слева */
        flex-shrink: 0;
        /* Запрещаем заголовку сжиматься */
        padding-right: 10px;
        color: var(--primary-color);
        font-size: 0.85rem;
    }

    /* Контент внутри ячейки (текст или ссылки) */
    td {
        text-align: left;
        /* Текст контента лучше выровнять по левому краю */
        word-break: break-word;
        /* Разрыв длинных слов */
    }

    /* Если внутри td есть вложенные элементы (div, a), заставляем их не распирать блок */
    td>* {
        flex: 1;
        min-width: 0;
        overflow-wrap: break-word;
    }

    summary::before {
        left: 12px;
    }

    /* Футер */
    footer {
        padding: 15px 0;
    }

    .ovz {
        justify-content: center;
    }

    .table-responsive {
        max-height: 70vh;
    }

    .menu-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
        gap: 10px;
    }
}

.pep-icon {
    cursor: default;
}

.menu-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex-wrap: wrap;
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-list li {
    display: flex;
}

.menu-list a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    padding: 10px 20px;
    text-decoration: none;
    color: var(--primary-color-text);
    background-color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

/* Эффекты при наведении */
.menu-list a:hover, 
.menu-list a:focus {
    background-color: var(--primary-color-text);
    color: var(--primary-color);
}

/* --- Переопределения для режима BVI --- */

body.bvi-active .tbl thead th,
body.bvi-active .tbl td {
    position: static !important;
    top: auto !important;
}

body.bvi-active .cell-scroll {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
}

body.bvi-active table {
    table-layout: auto !important;
}

body.bvi-active .table-responsive {
    max-height: none !important;
    overflow: none !important;
}

body.bvi-active .th-container {
    all: unset;
}

body.bvi-active #table-hint,
body.bvi-active .table-tooltip {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    html body.bvi-active td::before {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        margin-bottom: 10px !important;
        padding-right: 0 !important;
        border-bottom: 2px solid currentColor !important;
        color: inherit !important;
        font-size: inherit !important;
    }

    html body.bvi-active td {
        display: block !important;
        width: 100% !important;
        padding: 15px 10px !important;
    }

    tbody th{
        border-radius: var(--radius);
    }
}