/* =========================
   Переменные (CSS Custom Properties)
   ========================= */

   body.fonts-loading {
    opacity: 0;
}
body {
    transition: opacity 0.15s ease-in;
}

   :root {
    --font-main: 'MainFont';
    --font-katex: 'KatexFont';
    --color-bg-main: #fff;
    --color-bg-header: rgba(0, 0, 0, 0.05);
    --color-bg-menu: rgba(0, 0, 0, 0.1);
    --color-bg-menu-link: rgba(0, 0, 0, 0.3);
    --color-bg-menu-link-hover: rgba(0, 0, 0, 0.4);
    --color-bg-hover: #f0f9ff;
    --color-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    --color-shadow-menu: 0 0 10px rgba(0, 0, 0, 0.5);
    --color-outline-menu: 2px solid rgba(200, 200, 200, 0);
    --color-outline-menu-hover: 2px solid rgba(200, 200, 200, 1);
    --color-outline-btn: 4px solid rgba(235, 67, 178, 0.9);
    --color-outline-btn-hover: 6px solid rgba(185, 17, 128, 1);
    --color-btn-gradient: linear-gradient(to right, #4a2bbd, #2a1b8f);
    --radius-main: 20px;
    --radius-btn: 50px;
    --transition-main: all 0.3s ease-in-out;
    --transition-fast: all 0.2s;
}


/* =========================
   Подключение шрифтов
   ========================= */

@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Thin_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Thin_0.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-ThinItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-ThinItalic_0.ttf') format('truetype');
    font-weight: 100;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-UltraLight_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-UltraLight_0.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-UltraLightItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-UltraLightItalic_0.ttf') format('truetype');
    font-weight: 200;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Light_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Light_0.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-LightItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-LightItalic_0.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Regular_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Regular_0.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-RegularItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-RegularItalic_0.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Medium_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Medium_0.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-MediumItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-MediumItalic_0.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Semibold_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Semibold_0.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-SemiboldItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-SemiboldItalic_0.ttf') format('truetype');
    font-weight: 600;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Bold_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Bold_0.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-BoldItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-BoldItalic_0.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Extrabold_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Extrabold_0.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-ExtraboldItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-ExtraboldItalic_0.ttf') format('truetype');
    font-weight: 800;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Black_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Black_0.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-BlackItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-BlackItalic_0.ttf') format('truetype');
    font-weight: 900;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-Heavy_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-Heavy_0.ttf') format('truetype');
    font-weight: 950;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'MainFont';
    src: url('resources/fonts/Gilroy-HeavyItalic_0.woff2') format('woff2'),
         url('resources/fonts/Gilroy-HeavyItalic_0.ttf') format('truetype');
    font-weight: 950;
    font-style: italic;
    font-display: block;
}
@font-face {
    font-family: 'KatexFont';
    src: url('resources/fonts/KaTeX_Main-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}


/* =========================
  Фон и анимация
  ========================= */


/* Фон */

#lottie-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Наибольшая высота вьюпорта — чтобы анимированный фон всегда доходил до
       низа даже при скрытой панели браузера (иначе внизу мелькает белая полоса). */
    height: 100lvh;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

#lottie-background svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Стрелка */

#lottie-arrow {
    width: 100px;
    height: 100px;
    pointer-events: none;
}

#lottie-arrow svg {
    width: 100%;
    height: 100%;
    opacity: 0.9;
}


/* Кнопка прокрутки вверх */

.btn-up {
    position: fixed;
    background-color:rgba(255, 255, 255, 0.7);
    box-shadow: var(--color-shadow);
    right: 20px;
    bottom: 20px;
    /* Учитываем системную панель жестов / «таск-менеджера» снизу на мобильных.
       --vv-bottom добавляет отступ, когда появляется динамическая нижняя панель
       браузера, и убирает его, когда она скрывается (см. scripts/viewport.js). */
    bottom: calc(20px + env(safe-area-inset-bottom, 0px) + var(--vv-bottom, 0px));
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease-in-out, transform 0.3s ease-in-out, background-color 0.3s ease-in-out, bottom 0.3s ease-in-out, right 0.3s ease-in-out;
    color: black;
    backdrop-filter: blur(10px);
    width: 50px;
    height: 50px;
    transform: translateY(0);
    z-index: 1000;
  }

  .btn-up_hide {
    display: none;
  }

  .btn-up_hiding {
    opacity: 0;
    transform: translateY(100px);
  }

  .btn-up-icon {
    width: 40px;
    height: 40px;
    fill: currentcolor;
  }

  @media (hover: hover) and (pointer: fine) {
    .btn-up:hover {
      background-color: rgba(230, 230, 230, 0.7);
      transition: background-color 0.3s ease-in-out;
    }
  }


/* =========================
   Фиксированная кнопка чата (над кнопкой вверх)
   ========================= */

.btn-chat-fixed {
    position: fixed;
    right: 20px;
    bottom: 80px;
    /* Поднимаем над системной панелью жестов и динамической нижней панелью браузера */
    bottom: calc(80px + env(safe-area-inset-bottom, 0px) + var(--vv-bottom, 0px));
    width: 50px;
    height: 50px;
    border-radius: 25px;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    box-shadow: var(--color-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(19, 49, 108, 1);
    z-index: 1000;
    transition: opacity 0.15s ease-in-out, transform 0.3s ease-in-out, background-color 0.3s ease-in-out, bottom 0.3s ease-in-out, right 0.3s ease-in-out;
    transform: translateY(0);
}
.btn-chat-fixed_hide {
    display: none;
}
@media (hover: hover) and (pointer: fine) {
    .btn-chat-fixed:hover {
        background-color: rgba(230, 230, 230, 0.7);
    }
}

/* Скрываем кнопку чата когда чат открыт */
body.theme-chat-active .btn-chat-fixed {
    display: none !important;
}


/* =========================
   Страница заданий — макет с чатом
   ========================= */

.theme-layout {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 10px;
    gap: 10px;
    z-index: 2;
    position: relative;
    width: calc(100% - 20px);
    box-sizing: border-box;
}

/* Колонка с заданиями — точно как main-content */
.theme-tasks-col {
    display: block;
    text-align: left;
    color: white;
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: var(--color-shadow);
    border-radius: var(--radius-main);
    transition: var(--transition-main);
    position: relative;
    padding: 30px;
    max-width: 1100px;
    width: calc(100% - 20px);
    box-sizing: border-box;
}

/* Боковая панель чата — прозрачная оболочка */
.theme-chat-panel {
    width: 400px;
    min-width: 400px;
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    box-sizing: border-box;
    padding: 8px;
    display: none;
    position: sticky;
    top: 120px;
    align-self: flex-start;
    height: calc(100vh - 150px);
}
.theme-layout.chat-open .theme-chat-panel {
    display: block;
}
.history-layout.chat-open .theme-chat-panel {
    display: block;
}
.history-layout.chat-open {
    max-width: 1710px;
}

/* Белый внутренний блок чата */
.theme-chat-inner {
    background: var(--color-bg-main);
    border-radius: calc(var(--radius-main) - 4px);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}
.chat-header-title {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.1em;
    color: rgba(19, 49, 108, 1);
}
.chat-header-titles {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.chat-header-sub {
    font-family: var(--font-main);
    font-size: 0.78em;
    font-weight: 600;
    color: rgba(54, 120, 168, 0.9);
    margin-top: 2px;
}
/* Индикатор набора текста в боковой панели */
.chat-typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 4px 2px;
}
.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(54, 120, 168, 0.6);
    animation: chatTypingBounce 1.2s infinite ease-in-out both;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Ряд действий на карточке задания — внизу левой колонки, вровень с низом картинки */
.task-actions {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.task-actions a.action-btn {
    margin-top: 0;
}

/* Кнопка «Разобрать с ИИ» — в стиле кнопки «Решение», с градиентом платформы */
.ai-explain-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    min-height: 38px;
    font-family: 'MainFont';
    font-size: 1em;
    line-height: 1.1;
    font-weight: 800;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 18px;
    cursor: pointer;
    white-space: nowrap;
    background: linear-gradient(110deg, #4a2bbd 0%, #583eb5 50%, #2a1b8f 100%);
    background-size: 200% 100%;
    box-shadow: 0 2px 8px rgba(19, 49, 108, 0.25);
    animation: aiShimmer 6s ease-in-out infinite;
    transition: var(--transition-fast);
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
}
.ai-explain-btn:hover {
    filter: brightness(1.08);
    outline: 2px solid rgba(19, 49, 108, 0.35);
}
.ai-explain-btn:active { filter: brightness(0.97); }
/* Мягкое перетекание градиента — только фон, на раскладку не влияет */
@keyframes aiShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
/* Иконка-звёздочка: статична по центру, вокруг мягко мерцают маленькие звёзды */
.ai-spark-ico {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
.ai-spark-ico svg { display: block; }
.ai-spark-ico::before,
.ai-spark-ico::after {
    content: "\2726";
    position: absolute;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    animation: aiTwinkle 2.6s ease-in-out infinite;
}
.ai-spark-ico::before { top: -5px; right: -6px; font-size: 8px; animation-delay: 0s; }
.ai-spark-ico::after { bottom: -4px; left: -6px; font-size: 6px; animation-delay: 1.3s; }
@keyframes aiTwinkle {
    0%, 100% { opacity: 0; transform: scale(0.4); }
    50% { opacity: 0.95; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .ai-explain-btn { animation: none; }
    .ai-spark-ico::before, .ai-spark-ico::after { animation: none; opacity: 0; }
}

/* Быстрые кнопки-подсказки (чипы) под интро-сообщением */
.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 4px;
}
.chat-chip {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.85em;
    color: rgba(19, 49, 108, 1);
    background: #eef3f8;
    border: 1px solid rgba(54, 120, 168, 0.35);
    border-radius: 16px;
    padding: 6px 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.chat-chip:hover {
    background: #fff;
    border-color: rgba(19, 49, 108, 0.8);
}

/* Markdown внутри чат-пузырей (боковая панель и страница чат-бота) */
.chat-bubble-text ul, .cb-bubble-text ul,
.chat-bubble-text ol, .cb-bubble-text ol {
    margin: 6px 0;
    padding-left: 22px;
}
.chat-bubble-text li, .cb-bubble-text li { margin: 3px 0; }
.chat-bubble-text p, .cb-bubble-text p { margin: 6px 0; }
.chat-bubble-text p:first-child, .cb-bubble-text p:first-child { margin-top: 0; }
.chat-bubble-text p:last-child, .cb-bubble-text p:last-child { margin-bottom: 0; }
.chat-bubble-text h1, .chat-bubble-text h2, .chat-bubble-text h3, .chat-bubble-text h4,
.cb-bubble-text h1, .cb-bubble-text h2, .cb-bubble-text h3, .cb-bubble-text h4 {
    font-size: 1.03em;
    font-weight: 800;
    margin: 10px 0 4px;
    text-align: left;
}
.chat-bubble-text code, .cb-bubble-text code {
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 5px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.9em;
}
.cb-bubble-text code { background: rgba(255, 255, 255, 0.15); }
.chat-bubble-text pre, .cb-bubble-text pre {
    background: rgba(0, 0, 0, 0.08);
    padding: 8px 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 6px 0;
}
.cb-bubble-text pre { background: rgba(255, 255, 255, 0.12); }
.chat-bubble-text pre code, .cb-bubble-text pre code { background: none; padding: 0; }
.chat-bubble-text blockquote, .cb-bubble-text blockquote {
    border-left: 3px solid rgba(54, 120, 168, 0.5);
    margin: 6px 0;
    padding: 2px 0 2px 10px;
    opacity: 0.92;
}
.chat-bubble-text table, .cb-bubble-text table {
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 0.92em;
}
.chat-bubble-text th, .chat-bubble-text td,
.cb-bubble-text th, .cb-bubble-text td {
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 4px 8px;
}
.cb-bubble-text th, .cb-bubble-text td { border-color: rgba(255, 255, 255, 0.2); }
.chat-img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 340px;
    margin: 8px auto;
    border-radius: 10px;
    background: #fff;
    padding: 6px;
    box-sizing: border-box;
    cursor: zoom-in;
}

.chat-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(19, 49, 108, 0.5);
    border-radius: 10px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.chat-close-btn:hover {
    color: rgba(19, 49, 108, 1);
    background: rgba(0, 0, 0, 0.05);
}

/* Messages area */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Bubbles */
.chat-bubble {
    max-width: 92%;
    padding: 10px 14px;
    border-radius: 16px;
    font-family: var(--font-main);
    font-size: 0.9em;
    line-height: 1.55;
}
.chat-bubble-user {
    align-self: flex-end;
    background: var(--color-btn-gradient);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble-ai {
    align-self: flex-start;
    background: #f0f2f5;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}
.chat-bubble-label {
    font-weight: 800;
    font-size: 0.78em;
    margin-bottom: 3px;
    opacity: 0.65;
}
.chat-bubble-user .chat-bubble-label {
    color: rgba(255, 255, 255, 0.8);
}
.chat-bubble-text {
    word-wrap: break-word;
}

.chat-bubble-text a,
.cb-bubble-text a,
.sp-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 7px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(112,87,255,0.26));
    border: 1px solid rgba(255,255,255,0.28);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 6px 18px rgba(34, 28, 92, 0.18);
    transition: var(--transition-fast);
}
.chat-bubble-text a:hover,
.cb-bubble-text a:hover,
.sp-cta-link:hover,
.chat-bubble-text a:focus,
.cb-bubble-text a:focus,
.sp-cta-link:focus,
.chat-bubble-text a:active,
.cb-bubble-text a:active,
.sp-cta-link:active,
.chat-bubble-text a:visited,
.cb-bubble-text a:visited,
.sp-cta-link:visited {
    color: #fff;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(92,72,214,0.34));
    border-color: rgba(255,255,255,0.38);
    outline: none;
}

/* Вторичная ссылка-заглушки — чуть приглушённая */
.sp-cta-link--ghost {
    background: rgba(255,255,255,0.06);
    box-shadow: none;
    font-weight: 600;
}
.sp-cta-link--ghost:hover,
.sp-cta-link--ghost:focus,
.sp-cta-link--ghost:active {
    background: rgba(255,255,255,0.12);
}

/* Ссылки внутри светлых чат-пузырей (виджет в заданиях/истории) */
.chat-bubble-ai .chat-bubble-text a {
    background: var(--color-btn-gradient);
    border-color: rgba(74, 43, 189, 0.45);
    box-shadow: 0 4px 14px rgba(34, 28, 92, 0.28);
}
.chat-bubble-ai .chat-bubble-text a:hover,
.chat-bubble-ai .chat-bubble-text a:focus,
.chat-bubble-ai .chat-bubble-text a:active,
.chat-bubble-ai .chat-bubble-text a:visited {
    background: linear-gradient(to right, #3a1ba8, #1f0d82);
    border-color: rgba(74, 43, 189, 0.6);
    color: #fff;
}

/* Знаки препинания, перенесённые внутрь блока KaTeX */
.katex-no-break {
    white-space: nowrap;
    display: inline;
}

/* Input bar */
.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    font-family: var(--font-main);
    font-size: 0.92em;
    padding: 9px 12px;
    border: 2px solid #ddd;
    border-radius: var(--radius-main);
    outline: none;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.2s;
}
.chat-input::placeholder {
    color: #aaa;
}
.chat-input:focus {
    border-color: rgba(19, 49, 108, 0.6);
    border-radius: var(--radius-main);
}
.chat-send-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: var(--color-btn-gradient);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-fast);
}
.chat-send-btn:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* =========================
   Чат-бот: typing indicator
   ========================= */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 20px;
    padding: 2px 0;
}
.chat-typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(19, 49, 108, 0.45);
    animation: chatTypingBounce 1.2s infinite ease-in-out;
}
.chat-typing-dot:nth-child(1) { animation-delay: 0s; }
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* =========================
   Чат-бот: отдельная страница (старые стили — устарело)
   ========================= */
.chatbot-fullpage {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 400px;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.chatbot-fullpage-inner {
    background: var(--color-bg-main);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.chatbot-fullpage .chat-messages {
    flex: 1;
    overflow-y: auto;
}
.chatbot-fullpage .chat-header {
    border-radius: var(--radius-main) var(--radius-main) 0 0;
}
.chatbot-fullpage .chat-input-bar {
    border-radius: 0 0 var(--radius-main) var(--radius-main);
}
@media (max-width: 768px) {
    .chatbot-fullpage {
        height: calc(100vh - 140px);
    }
}

/* ================================================
   Чат-бот: полноэкранная страница (Copilot-стиль)
   ================================================ */

/* --- Корневой контейнер --- */
.cb-page {
    position: fixed;
    inset: 0;
    /* Высота по реально видимой области: при открытии клавиатуры контейнер
       ужимается над ней, а не уезжает за экран (см. scripts/viewport.js). */
    height: var(--vvh, 100dvh);
    bottom: auto;
    display: flex;
    z-index: 3;
    overflow: hidden;
    font-family: var(--font-main);
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(70px);
    -webkit-backdrop-filter: blur(70px);
}

/* Хедер на странице чат-бота: убираем свою прозрачность,
   чтобы визуально хедер сливался с подложкой cb-page */
header.cb-header-blend {
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

/* Настройки диалога (шестерёнка) на странице чат-бота */
/* ===== Индикатор «заряда ИИ» (аккумулятор с процентом внутри + плашка) ===== */
.ai-energy {
    position: relative;
    display: inline-flex;
    align-items: center;
    user-select: none;
    color: #30b86a;
}
.ai-energy.is-medium  { color: #e8a830; }
.ai-energy.is-low     { color: #e05828; }
.ai-energy.is-critical{ color: #b52020; }
.ai-energy.is-empty   { color: #9ca3af; }

.ai-energy-trigger {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    margin: -4px;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

/* Корпус батарейки — чёткая рамка, как на телефоне */
.ai-energy-battery {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    width: 46px;
    height: 22px;
    padding: 2px;
    border-radius: 6px;
    background: #ffffff;
    border: 1.5px solid rgba(17, 24, 39, 0.25);
    vertical-align: middle;
}

/* Кончик — нейтральный серый, всегда виден */
.ai-energy-battery::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid rgba(17, 24, 39, 0.25);
    border-left: none;
    border-radius: 0 4px 4px 0;
    box-sizing: border-box;
}

/* Внутренняя область — чуть затемнённый фон для пустой части */
.ai-energy-body {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(17, 24, 39, 0.05);
    isolation: isolate;
}

/* Заливка — цвет берётся из .ai-energy */
.ai-energy-fill {
    position: absolute;
    display: block;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(var(--p, 0) * 1%);
    background: currentColor;
    border-radius: 2px;
    transition: width 0.5s ease;
    z-index: 0;
}

/* Цифра по центру — читается на любом фоне */
.ai-energy-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    z-index: 1;
    color: #1c2438;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.95);
}
.ai-energy-num--fill { display: none; }

/* Пустая батарейка (0%) — диагональная черта, числа скрыты */
.ai-energy.is-empty .ai-energy-fill { display: none; }
.ai-energy.is-empty .ai-energy-num  { display: none; }
.ai-energy.is-empty .ai-energy-battery {
    border-color: rgba(176, 32, 32, 0.5);
}
.ai-energy.is-empty .ai-energy-battery::after {
    background: rgba(176, 32, 32, 0.4);
}
.ai-energy.is-empty .ai-energy-battery::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        to bottom right,
        transparent calc(50% - 1.3px),
        rgba(176, 32, 32, 0.80) calc(50% - 1.3px),
        rgba(176, 32, 32, 0.80) calc(50% + 1.3px),
        transparent calc(50% + 1.3px)
    );
    border-radius: 3px;
    z-index: 2;
    pointer-events: none;
}

.ai-energy-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 232px;
    padding: 14px 16px 15px;
    background: #fff;
    color: #1f2a44;
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(19, 35, 68, 0.22);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    text-align: left;
}
.ai-energy-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 18px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    border-radius: 2px 0 0 0;
}
.ai-energy.is-open .ai-energy-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.ai-energy-pop-close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 8px;
    background: none;
    color: #9aa4b6;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.ai-energy-pop-close:hover { background: #f0f3f9; color: #56617a; }
.ai-energy-pop-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #6b7793;
    margin-bottom: 4px;
}
.ai-energy-pop-big {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
}
.ai-energy-pop-p {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
    color: currentColor;
}
.ai-energy-pop-unit { font-size: 0.8rem; color: #8a94a8; }
.ai-energy-pop-plan-row {
    font-size: 0.86rem;
    color: #34405c;
    margin-bottom: 8px;
}
.ai-energy-pop-plan { font-weight: 700; }
.ai-energy-pop-note {
    font-size: 0.76rem;
    line-height: 1.4;
    color: #8a94a8;
}

/* На странице чат-бота — в верхней панели, слева */
.cb-energy {
    position: relative;
    z-index: 7;
    flex-shrink: 0;
}
/* В боковой панели — компактнее, в шапке чата */
.chat-energy { margin-left: auto; margin-right: 10px; }
.chat-energy .ai-energy-battery { width: 40px; height: 19px; }
.chat-energy .ai-energy-num { font-size: 11.5px; }
.chat-energy .ai-energy-popover { left: auto; right: 0; transform-origin: top right; }
.chat-energy .ai-energy-popover::before { left: auto; right: 18px; }

/* Верхняя панель страницы чат-бота: заряд слева, настройки справа.
   Плавает поверх ленты сообщений; сама панель кликов не перехватывает —
   только её контролы, чтобы сообщения под градиентной маской оставались доступны. */
.cb-topbar {
    position: absolute;
    top: 90px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 24px 8px;
    z-index: 7;
    pointer-events: none;
}
.cb-topbar > * {
    pointer-events: auto;
}

.cb-settings {
    position: relative;
    z-index: 6;
    flex-shrink: 0;
}
.cb-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: var(--transition-fast);
}
.cb-settings-btn:hover { background: rgba(255, 255, 255, 0.22); }
.cb-settings-menu {
    position: absolute;
    top: 48px;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--color-shadow);
    padding: 6px;
    min-width: 190px;
    z-index: 20;
}
.cb-settings-menu[hidden] { display: none; }
.cb-clear-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.9em;
    color: #c0392b;
    padding: 10px 12px;
    border-radius: 8px;
    transition: var(--transition-fast);
}
.cb-clear-btn:hover { background: #fdecea; }
@media (max-width: 768px) {
    .cb-topbar { padding: 4px 14px 6px; }
}

/* --- Сайдбар --- */
.cb-sidebar {
    width: 260px;
    min-width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: rgba(17, 13, 58, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.3s;
    overflow: hidden;
    z-index: 5;
    padding-top: 90px;
}

.cb-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Верхняя часть: кнопка "Новый чат" */
.cb-sidebar-top {
    flex-shrink: 0;
    padding: 12px 8px 4px;
}

.cb-new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 14px;
    background: transparent;
    color: #fff;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.cb-new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.cb-new-chat-btn:active {
    background: rgba(255, 255, 255, 0.15);
}
.cb-new-chat-btn svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Список бесед */
.cb-conversations {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.cb-conversations::-webkit-scrollbar { width: 4px; }
.cb-conversations::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.cb-conv-section-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    padding: 14px 14px 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cb-conv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.85);
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}
.cb-conv-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.cb-conv-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 600;
}

/* Кнопка-тоггл сайдбара (мобилки) */
.cb-sidebar-toggle {
    display: none;
    position: fixed;
    top: 100px;
    left: 14px;
    z-index: 12;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.cb-sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Мобильный бэкдроп */
.cb-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 4;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
}
.cb-sidebar-backdrop.visible {
    display: block;
    opacity: 1;
}

/* --- Основная область --- */
.cb-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    padding-top: 90px;
    box-sizing: border-box;
}

/* --- Область сообщений --- */
.cb-messages-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Верхний отступ = высота бара. Маска из двух слоёв:
       1) вертикальный градиент — сообщения плавно тают под баром;
       2) сплошная полоса справа (10px) держит скроллбар НАД маской. */
    padding: 56px 0 0;
    -webkit-mask-image:
        linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.55) 22px, #000 56px),
        linear-gradient(to left, #000 10px, transparent 10px);
    -webkit-mask-composite: source-over;
    mask-image:
        linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.55) 22px, #000 56px),
        linear-gradient(to left, #000 10px, transparent 10px);
    mask-composite: add;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.cb-messages-wrap::-webkit-scrollbar { width: 6px; }
.cb-messages-wrap::-webkit-scrollbar-track { background: transparent; }
.cb-messages-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.cb-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 24px 10px;
    min-height: 100%;
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/*
 * Приветственное состояние (без сообщений):
 * приветствие с плитками центрируется по вертикали в области сообщений,
 * поле ввода остаётся внизу. После первого сообщения JS добавит .cb-has-messages.
 */
.cb-main:not(.cb-has-messages) .cb-messages {
    justify-content: center;
}

/* Приветственный экран */
.cb-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 20px 30px;
}

.cb-welcome-icon {
    margin-bottom: 20px;
}
/* Звёздочки — белые, с плавным независимым «парением» вверх-вниз */
.cb-star {
    fill: #fff;
    transform-box: fill-box;
    transform-origin: center;
}
.cb-star--1 { animation: cbStarFloat1 3.4s ease-in-out infinite; }
.cb-star--2 { animation: cbStarFloat2 2.3s ease-in-out infinite; }
@keyframes cbStarFloat1 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes cbStarFloat2 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.cb-welcome-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.3;
}

.cb-welcome-subtitle {
    font-size: 1rem;
    color: #fff;
    margin: 0;
}

/* --- Плитки быстрого старта на приветственном экране --- */
.cb-suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 620px;
    margin: 28px auto 0;
}
.cb-suggest-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    cursor: pointer;
    font-family: var(--font-main);
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.cb-suggest-card:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-2px);
}
.cb-suggest-card:active {
    transform: translateY(0);
}
.cb-suggest-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    flex-shrink: 0;
}
.cb-suggest-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
}
.cb-suggest-desc {
    font-size: 0.83rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.72);
}
@media (max-width: 600px) {
    .cb-suggestions {
        max-width: 440px;
        gap: 8px;
        margin-top: 18px;
    }
    .cb-suggest-card {
        padding: 11px 12px;
        gap: 6px;
        border-radius: 15px;
    }
    .cb-suggest-icon {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }
    .cb-suggest-icon svg {
        width: 18px;
        height: 18px;
    }
    .cb-suggest-title {
        font-size: 0.86rem;
    }
    .cb-suggest-desc {
        font-size: 0.72rem;
        line-height: 1.32;
    }
}

/* --- Пузыри сообщений --- */
.cb-bubble {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 0.94rem;
    line-height: 1.65;
    color: #fff;
    word-wrap: break-word;
    animation: cbBubbleIn 0.3s ease-out;
}
@keyframes cbBubbleIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cb-bubble-user {
    align-self: flex-end;
    background: var(--color-btn-gradient);
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 12px rgba(19, 49, 108, 0.25);
}

.cb-bubble-ai {
    align-self: flex-start;
    background: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}

.cb-bubble-label {
    font-weight: 800;
    font-size: 0.75rem;
    margin-bottom: 4px;
    opacity: 0.6;
    color: rgba(255, 255, 255, 0.7);
}

.cb-bubble-text {
    word-break: break-word;
}

/* Typing indicator */
.cb-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    padding: 2px 0;
}
.cb-typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    animation: cbTypingBounce 1.2s infinite ease-in-out;
}
.cb-typing-dot:nth-child(1) { animation-delay: 0s; }
.cb-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cb-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes cbTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-7px); opacity: 1; }
}

/* --- Composer area (поле ввода + дисклеймер) --- */
.cb-composer-area {
    flex-shrink: 0;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.cb-composer-wrap {
    flex-shrink: 0;
    padding: 6px 16px 0;
}

.cb-composer {
    max-width: 780px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    transition: border-color 0.3s;
}
.cb-composer:focus-within {
    border-color: rgba(255, 255, 255, 0.25);
}

.cb-composer-inner {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px 10px 20px;
}

.cb-textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent !important;
    font-family: var(--font-main);
    font-size: 0.95rem;
    line-height: 1.5;
    color: #fff;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    padding: 6px 0;
    scrollbar-width: none;
}
.cb-textarea:focus,
.cb-textarea:active {
    background: transparent !important;
}
.cb-textarea::-webkit-scrollbar { display: none; }
.cb-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.cb-composer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding-bottom: 2px;
}

.cb-send-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--color-btn-gradient);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
}
.cb-send-btn:hover:not(:disabled) {
    opacity: 0.85;
    transform: scale(1.08);
}
.cb-send-btn:disabled {
    opacity: 0.35;
    cursor: default;
    transform: none;
}

/* Дисклеймер (под полем ввода) */
.cb-disclaimer {
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.35);
    padding: 6px 24px 14px;
    flex-shrink: 0;
}

/* --- Адаптивность --- */

/* Планшет: скрываем сайдбар, показываем тоггл */
@media (max-width: 900px) {
    .cb-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 11;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
        background: rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    .cb-sidebar.open {
        transform: translateX(0);
    }
    .cb-sidebar-toggle {
        display: flex;
    }
    .cb-main {
        width: 100%;
    }
}

/* Мобилка */
@media (max-width: 600px) {
    .cb-welcome-title {
        font-size: 1.35rem;
    }
    .cb-welcome-subtitle {
        font-size: 0.9rem;
    }
    .cb-messages {
        padding: 20px 12px 10px;
    }
    .cb-composer-wrap {
        padding: 6px 10px 0;
    }
    .cb-composer-inner {
        padding: 8px 10px 8px 16px;
    }
    .cb-bubble {
        max-width: 92%;
        padding: 12px 14px;
        border-radius: 16px;
    }
    .cb-sidebar-toggle {
        top: 96px;
        left: 10px;
    }
}

/* Мобильная адаптация чата */
@media (max-width: 900px) {
    .theme-layout {
        flex-direction: column;
        align-items: center;
    }
    .theme-layout.chat-open,
    .history-layout.chat-open {
        z-index: 10001;
    }
    .theme-layout.chat-open .theme-chat-panel,
    .history-layout.chat-open .theme-chat-panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        min-width: unset;
        border-radius: 0;
        z-index: 10001;
        padding: 0;
        margin: 0;
    }
    .theme-layout.chat-open .theme-chat-inner,
    .history-layout.chat-open .theme-chat-inner {
        border-radius: 0;
    }
    .theme-layout.chat-open .chat-input-bar,
    .history-layout.chat-open .chat-input-bar {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    /* На мобилке btn-up не сдвигаем — чат поверх всего */
    body.theme-chat-active .btn-up {
        right: 20px;
    }
}


/* =========================
   Базовые сбросы и фон
   ========================= */

html,
body {
    font-family: var(--font-main);
    background: none;
    margin: 0;
    padding: 0;
    border: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Отключаем синюю/серую подсветку тапа на Android и iOS — кнопки и ссылки
       и так анимированы, системная подсветка только мешает. (Свойство
       наследуется, поэтому действует на все вложенные элементы.) */
    -webkit-tap-highlight-color: transparent;
}

a,
button,
input,
label,
.menu-button,
.custom-button-menu,
.custom-button-menu_mini {
    -webkit-tap-highlight-color: transparent;
}

/* Текст в кнопках и кнопках-ссылках не должен выделяться — выделение мешает и
   не несёт смысла (кнопки и так анимированы при нажатии). Поля ввода (input,
   textarea) и contenteditable НАМЕРЕННО исключены — там выделение нужно. */
button,
.menu-button,
.action-btn,
.sp-cta-link,
.ai-explain-btn,
.custom-button-menu,
.custom-button-menu_mini,
.button,
input[type="submit"],
input[type="button"],
.error-page__code,
.error-page__illustration,
.error-page__illustration svg {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Базовый тёмно-фиолетовый цвет под фоном: страхует от белой полосы, когда
   на мобильных прячется панель браузера и фикс-фон на мгновение не успевает
   перекрыть открывшуюся область внизу. */
html {
    background-color: rgb(114, 47, 186);
}

html::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* Растягиваем фон на наибольшую возможную высоту вьюпорта (с убранными
     панелями браузера), чтобы при их скрытии не появлялась белая полоса снизу. */
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  background-image: url("resources/background.svg");
  background-position: center center;
  transform: scale(1.02);
  background-repeat: no-repeat;
  background-size: cover;
}

html::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body {
    padding-top: 90px;
}

p {
    margin: 0;
}

a {
    text-decoration: none;
}


/* =========================
   Header & Навигация
   ========================= */

header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    font-size: 20px;
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    background-color: rgba(0, 0, 0, 0.2);
    box-shadow: var(--color-shadow);
    z-index: 5;
    /* Блюр/фон переключаем мгновенно (без transition) — иначе при открытии/
       закрытии гамбургер-меню хедер на 0.2s плавно терял блюр и сквозь него
       просвечивали нижние элементы. Анимируем только тень. */
    transition: box-shadow 0.2s ease;
}

/* Когда открыто гамбургер-меню, хедер становится полностью прозрачным (без
   собственного блюра и фона). Единую «морозную» поверхность для всей полосы
   (хедер + список ссылок) рисует само меню: оно теперь начинается от top:0 и
   уходит ВНИЗ за хедер, с padding-top = высоте хедера (см. .menu и menu.js).
   Контент хедера (z-index 5) лежит поверх блюра меню (z-index 4). Так нет двух
   отдельных блюр-поверхностей → нет шва/«полоски» на стыке, выглядит так, будто
   хедер просто расширился вниз. Переключение мгновенное (у хедера убрана
   transition блюра/фона) → нет просвечивания нижних элементов. */
header.menu-open {
    box-shadow: none;
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Левая часть хедера */
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Таймер варианта в хедере */
.header-timer {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 1);
    backdrop-filter: blur(10px);
    padding: 5px 14px;
    border-radius: 14px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}
.header-timer-icon {
    flex-shrink: 0;
    color: #13316c;
}
.header-timer-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 500;
    color: #13316c;
    letter-spacing: 0.3px;
}
.header-timer--warning .header-timer-text,
.header-timer--warning .header-timer-icon {
    color: #e67e00;
}
.header-timer--danger .header-timer-text,
.header-timer--danger .header-timer-icon {
    color: #d32f2f;
}

#logo {
    display: flex;
    align-items: center;
}
#logo img {
    max-height: 54px;
}

.menu-icon {
    display: none;
    border-radius: 10px;
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    outline: var(--color-outline-menu);
    background: var(--color-bg-menu-link);
    backdrop-filter: blur(50px);
    transition: var(--transition-main);
}
.menu-icon:hover {
    outline: var(--color-outline-menu-hover);
    background: var(--color-bg-menu-link-hover);
}
.menu-icon img {
    box-sizing: border-box;
    height: 26px;
}
nav ul,
.menu nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 12px;
}

nav li,
.menu nav li {
    margin: 0;
}

.nav a,
.menu nav a,
.header-menu nav ul li a {
    font-weight: 800;
    color: white;
    text-decoration: none;
    position: relative;
    display: inline-block;
    padding-bottom: 3px;
    transition: var(--transition-main);
}

.menu nav li:last-child {
    margin-bottom: 20px;
}

.menu,
.menu nav ul {
    display: none;
}

.menu {
    position: fixed;
    /* Меню — ЕДИНАЯ блюр-поверхность на всю верхнюю полосу: начинается от самого
       верха (top:0) и уходит за хедер. padding-top (= высоте хедера) задаётся в
       menu.js, чтобы ссылки начинались под хедером, а блюр был непрерывным сверху
       донизу. Хедер при открытом меню прозрачен (см. header.menu-open) и лежит
       поверх (z-index 5 > 4), поэтому шва/«полоски» между блюрами больше нет. */
    top: 0;
    left: 0;
    width: 100%;
    font-size: 30px;
    color: black;
    background: var(--color-bg-menu);
    /* Без собственной тени — тень давала видимую линию на стыке с хедером. */
    box-shadow: none;
    z-index: 4;
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    background-color: rgba(0, 0, 0, 0.2);
}

.menu nav ul {
    display: block;
    margin-top: 14px;
}

.menu nav li {
    margin: 0 20px 10px 20px;
}

.header-menu nav ul li a {
    border-radius: 10px;
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    outline: var(--color-outline-menu);
    background: var(--color-bg-menu-link);
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    transition: var(--transition-main);
}

/* Ссылки в выпадающем меню НЕ блюрят сами по себе: панель меню уже размыта,
   а дополнительный backdrop-filter на каждой ссылке давал многослойное
   («двойное») размытие и грязный вид. */
.menu nav ul li a {
    border-radius: 10px;
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    outline: var(--color-outline-menu);
    background: var(--color-bg-menu-link);
    transition: var(--transition-main);
}

.header-menu nav ul li a:hover,
.menu nav ul li a:hover {
    outline: var(--color-outline-menu-hover);
    background: var(--color-bg-menu-link-hover);
}


/* =========================
   Медиа-запросы для меню
   ========================= */

@media (max-width: 799px) {
    header nav {
        display: none;
    }
    .menu-icon {
        display: flex;
    }
}

@media (min-width: 800px) {
    .menu {
        display: none !important;
    }
}


/* =========================
   Hero-секция
   ========================= */

.hero {
    color: black;
    text-align: left;
    width: 100%;
    height: calc(100vh - 100px);
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 90px;
    z-index: 1;
}

.centralized-feedback {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    /* Центрируем по центру ОКНА, а не области под хедером: отрицательный
       margin-top компенсирует padding-top:90px у body, поэтому сверху не
       остаётся лишнего отступа. min-height позволяет прокрутку, если контент
       выше окна. */
    min-height: 100dvh;
    margin-top: -90px;
    box-sizing: border-box;
    padding: 20px 0;
    max-width: 1100px;
}

.centralized-authorization {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    /* Центрирование по центру окна (без верхнего отступа) — см. комментарий выше. */
    min-height: 100dvh;
    margin-top: -90px;
    box-sizing: border-box;
    padding: 20px 0;
    max-width: 500px;
}

@media (min-width: 769px) {
    .centralized-authorization,
    .centralized-feedback {
        /* На десктопе центрируем блок относительно доступного места под хедером,
           не создавая лишней высоты и не всплывая скроллом. */
        min-height: calc(100dvh - 90px);
        height: calc(100dvh - 90px);
        margin-top: 0;
        padding: 0;
    }
}

/* Когда высота окна мала (открыта экранная клавиатура на мобильном или
   низкий ландшафт) — не центрируем, а показываем форму от верха под хедером
   и даём прокрутку, чтобы все поля и подписи были доступны и не прятались
   под хедером. При закрытии клавиатуры высота возвращается → снова центр. */
@media (max-height: 640px) {
    .centralized-authorization,
    .centralized-feedback {
        margin-top: 0;
        min-height: calc(100dvh - 90px);
        justify-content: flex-start;
        padding: 10px 0 24px;
    }
}


/* =========================
   Центрирование элементов
   ========================= */

.center-flex {
    display: flex;
    justify-content: center;
    align-items: center;
}


/* =========================
   Новости, даты, лейблы
   ========================= */

.newsTime,
time.newsTime {
    font-size: 14px;
    margin-bottom: 18px;
    display: block;
}

/* Меньший шрифт для навигационной даты в новостях */
.news-nav-date {
    font-size: 12px;
    color: inherit;
}

.label {
    font-family: var(--font-links);
    font-weight: 800;
}

dl {
    margin: 0 0 20px 0;
}

dt {
    margin-top: 10px;
}

dd {
    margin-left: 20px;
}


/* =========================
   Формы и ссылки
   ========================= */

.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-row .input-container,
.form-row .eye-container {
    width: 100%;
    margin-top: 4px;
    display: block;
}

.form-row:last-child {
    margin-bottom: 0;
}

.register-link {
    display: block;
    color: white;
    text-decoration: none;
    margin-top: 20px;
    text-align: center;
}


/* =========================
   Основные блоки контента
   ========================= */

#content {
    display: flex;
    justify-content: center;
    /* width:100% (а не 100vw): 100vw игнорирует вертикальный скроллбар и даёт
       горизонтальный сдвиг/несимметричные поля (слева уже, справа шире).
       100% учитывает реальную ширину и держит карточку строго по центру. */
    width: 100%;
}

.main-content {
    display: block;
    text-align: left;
    color: white;
    background: var(--color-bg-main);
    box-shadow: var(--color-shadow);
    border-radius: var(--radius-main);
    transition: var(--transition-main);
    position: relative;
    padding: 30px;
    margin: 30px auto 10px auto;
    z-index: 2;
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(30px);
    max-width: 1100px;
    width: calc(100% - 20px);
    box-sizing: border-box;
}

.main-content label{
    color: black;
}

.main-content--white {
    color: rgb(0, 0, 0);
    backdrop-filter: unset;
    background-color: #ffffff;
    overflow: hidden;
}
.main-content--white > div {
    position: relative;
    padding: 15px 45px;
    margin-left: -30px;
    margin-right: -30px;
    box-sizing: border-box;
    overflow: hidden;
  }
.main-content--white > div:nth-child(even) {
    background-color: #F2F2F2;
  }

.slogan-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0px 0px 30px !important;
}
.slogan-block::before,
.slogan-block::after {
    content: '';
    width: 180px;
    height: 1px;
    background: linear-gradient(to var(--dir, right), transparent, rgba(19, 49, 108, 0.20));
    flex: none;
}
.slogan-block::before {
    margin-bottom: 22px;
    --dir: right;
    /* fade from center outward — right edge fades out, actually let's do center-line fade */
    background: linear-gradient(to right, transparent, rgba(88, 60, 168, 0.35), transparent);
    width: 260px;
}
.slogan-block::after {
    margin-top: 22px;
    background: linear-gradient(to right, transparent, rgba(88, 60, 168, 0.35), transparent);
    width: 260px;
}
.slogan-block .slogan-text {
    font-size: 26px !important;
    font-weight: 700;
    font-style: normal;
    background: linear-gradient(120deg, #13316c 0%, #5f2f9e 55%, #980d5f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.03em;
    text-align: center;
    white-space: nowrap;
    position: relative;
}
/* звёздочки-акценты по бокам */
.slogan-text::before,
.slogan-text::after {
    content: '✦';
    font-size: 14px;
    font-style: normal;
    -webkit-text-fill-color: rgba(88, 60, 168, 0.45);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.slogan-text::before { right: calc(100% + 14px); }
.slogan-text::after  { left:  calc(100% + 14px); }

@media (max-width: 768px) {
    .slogan-block {
        padding-bottom: 18px !important;
    }
    .slogan-block::before,
    .slogan-block::after {
        width: 96px;
    }
    .slogan-block .slogan-text {
        font-size: clamp(18px, 5vw, 26px) !important;
        white-space: normal;
        line-height: 1.3;
        letter-spacing: 0.015em;
    }
    .slogan-text::before,
    .slogan-text::after {
        font-size: 11px;
    }
    .slogan-text::before { right: calc(100% + 6px); }
    .slogan-text::after  { left:  calc(100% + 6px); }
}

.authorization-content {
    max-width: 500px;
    box-sizing: border-box;
    margin: 30px;
    padding: 30px;
    color: white;
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    transition: all 0.2s;
}

.feedback {
    max-width: 1100px;
    box-sizing: border-box;
    margin: 30px;
    padding: 30px 60px;
    color: white;
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    transition: all 0.2s;
}

/* #newsForm removed — form is now in modal */

.card {
    display: block;
    text-align: left;
    margin-top: 25px;
    color: black;
    background: var(--color-bg-main);
    box-shadow: var(--color-shadow);
    border-radius: var(--radius-main);
    transition: var(--transition-main);
    position: relative;
    padding: 30px;
    z-index: 2;
}
.card:first-child {
    margin-top: 0px;
}
/* Первая карточка нового блока пагинации должна иметь тот же отступ, что и остальные */
.tasks-page + .tasks-page .card:first-child {
    margin-top: 25px;
}
article.blog-page.card {
    cursor: pointer;
}
.blog-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-top: 25px;
}
.blog-card-link:first-child {
    margin-top: 0;
}
.blog-card-link .card {
    margin-top: 0;
}
.blog-col2 {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.blog-col2 .newsTime {
    margin-top: 12px;
    margin-bottom: 0;
}
.news-article .col2 h2 {
    hyphens: auto;
    word-break: break-word;
}
.news-article .blog-text-rendered p {
    margin-top: 12px;
}
.news-edit-form label {
    margin-top: 10px;
}
.news-edit-form + div[id^="news-edit-actions"] {
    margin-top: 15px;
}

.main-content p,
.main-content li {
    font-size: 18px;
    hyphens: auto;
    transition: var(--transition-main);
}

.divForImg {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
}

.divForImg img {
    max-width: 100%;
    height: 300px;
    border-radius: var(--radius-main);
}

.review {
    padding: 20px;
    margin: 10px;
    outline: 1px solid rgba(0, 0, 0, 0.3);
}

.review:hover {
    outline: none;
    box-shadow: var(--color-shadow);
}

.photoInReview {
    display: flex;
    justify-content: center;
    align-items: center;
}

.photoInReview img {
    width: 100px;
    border-radius: 50%;
}


/* =========================
   Заголовки
   ========================= */

h1,
h2 {
    font-family: var(--font-links);
    font-weight: 800;
    transition: var(--transition-main);
    hyphens: auto;
}

h1 {
    text-align: center;
    font-size: 40px;
    margin: 0 0 25px 0;
}

h2 {
    text-align: left;
    font-size: 28px;
    margin: 0 0 0 0;
}

.h1main1 {
    font-weight: 800;
    text-align: center;
    font-size: calc(75px * 1.5);
    color: white;
    position: relative;
    margin-top: 0px;
    margin-bottom: 0px;
    transition: font-size 0.2s;
}

.h1main2 {
    text-align: center;
    font-family: var(--font-main);
    font-size: calc(30px * 1.5);
    color: white;
    position: relative;
    margin-top: 0px;
    margin-bottom: 35px;
    transition: font-size 0.2s;
}


.ai-star {
    width: calc(30px * 1.5);
    height: calc(30px * 1.5);
    position: absolute;
    top: -15px;
    right: -30px;
}


/* =========================
   SVG-логотип ExamenAI (замена текста+звезда)
   ========================= */

/* В хедере: сам текст ExamenAI должен быть по центру строки, а звезда просто
   выходит чуть выше и не участвует в вертикальном выравнивании. */
.header-logo-svg {
    height: 32px;
    width: auto;
    display: block;
    position: relative;
    top: -4px;
    margin-right: -10px;
}

/* На главной: центрируем весь логотип по тексту, а не по выступающей звезде. */
.hero-logo-wrapper {
    display: flex;
    justify-content: center;
}
.hero-logo-svg {
    height: 130px;
    width: auto;
    margin-right: -36px;
}

@media (max-width: 768px) {
    .header-logo-svg {
        height: 28px;
        margin-right: -8px;
    }

    .hero-logo-svg {
        height: 90px;
        margin-right: -20px;
    }
}



.coldiv,
article.coldiv,
.coldivOnMain {
    display: flex;
    gap: 20px;
}

.colDivLeftText {
    display: flex;
    flex-direction: row;
    margin-bottom: 25px;
}

.coldivOnMain>* {
    flex-basis: 50%;
}

.col1 {
    width: 450px;
}

.col1 p,
.col2 p {
    font-size: 18px;
    word-break: break-word;
}

.col2 {
    width: 100%;
}

.col2 h1,
.col1 h1 {
    font-family: var(--font-links);
    font-size: 28px;
    margin: 0 0 10px 0;
}

.coldiv-task {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 4px 10px;
}
.katex {
    font-size: 18px !important;
}
.coldiv-task:has(.col2-task:has(.task-image-container)),
.coldiv-task:has(.col2-task:has(#edit-text-image:not(.hidden))) {
    grid-template-columns: minmax(0, 1fr) 200px;
}

#text-image-col {
    display: none;
}

#text-image-col:has(.task-image-container),
#text-image-col:has(.view-text-image),
#text-image-col:has(#edit-text-image:not(.hidden)) {
    display: flex;
}

.col2-task:not(:has(.task-image-container)):not(:has(.img-edit-area)) {
    display: none;
}

.task-source {
    margin-top: 12px;
    margin-bottom: 0;
    text-align: left;
    font-size: 12px;
    color: #9aa0a6;
    font-style: italic;
    line-height: 1.3;
    word-break: break-word;
}

.col1-task {
    grid-column: 1;
    min-width: 0;
    font-size: 20px;
    font-family: var(--font-katex);
    line-height: 1.5;
}

.col2-task {
    grid-column: 2;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 200px;
    max-width: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Поле ответа на странице варианта */
.variant-answer {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
}
.variant-answer-label {
    font-weight: 800;
    white-space: nowrap;
    color: black;
}
.variant-answer-input {
    width: 180px;
    padding: 4px 10px;
    font-family: var(--font-main);
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.2s;
}
.variant-answer-input:focus {
    border-color: rgba(19, 49, 108, 0.6);
    border-radius: 12px;
    background: #fff;
}
.variant-answer--self {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    opacity: 0.5;
}

.img-in-cols {
    width: 100%;
    /* ширина блока адаптивна */
    padding-top: 56.25%;
    /* высота через padding для соотношения 16:9 */
    position: relative;
    /* для абсолютного позиционирования img */
    overflow: hidden;
    /* обрезка лишнего */
    border-radius: var(--radius-main);
}

.img-in-cols img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* масштабирование с обрезкой */
    display: block;
    /* убирает отступы */
    border-radius: var(--radius-main);
}


/* =========================
   Контакты
   ========================= */

.mapsInContacts {
    width: 50%;
    height: 300px;
    margin-bottom: 30px;
}

.mapsInContacts iframe {
    width: 100%;
    height: 300px;
    float: right;
}

.textInContacts {
    width: 100%;
}

.textInContacts h1 {
    text-align: left;
    margin-bottom: 0;
    max-width: 500px;
    font-size: 32px;
}

.textInContacts h2 {
    max-width: 500px;
    margin-top: 10px;
}


/* =========================
   Кнопки
   ========================= */

.button,
input[type="submit"] {
    display: block;
    font-weight: 800;
    width: auto;
    padding: 10px 20px 15px 20px;
    margin: 0 auto;
    margin-top: 30px;
    background: var(--color-btn-gradient);
    font-family: var(--font-links);
    text-align: center;
    color: white;
    font-size: 30px;
    text-decoration: none;
    outline: var(--color-outline-btn);
    border-radius: var(--radius-btn);
    box-sizing: border-box;
    border: 0;
    transform: none;
    transition: background-color 0.3s ease-in-out, outline-color 0.3s ease-in-out, outline-width 0.3s ease-in-out, border-radius 0.3s ease-in-out;
}

.button:hover,
input[type="submit"]:hover {
    outline: var(--color-outline-btn-hover);
    cursor: pointer;
    transform: none;
}

.button:focus,
input[type="submit"]:focus,
.button:active,
input[type="submit"]:active {
    background: var(--color-btn-gradient);
    color: white;
    border-radius: var(--radius-btn);
    outline: var(--color-outline-btn-hover);
    transform: none;
    /* Любые другие нужные тебе стили */
}

/* =========================
   Формы и поля
   ========================= */

input,
textarea {
    width: 100%;
    padding: 3px;
    box-sizing: border-box;
    font-family: var(--font-main);
    font-size: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    border: 1px solid grey;
    transition: var(--transition-fast);
}

textarea {
    height: 100px;
    resize: none;
}
article textarea {
    height: 200px;
}

input:focus,
textarea:focus {
    background: #fff;
    border-radius: 5px;
    outline: none;
}


/* =========================
   Iframe
   ========================= */

iframe {
    width: 100%;
    border: none;
    background: transparent;
}


/* =========================
   Списки с отступами
   ========================= */

.lis {
    text-indent: calc(-2em - 1px);
    padding-left: calc(3em - 13px);
}

.lis li {
    font-size: 25px;
    transition: var(--transition-main);
}


/* =========================
   Полоса прокрутки
   ========================= */

.scrollbar {
    position: fixed;
    top: 0;
    right: 0;
    width: 10px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    z-index: 99;
}

.scrollbar-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #888;
    border-radius: 5px;
    height: 20%;
    /* Задаем фиксированную высоту ползунка */
    opacity: 50%;
    transition: background-color 0.3s ease, border-radius 0.3s ease, opacity 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.scrollbar-thumb:hover {
    opacity: 80%
}

/* На мобильных делаем кастомный скроллбар тоньше — на узком экране 10px
   выглядят слишком массивно. */
@media (max-width: 768px) {
    .scrollbar {
        width: 4px;
    }
    .scrollbar-thumb {
        border-radius: 3px;
    }
}


/* =========================
   Выделение
   ========================= */

::selection {
    background-color: rgba(25, 130, 200, 0.8);
    /* Цвет фона выделенного текста */
    color: white;
    /* Цвет текста при выделении */
}

.no-select,
.no-select * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

.h1main1,
.h1main2,
.header-logo-title,
.ai-star,
.h1main1 *,
.h1main2 *,
.header-logo-title *,
.ai-star * {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* =========================
Оформление авторизации
========================= */

.input-field.invalid {
    border-color: red;
}
.input-field.valid {
    border-color: green;
}
.tooltip {
    display: none;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    color: #333;
    width: 200px;
    z-index: 5;
    cursor: pointer;
}
.tooltip::before {
    content: '!';
    color: red;
    font-weight: 800;
    margin-right: 5px;
}
.tooltip.visible {
    display: block;
}
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}
.eye-container {
    position: relative;
    display: flex;
    align-items: center;
}
.eye-container .toggle-password {
    position: absolute;
    cursor: pointer;
    z-index: 5;
    right: 10px;
    top: 55%;
    transform: translateY(-50%);
    transition: right 0.3s ease;
}
.eye-container .input-field.shifted + .toggle-password {
    right: 40px;
}
.eye-container .toggle-password img {
    width: 25px;
    height: 25px;
}
.eye-container .input-field {
    padding-right: 40px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.eye-container .input-field.shifted {
    padding-right: 70px;
}
.exclamation-container {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: #fff;
    border: 1px solid red;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 8;
}
.exclamation-container .exclamation {
    color: red;
    font-weight: 800;
    font-size: 14px;
}
.exclamation-container:hover + .tooltip,
.tooltip:hover {
    display: block;
}
/* Новые стили для длинного текста */
.input-container {
    position: relative;
    width: 100%;
}
.input-container input.input-field {
    width: 100%;
    padding-right: 50px; /* Увеличенный отступ */
}
.input-container.exclamation-visible input.input-field {
    padding-right: 50px; /* Увеличенный отступ для восклицательного знака */
}

/* =========================
Офомление личного кабинета
========================= */

.avatar_Image {
    display: block;
    background-color: var(--color-bg-menu-link-hover);
    height: 38px; width: 38px;
    border: 4px solid #da27a8;
    border-radius: 10px;
    cursor: pointer;
}
.Avatar_Menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
    display: none;
    position: absolute;
    background-color: white;
    box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px;
    border-radius: var(--radius-main);
    top: 70px;
    right: 0;
    z-index: 1000;
    padding: 10px;
    overflow: hidden;
}

/* Стили для редактирования имени пользователя */
.username-container {
    width: 100%;
    margin-bottom: 10px;
}

.username-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    color: black;
    font-weight: 800;
    padding: 5px;
}

#usernameText {
    font-size: 18px;
}

.edit-username-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.2s;
    opacity: 0.7;
}

.edit-username-btn:hover {
    color: #3678A8;
    opacity: 1;
}

.username-edit {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    background-color: #f5f5f5;
    border-radius: 10px;
    border: 2px solid #3678A8;
}

.username-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'MainFont';
    font-size: 16px;
    font-weight: 600;
    color: black;
    outline: none;
    transition: border-color 0.2s;
}

.username-input:focus {
    border-color: #3678A8;
}

.save-username-btn,
.cancel-username-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.save-username-btn {
    background: var(--color-btn-gradient);
    color: white;
}

.save-username-btn:hover {
    opacity: 0.88;
}

.cancel-username-btn {
    background: rgba(222, 37, 131, 0.12);
    color: #c7206b;
}

.cancel-username-btn:hover {
    background: rgba(222, 37, 131, 0.22);
}


.custom-button-menu {
    display: block;
    width: 100%;
    height: 100%;
    padding: 10px;
    text-decoration: none;
    font-family: 'MainFont';
    font-size: 20px;
    color: black;
    background-color: #E6E6E7;
    border: 0;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: color 0.2s;
    color: inherit;
    box-sizing: border-box;
}

.custom-button-menu:hover {
    background-color: #dfdfdf;
}
#avatarInput {
    display: none;
}
.avatar-controls {
    margin-top: 12px;
    background: #fff;
    border-radius: 10px;
    color: black;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}
.choose_the_file {
    width: 100%;
    background: none;
    border: none;
    font-family: 'MainFont';
    font-size: 20px;
    color: white;
    font-weight: 800;
}
.custom-button-menu_mini {
    display: block;
    width: 100%;
    height: 100%;
    padding: 5px;
    text-decoration: none;
    font-family: 'MainFont';
    font-size: 20px;
    color: black;
    background-color: #E6E6E7;
    text-align: center;
    cursor: pointer;
    transition: color 0.2s;
    color: inherit;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1px solid #e0e0e0;
}
.custom-button-menu_mini label {
    color: black;
}
.custom-button-menu_mini:last-of-type {
    border: 0;
}
.custom-button-menu_mini:hover {
    background-color: #dfdfdf;
}
#logoutButton {
    background-color: #DE2583;
    color: white;
    font-weight: 800;
}
#logoutButton:hover {
    background-color: #c7206b;
}
.no-hover:hover {
    transform: none;
}

/* Стиль для колокольчика */
.avatar-container {
    position: relative;
    display: inline-block;
}

.notification-badge {
    position: absolute;
    bottom: -4px;
    right: -6px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ff3b30;
    border-radius: 50%;
    border: 2px solid #fff;
    pointer-events: none;
    box-sizing: border-box;
}

.notification-bell {
    width: 12px;
    height: 12px;
    filter: brightness(0) invert(1);
    z-index: 1;
}

/* Стиль для счётчика уведомлений */
.notification-count {
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 18px; /* match badge height to vertically center */
    height: 18px;
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transform: none;
}
.admin_star {
    position: absolute;
    top: 30px;
    left: -5px;
    width: 25px;
    height: 25px;
}

/* =========================
Форма для заданий и заявок
========================= */

.full_size_button {
    font-family: 'MainFont';
    font-size: 18px;
    font-weight: 800;
    width: 100%;
    border-radius: var(--radius-main);
    white-space: nowrap;
    cursor: pointer;
    color: black;
    box-sizing: border-box;
    padding: 10px;
    border: 0;
    outline: 2px solid rgba(200, 200, 200, 0);
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease-in-out;
}
  
  
.full_size_button:hover {
    outline: 2px solid rgba(200, 200, 200, 1.0);
    background-color: rgba(245, 245, 245, 1);
}

.variant-actions {
    margin-top: 25px;
}

.variant-actions .full_size_button {
    display: block;
    margin-top: 0;
}

/* =========================
Уведомления
========================= */
.notif-card {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-main);
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #e0e0e0;
}

.notif-card:first-child {
    margin-top: 25px;
    border-radius: var(--radius-main) var(--radius-main) 0 0;
}

.notif-card:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-main) var(--radius-main);
}

.notif-card:only-child {
    border-radius: var(--radius-main);
}

.notif-card:hover {
    background: #f5f5f5;
}

.notif-read {
    opacity: 0.65;
}

.notif-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.notif-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background: #000;
    flex-shrink: 0;
}

.notif-title {
    font-weight: 800;
    color: #000;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-type-badge {
    font-size: 0.8em;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.notif-type-admin {
    background: #e3edff;
    color: rgba(19, 49, 108, 1);
}

.notif-type-system {
    background: #fff3e0;
    color: #e65100;
}

.notif-date {
    color: #888;
    font-size: 0.9em;
    white-space: nowrap;
    flex-shrink: 0;
}

.notif-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.notif-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    color: #333;
    line-height: 1.5;
}

.notif-target {
    margin-top: 8px;
    font-size: 0.85em;
    color: #888;
}

.no-notif-text {
    text-align: center;
    color: #888;
    padding: 40px 20px;
}

.notif-badge-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ff3b30;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

.loading-text {
    text-align: center;
    color: #888;
    padding: 40px 20px;
}

@media (max-width: 768px) {
    .notif-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .notif-actions {
        width: 100%;
    }

    .notif-actions .action-btn {
        flex: 1;
    }
}

/* =========================
Заявки администратора
========================= */
/* Карточка заявки в стиле почты */
.ticket-wrapper {
    display: flex;
    max-width: 100%;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg-main);
    padding: 16px;
    margin-bottom: 0px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 16px;
    border-radius: 0; /* по умолчанию без скруглений */
    border-bottom: 1px solid #e0e0e0; /* полоска-разделитель снизу */
}

.ticket-wrapper:first-child {
    margin-top: 25px;
}
.ticket-wrapper:last-child {
    border-bottom: none; /* у последней карточки полоски нет */
}

.ticket-wrapper-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    width: 100%;
    gap: 16px;
}

.ticket-main-info {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 20px;
}

.ticket-user {
    flex: 0 0 auto;
    min-width: 60px;
    max-width: 100px;
    width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
    color: rgb(19, 49, 108);
    text-align: left;
}
.ticket-subject {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: black;
    position: relative;
    text-align: left;
}
.ticket-subject-text {
    font-weight: 800;
}
.ticket-subject::after {
    content: ' — ' attr(data-message);
}
.ticket-message {
    display: none;
    color: black;
}
.ticket-date {
    flex: 0 0 auto;
    width: 120px;
    min-width: 80px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #888;
    text-align: center;
    margin-left: 0;
}
.actions-form {
    flex-shrink: 0;
    gap: 16px;
    display: flex;
    align-items: center;
}
.actions-form-blog {
    margin-top: 16px;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 38px;
    font-family: 'MainFont';
    background: #eaeaea;
    color: rgba(19, 49, 108, 1);
    font-weight: 800;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border: none;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 1em;
    line-height: 1.1;
    cursor: pointer;
    transition: var(--transition-fast);
}
a.action-btn {
    text-decoration: none;
    display: inline-flex;
    text-align: center;
    margin-top: 15px;
}
.action-btn:hover {
    background: white;
    outline: 2px solid rgba(19, 49, 108, 1);
}
#edit-btn, #edit-actions {
    margin-top: 15px;
}

/* Скругления для первой и последней карточки */
.ticket-wrapper:first-child {
    border-radius: var(--radius-main) var(--radius-main) 0 0;
}
.ticket-wrapper:last-child {
    border-radius: 0 0 var(--radius-main) var(--radius-main);
}
/* Если карточка одна — скругления по всем углам */
.ticket-wrapper:only-child {
    border-radius: var(--radius-main);
}

/* --- Мобильная версия --- */
@media (max-width: 768px) {
    .h1main1:not(.header-logo-title) {
        text-align: center;
        font-size: 75px;
        color: white;
        position: relative;
        margin-top: 0px;
        margin-bottom: 0px;
        transition: font-size 0.2s;
    }
    .h1main2 {
        text-align: center;
        font-family: var(--font-main);
        font-size: 30px;
        color: white;
        position: relative;
        margin-top: 0px;
        margin-bottom: 35px;
        transition: font-size 0.2s;
    }
    .ai-star {
        width: 30px;
        height: 30px;
        position: absolute;
        top: -5px;
        right: -20px;
    }
    .header-logo-title {
        font-size: 1.5em;
        line-height: 1;
    }
    .header-logo-title .ai-star {
        width: 18px;
        height: 18px;
        top: -13px;
        right: -11px;
    }
    /* SVG-логотип на главной: 120px → cap ≈ 74px ≈ текущие 75px; protrusion ≈ 37px */
    .hero-logo-svg {
        height: 85px;
        margin-right: -24px;
    }
    .ticket-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .ticket-wrapper-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        min-width: 0;
        width: 100%;
    }
    .ticket-user, .ticket-subject {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 100%;
    }
    .ticket-user {
        font-size: 24px;
    }
    .ticket-subject::after {
        content: '';
    }
    .ticket-message {
        display: block;
        flex: none;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        min-width: 0;
        max-width: 100%;
    }
    .ticket-date {
        font-size: 12px;
        min-width: 0;
        max-width: 100%;
        width: auto;
        text-align: left;
        margin-top: 2px;
    }
    .actions-form {
        align-self: flex-start;
        margin-top: 16px;
    }
    .ticket-main-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        width: 100%;
    }
}

/* Левая часть (номер заявки) */
.ticket-number {
    font-weight: 800;
    flex-shrink: 0;
    margin-right: 15px;
}

/* Центральная часть (тема и сообщение) */
.ticket-content {
    flex-grow: 1;
    margin-right: 15px;
    color: black;
}

.notification-subject {
    font-weight: 800;
    font-size: 24px;
    margin-bottom: 5px;
}

.notification-message, .notification-response {
    color: #404040;
    overflow: hidden;
    display: inline;
}

.ticket-time {
    color: #999;
    font-size: 12px;
    flex-shrink: 0;
}

.ticket-wrapper.hidden {
    display: none;
}

.file_href {
    color: #076D96;
}

.file_href:hover {
    text-decoration: underline;
    color: #D227A6;
}

/* =========================
   Детальная страница заявки (response / notification)
   ========================= */

.response-info-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

.response-info-table td {
    padding: 6px 12px 6px 0;
    font-size: 18px;
    color: black;
    vertical-align: top;
}

.response-info-table td:first-child {
    white-space: nowrap;
    width: 1%;
}

.response-message-text {
    font-size: 18px;
    line-height: 1.6;
    word-break: break-word;
    margin-top: 10px;
}

.response-files {
    margin-top: 16px;
}

.response-files ul {
    margin: 6px 0 0 0;
    padding-left: 20px;
}

.response-files li {
    margin-bottom: 4px;
}

.archive_admin_button {
    margin-top: 15px;
    font-size: 15pt;
    justify-content: center;
    background-color: #FDFDFD;
    border: 0px solid #ccc;
    cursor: pointer;
}
.archive_admin_button:hover {
    background-color: #EBEBEB;
}

/* =========================
Задания
========================= */

/* Аварийная лента редактирования */
.card--editing {
    position: relative;
    overflow: hidden;
}
.card--editing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: repeating-linear-gradient(
        -45deg,
        #f5c518,
        #f5c518 10px,
        #ffffff 10px,
        #ffffff 20px
    );
    z-index: 1;
    -webkit-mask-image: linear-gradient(to bottom, black 5%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 5%, transparent 100%);
}

.solution {
    border-radius: var(--radius-main);
    background-color: #eff4ff;
    padding: 15px;
    margin-top: 15px;
}
.solution-check {
    border-radius: var(--radius-main);
    background-color: #eff4ff;
    padding: 15px;
    margin-top: 15px;
}
.task-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.task-header {
    font-weight: 800;
    font-family: var(--font-main);
}
.task-source-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
}
.task-source-toggle {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #7a8fa6;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.task-source-toggle:hover,
.task-source-toggle:focus-visible {
    outline: none;
    color: #3a6ea8;
    transform: scale(1.12);
}
.task-source-tooltip {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    max-width: min(280px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 12px;
    background: #f5f8ff;
    color: #24324a;
    border: 1px solid rgba(19, 49, 108, 0.14);
    box-shadow: 0 12px 28px rgba(17, 34, 62, 0.16);
    font-size: 13px;
    line-height: 1.45;
    font-family: var(--font-main);
    z-index: 40;
    pointer-events: none;
    white-space: normal;
    word-break: break-word;
}
.task-source-wrap.is-open .task-source-tooltip {
    display: block;
}
.task-source-wrap:not(.is-open) .task-source-tooltip {
    display: none;
}
.task-image-container {
    display: flex;
    justify-content: center;
    width: 100%;
}
.task-image {
    display: block;
    width: 100%;
    max-width: 200px;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}
/* Inline images from markdown rendering — constrain display size */
#view-text img,
#view-solution img,
.blog-text-rendered img,
.col1-task img.inline-task-img,
.col1-task img {
    max-width: min(100%, 480px);
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-top: 12px;
    margin-bottom: 12px;
    cursor: zoom-in;
}
body.ilb-lock .task-image,
body.ilb-lock .chat-img,
body.ilb-lock .inline-task-img,
body.ilb-lock #view-text img,
body.ilb-lock #view-solution img,
body.ilb-lock .blog-text-rendered img,
body.ilb-lock .col1-task img,
body.ilb-lock .view-text-image img,
body.ilb-lock .view-solution-image img,
.card--editing .task-image,
.card--editing .task-image-container img,
.card--editing #view-text img,
.card--editing #view-solution img,
.card--editing .view-text-image img,
.card--editing .view-solution-image img,
.card--editing .col1-task img.inline-task-img,
.card--editing .col1-task img {
    cursor: default !important;
}
/* marked оборачивает картинку в <p><img/></p> — применяем отступы к параграфу-обёртке */
.col1-task > p:has(> img.inline-task-img),
#view-text > p:has(> img.inline-task-img),
#view-solution > p:has(> img.inline-task-img),
.blog-text-rendered > p:has(> img) {
    margin-top: 12px;
    margin-bottom: 12px;
}
.col1-task > p:has(> img.inline-task-img):first-child,
#view-text > p:has(> img.inline-task-img):first-child,
#view-solution > p:has(> img.inline-task-img):first-child,
.blog-text-rendered > p:has(> img):first-child {
    margin-top: 0;
}
.col1-task > p:has(> img.inline-task-img):last-child,
#view-text > p:has(> img.inline-task-img):last-child,
#view-solution > p:has(> img.inline-task-img):last-child,
.blog-text-rendered > p:has(> img):last-child {
    margin-bottom: 0;
}
/* Убираем внутренние отступы у самих <img> внутри <p>, чтобы не суммировались */
.col1-task > p > img.inline-task-img,
#view-text > p > img.inline-task-img,
#view-solution > p > img.inline-task-img,
.blog-text-rendered > p > img {
    margin-top: 0;
    margin-bottom: 0;
}
/* Fallback для случая, когда img оказалась прямым потомком (без <p>) */
#view-text > img:first-child,
#view-solution > img:first-child,
.blog-text-rendered > img:first-child,
.col1-task > img:first-child {
    margin-top: 0;
}
#view-text > img:last-child,
#view-solution > img:last-child,
.blog-text-rendered > img:last-child,
.col1-task > img:last-child {
    margin-bottom: 0;
}
/* Blog side images in news detail */
.blog-side-images {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.blog-existing-image {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.blog-existing-image img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(19, 49, 108, 0.2);
}
.blog-image-slot {
    margin-bottom: 0;
}
.blog-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.task-id a {
    color: #00467b;
    font-family: var(--font-main);
}
.answer-container {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}
.answer-container-2 {
    margin-top: 15px;
}
.answer-text-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
}
.preanswer {
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
}
.answer-text {
    display: flex;
    background-color: white;
    border: 1px solid black;
    border-radius: 5px;
    padding: 5px;
    width: 1em;
    justify-content: center;
    align-items: center;
}
.edit-task {
    min-height: 1.5em;
    cursor: text;
    outline: none;
}

/* Markdown-редактор */
.md-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f0f0f0;
    border: 1px solid #d0d0d0;
    border-bottom: none;
    border-radius: var(--radius-main) var(--radius-main) 0 0;
}
.md-toolbar button {
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0 6px;
    height: 28px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    line-height: 28px;
    min-width: 28px;
    text-align: center;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    box-sizing: border-box;
}
.md-toolbar button svg {
    display: block;
    flex-shrink: 0;
}
.md-toolbar button:hover {
    background: #e0e0e0;
}
.md-toolbar-sep {
    width: 1px;
    height: 20px;
    background: #ccc;
    margin: 0 4px;
}
.md-editor {
    width: 100%;
    min-height: 3em;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #d0d0d0;
    border-radius: 0 0 var(--radius-main) var(--radius-main);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    tab-size: 4;
    background: #fafafa;
    outline: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
    cursor: text;
    white-space: pre-wrap;
}

/* KaTeX live preview popup */
.katex-preview-popup {
    position: fixed;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    padding: 15px 15px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    white-space: nowrap;
    max-width: 90vw;
    overflow: visible;
}
.katex-preview-popup.visible {
    display: block;
}
/* Arrow — border outline */
.katex-preview-popup::before {
    content: '';
    position: absolute;
    top: 100%;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #d0d0d0;
    pointer-events: none;
}
/* Arrow — white fill to cover border */
.katex-preview-popup::after {
    content: '';
    position: absolute;
    top: calc(100% - 1px);
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: white;
    pointer-events: none;
}
/* Error icon — always occupies space in top-right corner, invisible until error */
.katex-preview-popup .katex-error-icon {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 16px;
    height: 16px;
    font-size: 12px;
    color: #c0392b;
    line-height: 16px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
}
.katex-preview-popup.has-error .katex-error-icon {
    opacity: 1;
}

/* Heading dropdown */
.md-heading-dropdown {
    position: relative;
    display: inline-flex;
}
.md-heading-btn {
    font-weight: 800 !important;
}
.md-caret {
    font-size: 10px;
    margin-left: 1px;
    opacity: 0.5;
}
.md-heading-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: var(--radius-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 100;
    padding: 4px;
    min-width: 60px;
    flex-direction: column;
    gap: 2px;
}
.md-heading-dropdown.open .md-heading-menu {
    display: flex;
}
.md-heading-menu button {
    background: none !important;
    border: none !important;
    padding: 6px 14px !important;
    cursor: pointer;
    border-radius: calc(var(--radius-main) - 2px) !important;
    text-align: left;
    font-weight: 800;
    color: rgba(19, 49, 108, 1);
    white-space: nowrap;
    transition: background 0.15s;
    min-width: unset !important;
}
.md-heading-menu button:nth-child(1) { font-size: 18px; }
.md-heading-menu button:nth-child(2) { font-size: 16px; }
.md-heading-menu button:nth-child(3) { font-size: 14px; }
.md-heading-menu button:nth-child(4) { font-size: 13px; }
.md-heading-menu button:hover {
    background: rgba(19, 49, 108, 0.08) !important;
}

/* Math icon */
.md-math-icon {
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 100;
    line-height: 1;
    display: inline;
}

/* Поле редактирования ответа */
input.edit-answer {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: var(--radius-main);
    background: #fafafa;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

/* Кнопка inline-картинки в тулбаре */
.md-btn-inline-img {
    position: relative;
    gap: 0 !important;
}
.md-btn-badge {
    position: absolute;
    top: 0px;
    right: 1px;
    width: 10px;
    height: 10px;
}

/* Кнопка "Ещё" для добавления side-картинок */
.side-images-add-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 2px dashed rgba(19, 49, 108, 0.4);
    border-radius: var(--radius-main);
    background: transparent;
    color: rgba(19, 49, 108, 1);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 13px;
    transition: var(--transition-fast);
}
.side-images-add-btn:hover {
    border-color: rgba(19, 49, 108, 1);
    background: rgba(19, 49, 108, 0.05);
}

/* Динамически добавленные side-слоты */
.edit-side-image + .edit-side-image,
.edit-text-image-slot + .edit-side-image,
.edit-solution-image + .edit-side-image {
    margin-top: 8px;
}

/* Блок картинок к тексту задания (редактор) */
#edit-text-image {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Блок картинок к решению (редактор) */
#edit-solution-images {
    display: flex;
    flex-direction: column;
    align-items: center;
}
#edit-text-image > .edit-text-image-slot + .edit-text-image-slot,
#edit-text-image > .edit-text-image-slot + .edit-side-image,
#edit-solution-images > .edit-solution-image + .edit-solution-image,
#edit-solution-images > .edit-solution-image + .edit-side-image {
    margin-top: 10px;
}

/* Картинки к тексту задания (просмотр) */
.view-text-image:not(:first-child) {
    margin-top: 10px;
}

/* Редактирование картинок задания */
.img-edit-area {
    border: 2px dashed rgba(19, 49, 108, 1);
    border-radius: var(--radius-main);
    width: 150px;
    min-height: 150px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.img-edit-area--has-image {
    min-height: auto;
}
.img-edit-preview {
    width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.img-edit-preview img {
    max-width: 150px;
    max-height: 250px;
    object-fit: contain;
    display: block;
}
.img-edit-area .img-edit-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(19, 49, 108, 0.08);
    pointer-events: none;
}
.img-edit-buttons {
    position: absolute;
    display: flex;
    gap: 6px;
    z-index: 1;
}
.img-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: white;
    color: rgba(19, 49, 108, 1);
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 0;
}
.img-edit-btn:hover {
    background: white;
    outline: 2px solid rgba(19, 49, 108, 1);
}
.img-edit-btn--delete:hover {
    outline-color: #c0392b;
    color: #c0392b;
}

/* Панель inline-картинок в редакторе */
.inline-images-panel {
    margin-top: 8px;
}
.inline-images-label {
    font-size: 12px;
    color: rgba(19, 49, 108, 0.7);
    margin-bottom: 6px;
}
.inline-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.inline-image-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border: 1px solid rgba(19, 49, 108, 0.25);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.inline-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.inline-image-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(192, 57, 43, 0.85);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.inline-image-thumb:hover .inline-image-delete {
    opacity: 1;
}

/* =========================
Каталог
========================= */
.catalog-controls {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 25px;
}
.catalog-buttons-control {
    display: flex;
    gap: 10px;
}
#variantInput {
    width: 100%;
    padding: 0px;
    font-size: 12pt;
    background-color: rgba(0,0,0,0);
    border: none;
    outline: none;
    border-radius: 0  var(--radius-btn) var(--radius-btn) 0;
}
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 6px;
    box-sizing: border-box;
    font-family: var(--font-main);
    font-size: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-btn);
    transition: var(--transition-fast);
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.catalog-grid > a.catalog-section-btn:last-child {
    grid-column: 2 / 3;
}

.catalog-section-btn {
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
    border-radius: 16px;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    cursor: pointer;
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: black;
    transition: box-shadow 0.2s, border 0.2s;
    transition: background 0.2s;
}
.catalog-section-btn:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    background: var(--color-bg-hover);
}

.section-number {
    font-weight: 800;
    color: rgba(19, 49, 108, 1);
}
.section-title {
    color: #333;
    background: transparent;
}

/* =========================
Модальное окно на каталоге
========================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: #fff;
    border-radius: var(--radius-main);
    padding: 16px;
    margin: 10px;
    max-width: calc(100% - 20px);
    max-height: calc(100% - 20px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.modal-content h2 {
    text-align: center;
}
.close-modal {
    display: inline-block;
    font-size: 2em;
    line-height: 1;
    width: 1em;
    height: 1em;
    padding: 0;
    margin: 0;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    color: #888;
    position: absolute;
    top: 3px;
    right: 3px;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #1976d2;
}
.modal-scroll {
    border-radius: 12px;
    margin-top: 16px;
    overflow-y: auto;
    max-height: 80vh;
}
#modalThemesList {
    margin: 0;
    padding-left: 0;
    list-style: none;
}
#modalThemesList li {
    padding: 0;
    background-color: rgb(241, 241, 241);
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    /* Сделать li относительным для абсолютного позиционирования ссылки */
    position: relative;
}
#modalThemesList li:hover {
    background-color: rgb(235, 235, 235);
}
#modalThemesList li:only-child {
    border: 0;
}
#modalThemesList li:last-child {
    border: 0;
}
#modalThemesList a {
    display: block;
    width: 100%;
    height: 100%;
    padding: 16px;
    text-decoration: none;
    font-size: 1.1em;
    cursor: pointer;
    transition: color 0.2s;
    color: inherit;
    box-sizing: border-box;
}

/* =========================
Главная страница
========================= */

.label_services {
    font-size: 20pt;
    font-weight: 800;
  }

/* Главная — блок «Мы предлагаем» */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.service-card {
    background: #fff;
    border: 2px solid #00467b;
    border-radius: var(--radius-main);
    padding: 24px 28px;
}

.service-card__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.service-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #e5f1ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.service-card__icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.service-card__title {
    font-family: var(--font-main);
    font-size: 18px;
    font-weight: 800;
    color: #00467b;
    margin: 0;
}

.service-card__text {
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.5;
    color: #444;
    margin: 0;
    text-align: left;
}

/* Главная — приветственные тексты */
.main-hero-text {
    hyphens: none;
    text-align: center;
    font-size: 32px;
}
.main-hero-subtext {
    hyphens: none;
    text-align: center;
    font-size: 24px;
}

/* Главная — контакты (карта + адрес) */
.contacts-row {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    width: 100%;
    box-sizing: border-box;
}
.contacts-row .mapsInContacts {
    flex: 1;
    min-width: 0;
    width: auto;
    height: auto;
    margin-bottom: 0;
}
.contacts-row .mapsInContacts iframe {
    width: 100%;
    height: 300px;
    display: block;
    float: none;
}
.contacts-row .textInContacts {
    flex: 1;
    min-width: 0;
}

.footer {
    backdrop-filter: blur(50px);
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    color: white;
    padding: 10px;
    text-align: center;
}

/* =========================
Чат-бот
========================= */

.eb27e8d345a6df189413 {
    height: calc(100vh - 190px);
    background-color: white;
    border-radius: var(--radius-main);
}

/* =========================
Медиа-запросы для адаптива
========================= */

@media (max-width: 992px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    .catalog-grid > a.catalog-section-btn:last-child {
        grid-column: unset;
    }
}
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }
    .theme-tasks-col {
        padding: 10px;
    }
    .theme-layout {
        margin-left: 0;
        margin-right: 0;
        margin-top: 20px;
    }
    .main-content--white {
        padding: 15px;
    }
    .main-content--white > div {
        margin-left: -15px;
        margin-right: -15px;
        padding: 15px;
    }
    .main-content h1 {
        margin-top: 10px;
        margin-bottom: 15px;
    }
    .card {
        padding: 20px;
        margin-top: 10px;
    }
    .tasks-page + .tasks-page .card:first-child {
        margin-top: 10px;
    }
    .card--editing::before {
        height: 20px;
    }
    .feedback {
        padding: 20px;
        margin: 30px 10px;
    }
    .main-content h1,
    .feedback h1,
    .authorization-content h1 {
        font-size: 30px;
    }
    .main-content h2,
    .col2 h1 {
        font-size: 18px;
    }
    .main-content p,
    .lis li {
        font-size: 18px;
    }
    .lis {
        padding-left: 25px;
    }
    .lis li {
        text-indent: -24px;
    }
    .button,
    .button:hover,
    input[type="submit"] {
        font-size: 20px;
        /* На меньшем шрифте асимметричный нижний паддинг (base: 10/15)
           визуально приподнимает текст — выравниваем по вертикали. */
        padding-top: 12px;
        padding-bottom: 12px;
        line-height: 1.1;
    }
    .coldiv, 
    article.coldiv,
    .coldivOnMain {
        flex-direction: column-reverse;
    }
    .coldiv-task {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 15px;
    }
    /* Перекрываем высокоспецифичное правило :has(.col2-task) для корректного адаптива */
    .coldiv-task:has(.col2-task:has(.task-image-container)) {
        grid-template-columns: 1fr;
    }
    .col2-task {
        grid-column: 1;
        grid-row: auto;
    }
    .task-actions {
        grid-column: 1;
        grid-row: auto;
        margin-top: 4px;
    }
    .variant-answer {
        grid-column: 1;
        grid-row: auto;
    }
    .variant-answer-input {
        width: 100%;
        flex: 1;
    }
    .col1 {
        max-width: 100%;
        width: auto;
    }
    .news-article .col1 {
        position: static;
        align-self: stretch;
    }
    .news-nav-wrapper--desktop {
        display: none;
    }
    .news-nav-wrapper--mobile {
        display: block;
        width: 100%;
    }
    .col1 img {
        width: 100%;
    }
    .col1-task {
        width: 100%;
    }
    .task-image-container {
        justify-content: center;
        margin-top: 15px;
    }
    .col2-task {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: auto;
        max-width: 100%;
    }
    .col2-task .view-text-image,
    .col2-task .view-solution-image {
        margin-top: 0;
    }
    #edit-text-image,
    #edit-solution-images {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    #edit-text-image > .edit-text-image-slot + .edit-text-image-slot,
    #edit-text-image > .edit-text-image-slot + .edit-side-image,
    #edit-text-image > .edit-side-image + .edit-side-image,
    #edit-solution-images > .edit-solution-image + .edit-solution-image,
    #edit-solution-images > .edit-solution-image + .edit-side-image,
    #edit-solution-images > .edit-side-image + .edit-side-image {
        margin-top: 0;
    }
    .side-images-add-btn {
        align-self: center;
        margin-top: 0;
    }
    .imgOnCols {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .textInContacts {
        width: 100%;
        margin-right: 0;
        margin-bottom: 25px;
    }
    .mapsInContacts {
        width: 100%;
        margin-right: 0;
    }
    .mapsInContacts iframe {
        max-width: 100%;
    }
    .aboutimg {
        max-width: 100%;
    }
    /* Главная — тексты */
    .main-hero-text {
        font-size: 22px;
    }
    .main-hero-subtext {
        font-size: 18px;
    }
    .label_services {
        font-size: 14pt;
    }
    /* Главная — сервисы на мобильном */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 100%;
    }
    .service-card {
        padding: 20px 18px;
    }
    .service-card__header {
        gap: 10px;
    }
    .service-card__icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    .service-card__icon img {
        width: 24px;
        height: 24px;
    }
    .service-card__title {
        font-size: 16px;
    }
    .service-card__text {
        font-size: 14px;
    }
    /* Главная — контакты на мобильном */
    .contacts-row {
        flex-direction: column;
    }
    .newsTime,
    time.newsTime {
        font-size: 12px;
    }
    .actions-form {
        width: 100%;
    }
    .eb27e8d345a6df189413 {
        height: calc(100vh - 150px);
    }
}

@media (max-width: 600px) {
    .catalog-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 0px;
    }
    .catalog-section-btn {
        padding: 16px;
        border-radius: 0px;
        border-bottom: 1px solid #e0e0e0;
        box-shadow: 0 0px 0px rgba(0,0,0,0);
    }
    .catalog-section-btn:first-child {
        border-radius: var(--radius-main) var(--radius-main) 0 0;
    }
    .catalog-section-btn:last-child {
        border-radius: 0 0 var(--radius-main) var(--radius-main);
        border: 0;
    }
    .catalog-section-btn:only-child {
        border-radius: var(--radius-main);
        border: 0;
    }
    .catalog-controls {
        flex-direction: column-reverse;
    }
    .catalog-buttons-control > button {
        flex: 1;
        width: 0;
    }
    .modal-content {
        width: 100%;
    }
    .Avatar_Menu {
        position: fixed;
        top: 90px;
        width: calc(100% - 60px);
        margin-left: 20px;
        margin-right: 20px;
    }
}
.hidden {
    display: none !important;
}

/* =========================
   Редактор аватара
   ========================= */

.avatar-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.avatar-editor-modal {
    background: #fff;
    border-radius: var(--radius-main);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.avatar-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.avatar-editor-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.avatar-editor-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #888;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.avatar-editor-close:hover {
    color: #333;
}

.avatar-editor-body {
    flex: 1;
    overflow: hidden;
    background: #1a1a1a;
    min-height: 300px;
}

.avatar-editor-container {
    width: 100%;
    height: 300px;
}

.avatar-editor-container img {
    max-width: 100%;
    display: block;
}

.avatar-editor-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.avatar-editor-controls {
    display: flex;
    gap: 8px;
}

.avatar-editor-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: #f0f0f0;
    color: #333;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 18px;
    transition: background 0.2s;
}

.avatar-editor-btn:hover {
    background: #e0e0e0;
}

/* Адаптив: таблицы сверху вниз на мобильных */
@media (max-width: 768px) {
    .mobile-stack table {
        width: 100% !important;
        border-collapse: collapse;
    }
    .mobile-stack table,
    .mobile-stack tbody,
    .mobile-stack tr {
        display: block;
    }
    .mobile-stack td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding: 12px 10px;
        border: none;
    }
    .mobile-stack td p {
        width: auto !important;
    }
}

.avatar-editor-actions {
    display: flex;
    gap: 10px;
}

.avatar-editor-cancel {
    background: #f0f0f0;
    color: #666;
    font-size: 14px;
}

.avatar-editor-save {
    background: var(--color-btn-gradient);
    color: white;
    font-weight: 800;
    font-size: 14px;
    padding: 8px 20px;
}

.avatar-editor-save:hover {
    background: linear-gradient(to right, #2d6a99, #0f2857);
}

.avatar-editor-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Cropper.js - круглая маска */
.cropper-view-box,
.cropper-face {
    border-radius: 10px;
}

.cropper-view-box {
    outline: none !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.cropper-dashed,
.cropper-line,
.cropper-point {
    display: none !important;
}

@media (max-width: 500px) {
    .avatar-editor-overlay {
        padding: 10px;
    }
    
    .avatar-editor-modal {
        max-height: calc(100vh - 20px);
    }

    .avatar-editor-container {
        height: 250px;
    }

    .avatar-editor-footer {
        flex-direction: column;
        gap: 12px;
    }

    .avatar-editor-controls,
    .avatar-editor-actions {
        width: 100%;
        justify-content: center;
    }

    .avatar-editor-actions .avatar-editor-btn {
        flex: 1;
    }
}

/* =========================
   KaTeX — прокрутка длинных формул
   ========================= */

.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
}

.katex-display > .katex {
    white-space: nowrap;
}

/* =========================
   История решений
   ========================= */

.history-layout {
    display: flex;
    justify-content: center;
    width: calc(100% - 20px);
    max-width: 1300px;
    margin-top: 30px;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 10px;
    gap: 10px;
    z-index: 2;
    position: relative;
    min-height: calc(100vh - 160px);
}

.history-sidebar {
    width: 280px;
    min-width: 280px;
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    padding: 8px;
    box-sizing: border-box;
    height: calc(100vh - 150px);
    max-height: calc(100vh - 150px);
    position: sticky;
    top: 120px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-sidebar-inner {
    background: var(--color-bg-main);
    border-radius: calc(var(--radius-main) - 4px);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-sidebar-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Обёртка: inner + scrollbar рядом */
.history-sidebar-scroll-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 8px;
}
.history-sidebar-scroll-wrap::-webkit-scrollbar {
    display: none;
}

.history-sidebar-title {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.1em;
    color: rgba(19, 49, 108, 1);
}

.history-empty {
    color: rgba(0, 0, 0, 0.4);
    text-align: center;
    font-size: 14px;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: var(--transition-fast);
}
.history-item-link {
    display: block;
    padding: 12px;
    text-decoration: none;
    color: inherit;
}

.history-item:hover {
    background: rgba(0, 0, 0, 0.1);
}

.history-item.active {
    background: rgba(19, 49, 108, 0.12);
    box-shadow: inset 0 0 0 2px rgba(19, 49, 108, 0.3);
}

.history-item-title {
    color: #1a1a1a;
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 4px;
}

.history-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
}

.history-main {
    flex: 1;
    max-width: 1100px;
    min-height: calc(100vh - 200px);
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    padding: 30px;
    box-sizing: border-box;
    container-type: inline-size;
}

/* Страница результатов (для гостей) переиспользует разметку и стили истории
   решений. Делаем её контейнером запросов, чтобы карточка баллов и таблицы
   сворачивались в столбик на узких экранах так же, как в истории. */
.results-page {
    container-type: inline-size;
}

.history-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 300px;
    color: white;
    font-size: 18px;
}

.history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    margin: 0;
}

.history-detail-header {
    color: white;
    margin-bottom: 20px;
}

.history-detail-header h1 {
    margin-bottom: 10px;
}

.history-score-card {
    background: var(--color-bg-main);
    border-radius: calc(var(--radius-main) - 4px);
    box-shadow: var(--color-shadow);
    padding: 10px 16px;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.history-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 14px;
}
.history-score-divider {
    width: 1px;
    height: 28px;
    background: rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}
@container (max-width: 400px) {
    .history-score-card {
        flex-direction: column;
        gap: 6px;
        padding: 10px 14px;
    }
    .history-score-divider {
        width: 80%;
        height: 1px;
    }
}
.history-score-label {
    font-size: 11px;
    color: #888;
    font-weight: 400;
    margin-bottom: 2px;
}
.history-score-value {
    font-size: 17px;
    font-weight: 800;
    color: #13316c;
}
.history-score-date {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

/* Таблицы результатов */
.history-tables-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.history-table-wrap {
    flex: 1;
    min-width: 0;
    background: var(--color-bg-main);
    border-radius: calc(var(--radius-main) - 4px);
    box-shadow: var(--color-shadow);
    overflow: hidden;
    padding-bottom: 4px;
}
.history-table-title {
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: #13316c;
    padding: 10px 14px 6px;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.history-table th {
    background: rgba(19, 49, 108, 0.07);
    color: #13316c;
    font-weight: 600;
    font-size: 12px;
    padding: 8px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.history-table td {
    padding: 7px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: #333;
}
.history-table tbody tr:last-child td {
    border-bottom: none;
}
.history-table tbody tr:hover {
    background: rgba(19, 49, 108, 0.03);
}
.history-tbl-section {
    font-weight: 500;
    color: #333;
}
.history-tbl-scrollto {
    cursor: pointer;
}
.history-tbl-id {
    color: #00467b;
    font-size: 12px;
    text-decoration: none;
}
.history-table td.history-cell-ok {
    color: #1a8a1a;
    font-weight: 600;
}
.history-table td.history-cell-err {
    color: #d32f2f;
    font-weight: 600;
}
.history-table td.history-cell-partial {
    color: #e67e00;
    font-weight: 600;
}

.history-detail-tasks .card {
    margin-top: 15px;
    scroll-margin-top: 110px;
}
.history-detail-tasks .card:first-child {
    margin-top: 0;
}

/* Кнопка удаления в элементе истории */
.history-item {
    position: relative;
    overflow: hidden;
}
.history-item-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    padding: 0;
}
.history-item:hover .history-item-delete {
    opacity: 1;
}
.history-item-delete:hover {
    background: rgba(211, 47, 47, 0.1);
    color: #d32f2f;
}

/* Toast отмены удаления */
/* Кастомный скроллбар сайдбара истории */
.history-scrollbar {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.history-sidebar-body:hover .history-scrollbar,
.history-scrollbar.active {
    opacity: 1;
}
.history-scrollbar-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.history-scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #888;
    border-radius: 3px;
    opacity: 0.5;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    pointer-events: auto;
    cursor: grab;
}
.history-scrollbar-thumb:hover,
.history-scrollbar-thumb.dragging {
    opacity: 0.8;
    background-color: #666;
}


/* Кнопка открытия сайдбара истории — фиксированная слева */
.history-sidebar.collapsed {
    display: none;
}
.history-sidebar-toggle {
    display: flex;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    border: none;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    box-shadow: var(--color-shadow);
    color: rgba(19, 49, 108, 1);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease-in-out, transform 0.3s ease-in-out, background-color 0.3s ease-in-out, bottom 0.3s ease-in-out, left 0.3s ease-in-out;
}
.history-sidebar-toggle.hidden {
    display: none !important;
}

/* Скрываем кнопку чата и стрелку вверх при открытом сайдбаре истории */
body.history-sidebar-active .btn-chat-fixed,
body.history-sidebar-active .btn-up {
    display: none !important;
}
body.history-sidebar-active {
    overflow: hidden;
}
body.history-sidebar-active .scrollbar {
    display: none !important;
}
body.history-sidebar-active .history-layout {
    z-index: 10002;
}
@media (hover: hover) and (pointer: fine) {
    .history-sidebar-toggle:hover {
        background-color: rgba(230, 230, 230, 0.7);
    }
}

/* Шапка сайдбара с заголовком и крестиком (как у чата) */
.history-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}
.history-sidebar-close {
    display: flex;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(19, 49, 108, 0.5);
    border-radius: 10px;
    padding: 4px;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.history-sidebar-close:hover {
    color: rgba(19, 49, 108, 1);
    background: rgba(0, 0, 0, 0.05);
}

@container (max-width: 700px) {
    .history-tables-row {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .history-layout {
        flex-direction: column;
    }

    .history-sidebar {
        position: fixed;
        inset: 0;
        width: 100%;
        min-width: unset;
        height: 100%;
        max-height: 100%;
        z-index: 10002;
        border-radius: 0;
        background-color: var(--color-bg-main);
        backdrop-filter: none;
        padding: 20px;
        overflow-y: auto;
    }

    .history-sidebar:not(.open) {
        display: none;
    }

    .history-sidebar.open {
        display: flex;
    }

    .history-sidebar-inner {
        padding: 0;
        border-radius: 0;
    }

    .history-sidebar-header {
        border-bottom: none;
        padding: 0 0 8px 0;
    }

    .history-sidebar-scroll-wrap {
        padding: 0;
    }

    .history-main {
        padding: 10px;
    }

    /* На мобильных кнопка удаления всегда видна */
    .history-item-delete {
        opacity: 0.6;
    }
}


/* =========================
   Страница поддержки (support)
   ========================= */

.support-layout {
    display: flex;
    justify-content: center;
    width: calc(100% - 20px);
    max-width: 1300px;
    margin-top: 30px;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 10px;
    gap: 10px;
    z-index: 2;
    position: relative;
    min-height: calc(100vh - 160px);
}

.support-sidebar {
    width: 300px;
    min-width: 300px;
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    padding: 8px;
    box-sizing: border-box;
    height: calc(100vh - 150px);
    max-height: calc(100vh - 150px);
    position: sticky;
    top: 120px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.support-sidebar-inner {
    background: var(--color-bg-main);
    border-radius: calc(var(--radius-main) - 4px);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.support-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.support-sidebar-title {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.1em;
    color: rgba(19, 49, 108, 1);
}

.support-sidebar-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.support-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(19, 49, 108, 0.6);
    padding: 4px;
    border-radius: 8px;
    transition: var(--transition-fast);
}
.support-back-btn:hover {
    color: rgba(19, 49, 108, 1);
    background: rgba(0, 0, 0, 0.05);
}

.support-sidebar-close {
    display: flex;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(19, 49, 108, 0.5);
    border-radius: 10px;
    padding: 4px;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.support-sidebar-close:hover {
    color: rgba(19, 49, 108, 1);
    background: rgba(0, 0, 0, 0.05);
}

.support-sidebar-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.support-sidebar-scroll-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 8px;
    gap: 6px;
}
.support-sidebar-scroll-wrap::-webkit-scrollbar {
    display: none;
}

/* Кнопки «Связаться с нами» и Архив */
.support-sidebar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.support-compose-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-btn);
    background: var(--color-btn-gradient);
    color: white;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.support-compose-btn:hover {
    opacity: 0.9;
}

.support-archive-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: none;
    border-radius: 50%;
    background: var(--color-btn-gradient);
    color: white;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.support-archive-btn svg,
.support-item-archive svg,
.support-archive-empty-inner svg,
.support-empty svg {
    display: block;
    shape-rendering: geometricPrecision;
    vector-effect: non-scaling-stroke;
}
.support-archive-btn:hover {
    opacity: 0.9;
}

/* Кнопка архива на всю ширину для администратора */
.support-archive-btn-full {
    width: 100%;
    border-radius: var(--radius-btn);
    padding: 12px 16px;
    justify-content: center;
}

/* Блок уведомлений */
.support-notifications-block {
    margin-top: 12px;
    margin-bottom: 8px;
}

.support-notifications-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: var(--transition-fast);
}

.support-notifications-item:hover {
    background: rgba(0, 0, 0, 0.08);
}

.support-notifications-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--color-btn-gradient);
    color: white;
}

.support-notifications-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 12px;
}

.support-notifications-title {
    font-weight: 600;
    font-size: 15px;
    color: rgba(0, 0, 0, 0.85);
}

.support-notifications-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    background: #ff4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

/* Список уведомлений в правой части */
.support-notifications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.support-notification-item {
    position: relative;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    transition: var(--transition-fast);
    overflow: hidden;
}

.support-notification-item:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.support-notification-item.open {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.support-notification-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
}

.support-notification-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.support-notification-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.9);
    flex: 1;
}

.support-notification-body {
    padding: 0 16px 16px;
}

.support-notification-message {
    color: rgba(0, 0, 0, 0.7);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    word-wrap: break-word;
}

.support-notification-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    flex-wrap: wrap;
}

.support-notification-type {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.support-notif-type-admin {
    background: rgba(19, 49, 108, 0.1);
    color: rgba(19, 49, 108, 1);
}

.support-notif-type-system {
    background: rgba(100, 100, 100, 0.1);
    color: rgba(50, 50, 50, 1);
}

.support-notification-date {
    color: rgba(0, 0, 0, 0.5);
    font-size: 13px;
}

.support-notification-mark-read {
    display: inline-flex;
    margin-top: 4px;
}

.support-notifications-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 20px;
    box-sizing: border-box;
}
.support-notifications-empty-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.82);
    text-align: center;
}
.support-notifications-empty-inner svg {
    opacity: 0.75;
}

.support-archive-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 20px;
    box-sizing: border-box;
}
.support-archive-empty-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.82);
    text-align: center;
}
.support-archive-empty-inner svg {
    opacity: 0.75;
}

.support-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}
.support-loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(19, 49, 108, 0.12);
    border-top-color: rgba(19, 49, 108, 0.7);
    border-radius: 50%;
    animation: variantSpin 0.8s linear infinite;
}

.support-empty {
    color: rgba(255, 255, 255, 0.82);
    text-align: center;
    font-size: 14px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
}
.support-empty svg {
    display: block;
    width: 28px;
    height: 28px;
    opacity: 0.75;
}

.support-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.support-item {
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.support-item-link {
    display: block;
    padding: 12px;
    text-decoration: none;
    color: inherit;
}
.support-item:hover {
    background: rgba(0, 0, 0, 0.1);
}
.support-item.active {
    background: rgba(19, 49, 108, 0.12);
    box-shadow: inset 0 0 0 2px rgba(19, 49, 108, 0.3);
}

.support-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding-right: 22px;
}
.support-unread-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background: rgba(19, 49, 108, 1);
    flex-shrink: 0;
}
.support-item-subject {
    color: #111111;
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.support-item--unread .support-item-subject {
    color: #111111;
}
.support-status-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.support-status-badge--pending {
    background: rgba(255, 165, 0, 0.15);
    color: #b37400;
}
.support-status-badge--answered {
    background: rgba(34, 139, 34, 0.15);
    color: #1a7a1a;
}
.support-item-meta .support-status-badge {
    margin-right: auto;
}
.support-item--unanswered {
    opacity: 1;
}
.support-item-preview {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.support-item-meta {
    display: flex;
    justify-content: flex-end;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.4);
}

/* Кнопка архивирования */
.support-item-archive {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    padding: 0;
}
.support-item:hover .support-item-archive {
    opacity: 1;
}
.support-item-archive:hover {
    background: rgba(19, 49, 108, 0.1);
    color: rgba(19, 49, 108, 1);
}

/* Основная область */
.support-main {
    flex: 1;
    max-width: 1100px;
    min-height: calc(100vh - 200px);
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    padding: 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.support-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 300px;
    color: white;
    font-size: 18px;
}

/* Форма обратной связи */
.support-compose-title {
    color: white;
    text-align: center;
    margin-bottom: 20px;
}

.support-compose {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.support-compose .card {
    margin-top: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.support-compose .card form {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.support-compose .card form textarea.support-input {
    flex: 1;
    min-height: 120px;
}

.support-input {
    display: block;
    width: 100%;
    padding: 14px 18px;
    border: 1px solid rgba(19, 49, 108, 0.15);
    border-radius: var(--radius-main);
    font-family: var(--font-main);
    font-size: 15px;
    background: white;
    color: #1a1a1a;
    outline: none;
    transition: var(--transition-fast);
    box-sizing: border-box;
    margin-bottom: 12px;
    resize: none;
}
.support-input:focus {
    border-color: rgba(19, 49, 108, 0.5);
    border-radius: var(--radius-main);
}
.support-input::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

.support-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: center;
}

.support-notify-targets {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.support-notify-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.82);
    font-size: 15px;
    line-height: 1.4;
}
.support-notify-option input[type="radio"] {
    margin: 0;
    accent-color: rgba(19, 49, 108, 1);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.support-notify-option span {
    display: inline-block;
}

/* Радиокнопки выбора балла в варианте */
.score-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.score-radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.82);
    font-size: 15px;
    line-height: 1.4;
}
.score-radio-option input[type="radio"] {
    margin: 0;
    accent-color: rgba(19, 49, 108, 1);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}
.score-radio-option span {
    display: inline-block;
}

/* Заглушка генерации варианта */
.variant-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: min(420px, 90vw);
    min-height: 220px;
    margin: 80px auto;
    padding: 32px 24px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(19, 49, 108, 0.12);
    box-shadow: 0 10px 28px rgba(26, 45, 82, 0.12);
    text-align: center;
    box-sizing: border-box;
}
.variant-loading-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(19, 49, 108, 0.12);
    border-top-color: rgba(19, 49, 108, 1);
    border-radius: 50%;
    animation: variantSpin 0.8s linear infinite;
}
@keyframes variantSpin {
    to { transform: rotate(360deg); }
}
.variant-loading-text {
    color: rgba(19, 49, 108, 0.9);
    font-size: 1.08em;
    font-weight: 600;
    margin: 0;
}

/* Зона для прикрепления файлов */
.support-file-area {
    border: 2px dashed rgba(19, 49, 108, 0.4);
    border-radius: var(--radius-main);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}
.support-file-area:hover,
.support-file-area.dragover {
    border-color: rgba(19, 49, 108, 1);
    background: rgba(19, 49, 108, 0.04);
}
.support-file-area-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(19, 49, 108, 0.6);
    font-size: 14px;
    cursor: pointer;
}
.support-file-area-label svg {
    flex-shrink: 0;
    color: rgba(19, 49, 108, 0.4);
}
.support-file-area input[type="file"] {
    display: none;
}

/* Кнопка восстановления из архива */
.support-item-restore {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    padding: 0;
}
.support-item:hover .support-item-restore {
    opacity: 1;
}
.support-item-restore:hover {
    background: rgba(19, 49, 108, 0.1);
    color: rgba(19, 49, 108, 1);
}

/* Превью прикреплённых файлов */
.support-file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.support-file-preview {
    position: relative;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.support-file-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(19, 49, 108, 0.15);
}
.support-file-preview-doc {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 1px solid rgba(19, 49, 108, 0.15);
    background: rgba(19, 49, 108, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(19, 49, 108, 0.5);
}
.support-file-preview-name {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
    text-align: center;
    word-break: break-all;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.support-file-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(19, 49, 108, 1);
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

/* Детали письма — заголовок */
.support-detail-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.support-detail-number {
    font-size: 22px;
    color: rgba(19, 49, 108, 1);
    font-weight: 800;
    margin: 0 0 2px 0;
}
.support-detail-subject {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    text-align: left;
    word-break: break-word;
}
.support-detail-date {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.45);
}
.support-detail-username {
    font-size: 13px;
    color: rgba(19, 49, 108, 0.75);
    font-weight: 600;
}

/* Детали письма — основная карточка */
.support-detail-card {
    background: var(--color-bg-main);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    padding: 24px 26px;
    margin-bottom: 14px;
}

/* Цитата исходного сообщения — стиль мессенджера */
.support-quote-toggle {
    display: flex;
    align-items: stretch;
    gap: 0;
    cursor: pointer;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 4px;
    transition: background 0.18s;
    user-select: none;
    position: relative;
}
.support-quote-toggle:hover {
    background: rgba(19, 49, 108, 0.05);
}
.support-quote-bar {
    width: 3px;
    min-height: 100%;
    border-radius: 2px;
    background: rgba(19, 49, 108, 0.5);
    flex-shrink: 0;
    margin-right: 12px;
}
.support-quote-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.support-quote-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(19, 49, 108, 1);
}
.support-quote-preview {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.support-quote-chevron {
    flex-shrink: 0;
    color: rgba(0, 0, 0, 0.3);
    align-self: center;
    margin-left: 8px;
    transition: transform 0.25s;
}
.support-quote-toggle.open .support-quote-chevron {
    transform: rotate(180deg);
}

/* Раскрывающийся блок исходного сообщения */
.support-quote-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s;
    padding: 0 14px 0 29px;
    border-left: 3px solid transparent;
    margin-left: 14px;
}
.support-quote-expand.open {
    max-height: 1200px;
    padding: 12px 14px 16px 29px;
    border-left-color: rgba(19, 49, 108, 0.15);
}
.support-quote-expand .support-detail-card-text {
    font-size: 14px;
    color: #444;
}
.support-quote-expand .support-detail-files {
    margin-top: 12px;
}

/* Форма ответа администратора */
.support-admin-reply {
    margin-top: 4px;
    width: 100%;
}
.support-admin-reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.support-admin-reply--collapsed {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.support-admin-reply-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(19, 49, 108, 0.2);
    background: rgba(19, 49, 108, 0.04);
    color: rgba(19, 49, 108, 1);
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
}
.support-admin-reply-toggle:hover {
    background: rgba(19, 49, 108, 0.1);
    transform: translateY(-1px);
}
.support-admin-reply-form-wrap {
    width: 100%;
}
.support-admin-reply-form-wrap[hidden] {
    display: none;
}
.support-admin-reply-textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.support-admin-reply-files {
    margin-bottom: 12px;
}

.support-admin-reply-success {
    padding: 12px 0;
    font-size: 15px;
}

/* Разделитель внутри карточки */
.support-detail-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 12px 0 16px 0;
}

/* Блок ответа администратора */
.support-detail-response {
    padding: 0;
}
.support-detail-response--pending .support-detail-card-text {
    color: #b37400;
    font-style: italic;
}

.support-detail-card-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(19, 49, 108, 1);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.support-detail-card-text {
    font-size: 15px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
    color: #222;
    margin: 0;
}

/* Файлы — карточки */
.support-detail-files {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.support-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(19, 49, 108, 0.06);
    border-radius: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    transition: background 0.18s, box-shadow 0.18s;
    position: relative;
    min-width: 0;
}
.support-file-card:hover {
    background: rgba(19, 49, 108, 0.13);
    box-shadow: 0 2px 8px rgba(19, 49, 108, 0.1);
}
.support-file-card-icon {
    flex-shrink: 0;
    color: rgba(19, 49, 108, 0.55);
}
.support-file-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    font-weight: 500;
}
.support-file-card-dl {
    flex-shrink: 0;
    color: rgba(19, 49, 108, 0.45);
    opacity: 0;
    transition: opacity 0.18s;
    display: flex;
    align-items: center;
}
.support-file-card:hover .support-file-card-dl {
    opacity: 1;
}

/* Старые стили деталей (для обратной совместимости) */
.support-detail-content h2 {
    color: rgba(19, 49, 108, 1);
    text-align: center;
    margin-bottom: 16px;
}
.support-detail-content .card {
    margin-bottom: 16px;
}
.support-detail-content .card h3 {
    margin-bottom: 8px;
    color: rgba(19, 49, 108, 1);
    font-size: 15px;
}
.support-detail-content .response-message-text {
    white-space: pre-wrap;
}

/* Кастомный скроллбар */
.support-scrollbar {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.support-sidebar-body:hover .support-scrollbar,
.support-scrollbar.active {
    opacity: 1;
}
.support-scrollbar-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.support-scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #888;
    border-radius: 3px;
    opacity: 0.5;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    pointer-events: auto;
    cursor: grab;
}
.support-scrollbar-thumb:hover,
.support-scrollbar-thumb.dragging {
    opacity: 0.8;
    background-color: #666;
}

/* Скрываемый сайдбар на десктопе */
.support-sidebar.collapsed {
    display: none;
}
.support-sidebar-toggle {
    display: flex;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    border: none;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    box-shadow: var(--color-shadow);
    color: rgba(19, 49, 108, 1);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease-in-out, transform 0.3s ease-in-out, background-color 0.3s ease-in-out, bottom 0.3s ease-in-out, left 0.3s ease-in-out;
}
.support-sidebar-toggle.hidden {
    display: none !important;
}
@media (hover: hover) and (pointer: fine) {
    .support-sidebar-toggle:hover {
        background-color: rgba(230, 230, 230, 0.7);
    }
}

body.support-sidebar-active .btn-chat-fixed,
body.support-sidebar-active .btn-up {
    display: none !important;
}
body.support-sidebar-active {
    overflow: hidden;
}
body.support-sidebar-active .scrollbar {
    display: none !important;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .support-layout {
        flex-direction: column;
        /* Снимаем собственный stacking-context (базовый z-index:2/position:relative).
           Иначе фиксированный полноэкранный сайдбар (z-index:10002) оказывался
           «заперт» внутри него, и приходилось поднимать ВЕСЬ layout наверх — тогда
           заблюренная .support-main с заглушкой «Выберите письмо…» вылезала поверх
           хедера, меню и плавающих кнопок. Теперь layout не создаёт контекст:
           сайдбар всплывает сам, а .support-main остаётся под хедером. */
        position: static;
        z-index: auto;
    }

    .support-sidebar {
        position: fixed;
        inset: 0;
        width: 100%;
        min-width: unset;
        height: 100%;
        max-height: 100%;
        z-index: 10002;
        border-radius: 0;
        background-color: var(--color-bg-main);
        backdrop-filter: none;
        padding: 20px;
        overflow-y: auto;
    }

    .support-sidebar:not(.open) {
        display: none;
    }

    .support-sidebar.open {
        display: flex;
    }

    .support-sidebar-inner {
        padding: 0;
        border-radius: 0;
    }

    .support-sidebar-header {
        border-bottom: none;
        padding: 0 0 8px 0;
    }

    .support-sidebar-scroll-wrap {
        padding: 0;
    }

    .support-main {
        padding: 10px;
        /* Не форсируем высоту во весь экран на мобильных: если сообщений/
           уведомлений мало и они помещаются — страница не должна прокручиваться.
           Высота — по содержимому. */
        min-height: auto;
    }
    .support-layout {
        min-height: auto;
    }
    /* Заглушка «Выберите письмо…» должна вертикально центрироваться в видимой
       области экрана, а не прижиматься к верху. Задаём ей высоту ≈ видимой
       части окна минус хедер и отступы: содержимое внутри уже центрируется
       flex-align-center. Та же логика работает для загруженных детали
       тикетов/уведомлений — их карточки не растянуты и не прыгают. */
    .support-placeholder {
        min-height: calc(100dvh - 220px);
    }

    .support-item-archive {
        opacity: 0.6;
    }

    .support-item-restore {
        opacity: 0.6;
    }

    .support-file-area-label {
        flex-direction: column;
        text-align: center;
    }

    .support-form-actions {
        flex-direction: column;
    }
}


/* =========================
   Пагинация
   ========================= */

.pagination-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--color-bg-main);
    border-radius: var(--radius-main);
    box-shadow: var(--color-shadow);
    padding: 10px 16px;
    margin-bottom: 0;
    width: fit-content;
    max-width: 95vw;
    position: sticky;
    bottom: 12px;
    /* Поднимаем над системной панелью жестов и динамической нижней панелью
       браузера на мобильных (см. scripts/viewport.js). */
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--vv-bottom, 0px));
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    z-index: 1200;
}
.theme-page-bottom-space {
    height: 30px;
    width: 100%;
}

/* Строка пагинации прилипает к странице и находится выше карточек */
.pagination-bar.is-sticky {
    position: sticky;
    top: 100px;
    z-index: 1200;
}

.pg-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 3px;
}
.pg-controls::-webkit-scrollbar {
    display: none;
}

/* Обёртка ленты номеров. position:relative — чтобы градиенты по краям и
   плавающие стрелки позиционировались поверх ленты, НЕ занимая место в потоке
   (лента не «прыгает» и прокручивается до самого края). */
.pg-scroller {
    position: relative;
    display: flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
}

/* Градиенты по краям: содержимое плавно уходит в прозрачность (а не резко
   обрывается). Показываются по классам .pg-fade-left/right на баре, которые
   ставит JS в зависимости от позиции скролла. Единая логика и для десктопа,
   и для мобильных. */
.pg-scroller::before,
.pg-scroller::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.pg-scroller::before {
    left: 0;
    background: linear-gradient(to right, var(--color-bg-main) 20%, rgba(255, 255, 255, 0));
}
.pg-scroller::after {
    right: 0;
    background: linear-gradient(to left, var(--color-bg-main) 20%, rgba(255, 255, 255, 0));
}
.pagination-bar.pg-fade-left .pg-scroller::before { opacity: 1; }
.pagination-bar.pg-fade-right .pg-scroller::after { opacity: 1; }

/* Стрелки удалены — лента прокручивается колесом и тачем. */
.pg-arrow { display: none; }

/* ── Единая пагинация (одинакова на мобильных и десктопе) ──────────────
   Нет отдельных media-запросов: ширина ленты ограничена ~5,5 кнопок,
   лишние номера прокручиваются тачем/колесом, градиенты по краям. */
.pagination-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px;
    gap: 10px;
    max-width: min(calc(5.5 * 36px + 28px), calc(100vw - 32px));
}
.pg-controls {
    justify-content: flex-start;
    max-width: calc(5.5 * 36px);
    margin-left: auto;
    margin-right: auto;
    scroll-behavior: smooth;
}
/* Если кнопок мало и они помещаются — центрируем их */
.pagination-bar:not(.pg-fade-left):not(.pg-fade-right) .pg-controls {
    justify-content: center;
}
.pg-num, .pg-arrow, .pg-jump-btn, .pg-jump-input {
    height: 34px;
    min-width: 34px;
}
.theme-page-bottom-space {
    height: 10px;
}

.pg-num {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 0.95em;
    min-width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #eaeaea;
    color: rgba(19, 49, 108, 1);
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease;
    padding: 0 6px;
}
.pg-num:hover {
    background: white;
    outline: 2px solid rgba(19, 49, 108, 1);
}
.pg-num.pg-active {
    background: var(--color-btn-gradient);
    color: #fff;
    outline: none;
}
.pg-num.pg-loaded:not(.pg-active) {
    background: #d0e4f5;
}

/* «…» — кликабельная кнопка, превращается в input для быстрого перехода */
.pg-ellipsis-btn {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.1em;
    min-width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(19, 49, 108, 0.5);
    cursor: pointer;
    padding: 0 6px;
    transition: var(--transition-fast);
}
.pg-ellipsis-btn:hover {
    background: #eaeaea;
    color: rgba(19, 49, 108, 1);
}
.pg-jump-inline {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 0.95em;
    width: 56px;
    height: 36px;
    border: 2px solid rgba(19, 49, 108, 1);
    border-radius: 10px;
    text-align: center;
    outline: none;
    background: white;
    color: rgba(19, 49, 108, 1);
    appearance: textfield;
    -moz-appearance: textfield;
}
.pg-jump-inline::-webkit-outer-spin-button,
.pg-jump-inline::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pg-jump-inline::placeholder {
    color: rgba(19, 49, 108, 0.35);
    font-weight: 800;
}

/* Page block separator */
.tasks-page-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 30px 0 5px 0;
    position: relative;
    z-index: 2;
}
.tasks-page-separator::before,
.tasks-page-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(19, 49, 108, 0.15);
}
.tasks-page-separator-label {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 0.85em;
    color: rgba(19, 49, 108, 0.45);
    white-space: nowrap;
    padding: 2px 10px;
    background: var(--color-bg-main);
    border-radius: 8px;
}

/* Loader */
.tasks-sentinel {
    height: 1px;
}
.tasks-loader {
    display: flex;
    justify-content: center;
    padding: 30px 0;
    z-index: 2;
    position: relative;
}
.loader-spinner {
    width: 24px;
    height: 24px;
    border: 4px solid #eaeaea;
    border-top: 4px solid rgba(19, 49, 108, 1);
    border-radius: 50%;
    animation: pg-spin 0.8s linear infinite;
}
@keyframes pg-spin {
    to { transform: rotate(360deg); }
}



/* =========================
   Навигация по новостям (sidebar / carousel)
   ========================= */

.news-nav-wrapper {
    width: 100%;
    margin-top: 16px;
}
.news-nav-wrapper--no-image {
    margin-top: 0;
}

/* Desktop: col1 (image + nav) sticks on news page */
@media (min-width: 769px) {
    .news-article .col1 {
        position: sticky;
        top: 110px;
        align-self: flex-start;
    }

    .news-nav-wrapper--mobile {
        display: none;
    }
}

.news-nav-heading {
    font-size: 18px;
    margin: 0;
    font-weight: 800;
    text-align: center;
}

.news-nav-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.news-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-main);
    background: rgba(0,0,0,0.03);
    text-decoration: none;
    color: inherit;
    transition: var(--transition-main);
    cursor: pointer;
}

.news-nav-item:hover {
    background: rgba(0,0,0,0.07);
}

.news-nav-item--active {
    outline: 2px solid rgba(19,49,108,0.4);
    background: rgba(19,49,108,0.06);
    pointer-events: none;
}

.news-nav-thumb {
    width: 120px;
    min-width: 120px;
    aspect-ratio: 16 / 9;
    border-radius: calc(var(--radius-main) - 8px);
    overflow: hidden;
}

.news-nav-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-nav-title {
    font-size: 14px;
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}


/* =========================
   Страница подписки
   ========================= */

/* Статус текущей подписки */
.subscription-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(54, 120, 168, 0.1), rgba(19, 49, 108, 0.1));
    border-radius: var(--radius-main);
    margin-bottom: 40px;
    border: 2px solid rgba(54, 120, 168, 0.3);
}

.subscription-status-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    background: var(--color-btn-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: 800;
}

.subscription-status-content h3 {
    margin: 0 0 4px 0;
    font-size: 1.1em;
    color: rgba(19, 49, 108, 1);
}

.subscription-status-content p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.7;
}

/* Карусель тарифов */
.sub-carousel {
    position: relative;
    margin: 0 auto 18px;
    max-width: 100%;
}

.sub-carousel__track {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 12px 4px 24px;
    margin: -12px -4px -24px;
}

.sub-carousel__track::-webkit-scrollbar {
    display: none;
}

/* Карточки тарифов */
.sub-card {
    min-width: 320px;
    max-width: 320px;
    background: white;
    border-radius: var(--radius-main);
    padding: 32px 28px;
    scroll-snap-align: center;
    transition: var(--transition-main);
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
}

/* Популярная карточка */
.sub-card--popular {
    border-color: rgba(54, 120, 168, 0.4);
    box-shadow: 0 4px 20px rgba(54, 120, 168, 0.15);
}

.sub-card--popular:hover {
    box-shadow: 0 8px 30px rgba(54, 120, 168, 0.25);
}

/* Активная подписка */
.sub-card--active {
    border-color: rgba(19, 49, 108, 0.6);
    background: linear-gradient(135deg, rgba(54, 120, 168, 0.03), rgba(19, 49, 108, 0.03));
}

/* Бейдж "Популярный" */
.sub-card__badge {
    background: var(--color-btn-gradient);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* Заголовок карточки */
.sub-card__header {
    margin-bottom: 28px;
}

.sub-card__title {
    margin: 0 0 12px 0;
    font-size: 1.8em;
    font-weight: 800;
    color: rgba(19, 49, 108, 1);
}

.sub-card__price {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.sub-card__price-amount {
    font-size: 2.2em;
    font-weight: 800;
    background: var(--color-btn-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sub-card__price-period {
    font-size: 1em;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

/* Список возможностей */
.sub-card__features {
    list-style: none;
    padding: 0;
    margin: 0 0 32px 0;
    flex: 1;
}

.sub-card__feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.95em;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.85);
}

.sub-carousel__note {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
    margin-top: 10px;
    padding: 0 4px;
    color: rgba(0, 0, 0, 0.62);
    font-size: 14px;
}

.sub-card__feature-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: rgba(54, 120, 168, 1);
    margin-top: 2px;
}

.sub-card__feature--disabled {
    opacity: 0.4;
}

.sub-card__feature--disabled .sub-card__feature-icon {
    color: rgba(0, 0, 0, 0.3);
}

/* Кнопка выбора плана */
.sub-card__button {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-btn);
    background: var(--color-btn-gradient);
    color: white;
    font-family: var(--font-main);
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-main);
    outline: 3px solid transparent;
}

.sub-card__button:hover {
    outline: 3px solid rgba(54, 120, 168, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(54, 120, 168, 0.3);
}

.sub-card__button:active {
    transform: translateY(0);
}

.sub-card__button--outline {
    background: transparent;
    color: rgba(19, 49, 108, 1);
    border: 2px solid rgba(19, 49, 108, 0.3);
}

.sub-card__button--outline:hover {
    background: rgba(19, 49, 108, 0.05);
    border-color: rgba(19, 49, 108, 0.5);
}

.sub-card__button:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.4);
    cursor: not-allowed;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.sub-card__button:disabled:hover {
    outline: none;
    transform: none;
    box-shadow: none;
}

/* Кастомный скроллбар карусели */
.sub-carousel__scrollbar {
    position: relative;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.3s;
}

.sub-carousel__scrollbar.visible {
    opacity: 1;
}

.sub-carousel__scrollbar-track {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.sub-carousel__scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--color-btn-gradient);
    border-radius: 10px;
    cursor: grab;
    transition: opacity 0.2s;
}

.sub-carousel__scrollbar-thumb:hover {
    opacity: 0.8;
}

.sub-carousel__scrollbar-thumb.dragging {
    cursor: grabbing;
}

/* FAQ секция */
.subscription-faq {
    padding-top: 18px;
    border-top: none;
}

.subscription-faq h2 {
    text-align: center;
    font-size: 2.2em;
    margin-bottom: 24px;
    color: rgba(19, 49, 108, 1);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid rgba(19, 49, 108, 0.12);
}

.faq-item {
    border-bottom: 1px solid rgba(19, 49, 108, 0.12);
    background: transparent;
}

.faq-question {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    font-size: 1.15em;
    font-weight: 700;
    color: rgba(19, 49, 108, 1);
    cursor: pointer;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: rgba(19, 49, 108, 0.9);
    font-size: 26px;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.faq-item[open] .faq-toggle {
    transform: rotate(90deg);
}

.faq-answer {
    margin: 0;
    padding: 0 0 18px 0;
    font-size: 0.95em;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.75);
}

/* Модальное окно оплаты */
.payment-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.payment-modal--visible {
    opacity: 1;
}

.payment-modal--closing {
    opacity: 0;
}

.payment-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.payment-modal__content {
    position: relative;
    background: white;
    border-radius: var(--radius-main);
    padding: 40px;
    max-width: 480px;
    width: calc(100% - 40px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.payment-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-modal__close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.8);
}

.payment-modal__title {
    margin: 0 0 20px 0;
    font-size: 1.8em;
    font-weight: 800;
    color: rgba(19, 49, 108, 1);
}

.payment-modal__plan {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(54, 120, 168, 0.1), rgba(19, 49, 108, 0.1));
    border-radius: 12px;
    margin-bottom: 28px;
    font-size: 1.05em;
}

.payment-modal__plan strong {
    color: rgba(19, 49, 108, 1);
}

/* Форма оплаты */
.payment-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.payment-form__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-form__group label {
    font-size: 0.9em;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
}

.payment-form__group input {
    padding: 12px 16px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    font-family: var(--font-main);
    font-size: 1em;
    transition: var(--transition-fast);
}

.payment-form__group input:focus {
    border-color: rgba(54, 120, 168, 0.6);
    outline: none;
    background: white;
}

/* =========================
   Cookie Consent Banner
   ========================= */

/* Баннер cookie */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    padding: 20px;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.cookie-banner--visible {
    transform: translateY(0);
    opacity: 1;
}

.cookie-banner__container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-banner__content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
    min-width: 300px;
}

.cookie-banner__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(54, 120, 168, 0.1);
    border-radius: 12px;
    color: #3678A8;
}

.cookie-banner__text {
    flex: 1;
}

.cookie-banner__title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
}

.cookie-banner__description {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #4a4a4a;
}

.cookie-banner__link {
    color: #3678A8;
    text-decoration: underline;
    transition: color 0.2s;
}

.cookie-banner__link:hover {
    color: #13316C;
}

.cookie-banner__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cookie-banner__btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-banner__accept-all {
    background: linear-gradient(to right, #3678A8, #13316C);
    color: white;
    box-shadow: 0 2px 8px rgba(54, 120, 168, 0.3);
}

.cookie-banner__accept-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(54, 120, 168, 0.4);
}

.cookie-banner__reject {
    background: rgba(0, 0, 0, 0.05);
    color: #4a4a4a;
}

.cookie-banner__reject:hover {
    background: rgba(0, 0, 0, 0.1);
}

.cookie-banner__settings {
    background: transparent;
    color: #3678A8;
    border: 2px solid #3678A8;
}

.cookie-banner__settings:hover {
    background: rgba(54, 120, 168, 0.1);
}

/* Модальное окно настроек cookie */
.cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cookie-settings-modal.cookie-modal--visible {
    opacity: 1;
}

.cookie-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.cookie-modal__dialog {
    position: relative;
    background: white;
    border-radius: var(--radius-main);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.cookie-modal--visible .cookie-modal__dialog {
    transform: scale(1);
}

.cookie-modal__header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cookie-modal__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.cookie-modal__close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
    border-radius: 8px;
}

.cookie-modal__close:hover {
    color: #1a1a1a;
    background: rgba(0, 0, 0, 0.05);
}

.cookie-modal__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.cookie-modal__intro {
    margin: 0 0 24px 0;
    color: #4a4a4a;
    line-height: 1.6;
}

.cookie-category {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cookie-category__header {
    margin-bottom: 8px;
}

.cookie-category__label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.cookie-category__label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3678A8;
}

.cookie-category__label input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.cookie-category__name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1a1a1a;
    flex: 1;
}

.cookie-category__badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(54, 120, 168, 0.1);
    color: #3678A8;
    font-weight: 600;
}

.cookie-category__badge--info {
    background: rgba(150, 150, 150, 0.1);
    color: #666;
}

.cookie-category__description {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #666;
    padding-left: 32px;
}

.cookie-modal__footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.cookie-modal__btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cookie-modal__btn--primary {
    background: linear-gradient(to right, #3678A8, #13316C);
    color: white;
    box-shadow: 0 2px 8px rgba(54, 120, 168, 0.3);
}

.cookie-modal__btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(54, 120, 168, 0.4);
}

.cookie-modal__btn--secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #4a4a4a;
}

.cookie-modal__btn--secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Адаптивность */
@media (max-width: 768px) {
    .cookie-banner__container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cookie-banner__actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .cookie-banner__btn {
        flex: 1;
        text-align: center;
    }
    
    .cookie-modal__dialog {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .cookie-modal__footer {
        flex-direction: column;
    }
    
    .cookie-modal__btn {
        width: 100%;
    }
}

.payment-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.payment-form__note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(54, 120, 168, 0.08);
    border-radius: 10px;
    font-size: 0.85em;
    line-height: 1.5;
    color: rgba(19, 49, 108, 0.8);
    margin: 0;
}

.payment-form__note svg {
    min-width: 16px;
    margin-top: 2px;
    color: rgba(54, 120, 168, 1);
}

.payment-form__submit {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-btn);
    background: var(--color-btn-gradient);
    color: white;
    font-family: var(--font-main);
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-main);
    margin-top: 8px;
}

.payment-form__submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(54, 120, 168, 0.3);
}

.payment-form__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Адаптивность для подписки */
@media (max-width: 768px) {
    .sub-carousel__track {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .sub-card {
        min-width: 280px;
        max-width: 280px;
    }
    
    .subscription-status {
        flex-direction: column;
        text-align: center;
    }
    
    .faq-grid {
        grid-template-columns: 1fr;
    }
    
    .payment-modal__content {
        padding: 28px 24px;
    }
    
    .payment-form__row {
        grid-template-columns: 1fr;
    }
}

/* Mobile: горизонтальная карусель внизу */
@media (max-width: 768px) {
    .news-nav-wrapper--mobile {
        width: 100%;
        margin-top: 0px;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        order: -1;
    }

    .news-nav-sidebar {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        padding-bottom: 6px;
        scrollbar-width: thin;
        scrollbar-color: rgba(0,0,0,0.15) transparent;
    }

    .news-nav-sidebar::-webkit-scrollbar {
        height: 4px;
    }
    .news-nav-sidebar::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.15);
        border-radius: 4px;
    }
    .news-nav-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .news-nav-item {
        flex-direction: column;
        align-items: flex-start;
        width: 200px;
        min-width: 200px;
        max-width: 200px;
        flex-shrink: 0;
        scroll-snap-align: start;
        text-align: left;
        padding: 8px;
        box-sizing: border-box;
    }

    .news-nav-thumb {
        width: 100%;
        min-width: unset;
        position: relative;
        height: 0;
        padding-top: 56.25%;
        aspect-ratio: auto;
    }

    .news-nav-thumb img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .news-nav-info {
        width: 100%;
    }
}


/* =========================
   Карусель подписок
   ========================= */

.sub-carousel {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* =========================
   Блок грантодателей
   ========================= */
.grant-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    background: #fff;
    border: 2px solid #00467b;
    border-radius: var(--radius-main);
    padding: 32px 40px;
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}
.grant-card__logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}
.grant-card__logo {
    height: 64px;
    width: auto;
    object-fit: contain;
}
.grant-card__logo-sep {
    width: 2px;
    height: 48px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 1px;
    flex-shrink: 0;
}
.grant-card__text {
    font-size: 15px;
    line-height: 1.55;
    color: #333;
    margin: 0;
}
@media (max-width: 599px) {
    .grant-card {
        padding: 20px 16px;
    }
    .grant-card__logo {
        height: 48px;
    }
    .grant-card__text {
        font-size: 14px;
    }
}

/* Track — нативный горизонтальный скролл с scroll-snap */
.sub-carousel__track {
    display: grid;
    gap: 20px;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 40px) / 3);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}
.sub-carousel__track::-webkit-scrollbar {
    display: none;
}
.sub-carousel__track.grabbing {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
}
/* Price animation */
.sub-card__price-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 48px;
}
.sub-card__amount,
.sub-card__old-price {
    transition: transform 260ms ease, opacity 260ms ease;
    will-change: transform, opacity;
}
.sub-card__old-price {
    transform: translateY(6px);
    opacity: 0;
}
.sub-card--yearly .sub-card__old-price {
    transform: translateY(0);
    opacity: 1;
}

/* Каждая карточка привязывается к snap-точке */
.sub-card {
    scroll-snap-align: start;
    background: #fff;
    border-radius: var(--radius-main);
    border: #00467b 2px solid;
    padding: 28px 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    min-width: 0;
}

/* Кастомный горизонтальный скроллбар */
.sub-carousel__scrollbar {
    position: relative;
    height: 14px;
    margin-top: 4px;
    display: none;
}
.sub-carousel__scrollbar.visible {
    display: block;
}
.sub-carousel__scrollbar-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.08);
}
.sub-carousel__scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    min-width: 30px;
    border-radius: 3px;
    background: #888;
    opacity: 0.5;
    transition: opacity 0.2s, background-color 0.2s;
    cursor: grab;
}
.sub-carousel__scrollbar-thumb:hover,
.sub-carousel__scrollbar-thumb.dragging {
    opacity: 0.8;
    background: #666;
}
.sub-carousel__scrollbar-thumb.dragging {
    cursor: grabbing;
}

/* Бейдж с названием тарифа */
.sub-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-btn-gradient);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    padding: 8px 22px;
    border-radius: var(--radius-btn);
}
.sub-card__badge--free {
    background: #e0e0e0;
    color: #333;
}
.sub-card__badge-icon {
    width: 22px;
    height: 22px;
}

/* Блок цены */
.sub-card__price-block {
    margin: 24px 0 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 90px;
}
.sub-card__amount {
    font-size: 36px;
    font-weight: 800;
    color: #13316C;
}

/* Старая (перечёркнутая) цена */
.sub-card__old-price {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
    min-height: 20px;
}

/* Переключатель месяц / год (таблетка) */
.sub-card__period-toggle {
    display: inline-flex;
    background: #e8eef5;
    border-radius: var(--radius-btn);
    overflow: hidden;
    padding: 3px;
}
.sub-card__period-btn {
    border: none;
    background: transparent;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 800;
    padding: 6px 18px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: var(--transition-fast);
    color: #555;
}
.sub-card__period-btn--active {
    background: var(--color-btn-gradient);
    color: #fff;
}

/* Список преимуществ */
.sub-card__features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    width: 100%;
    text-align: left;
}
.sub-card__features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.sub-card__features li:last-child {
    border-bottom: none;
}
.sub-card__features li img {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Кнопка «Купить» (таблетка) */
.sub-card__buy-btn {
    display: inline-block;
    margin-top: auto;
    padding: 12px 40px;
    background: var(--color-btn-gradient);
    color: #fff;
    font-family: var(--font-main);
    font-size: 18px;
    font-weight: 800;
    text-decoration: none;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    transition: var(--transition-main);
    outline: 3px solid rgba(235, 67, 178, 0.8);
}
.sub-card__buy-btn:hover {
    outline: 4px solid rgba(185, 17, 128, 1);
    transform: scale(1.03);
}

/* --- Страница-заглушка оформления подписки (стиль как у страниц ошибок) --- */
/* Центрируем карточку по центру окна (как вход/регистрация): #content
   становится высотой с окно и выравнивает карточку по вертикали. Отрицательный
   margin-top компенсирует padding-top:90px у body — сверху нет лишнего отступа. */
#content:has(.subscription-pending) {
    align-items: center;
    min-height: 100dvh;
    margin-top: -90px;
}
.main-content.subscription-pending {
    margin-top: 0;
    margin-bottom: 0;
}

.sp-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.subscription-pending .error-page__message {
    max-width: 580px;
    hyphens: none;
    -webkit-hyphens: none;
    -ms-hyphens: none;
}

/* --- Планшет (600–899px): 2 карточки --- */
@media (max-width: 899px) and (min-width: 600px) {
    .sub-carousel__track {
        grid-auto-columns: calc((100% - 20px) / 2);
    }
}

/* --- Мобильный (<600px): 1 карточка на весь экран --- */
@media (max-width: 599px) {
    .sub-carousel__track {
        grid-auto-columns: 100%;
        gap: 12px;
        padding-left: 0;
        padding-right: 0;
    }
    .sub-card {
        width: 100%;
        max-width: 100%;
    }
    .sub-card__amount {
        font-size: 28px;
    }
}

/* =========================
   Модальное окно добавления новости
========================= */
.news-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    box-sizing: border-box;
}
.news-modal-card {
    display: flex !important;
    flex-direction: column;
    width: calc(100% - 20px);
    max-width: 1100px;
    max-height: calc(100vh - 40px);
    margin: 0 auto !important;
    padding: 0;
    position: relative;
    overflow: visible;
    box-sizing: border-box;
}
.news-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}
.news-modal-title {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.1em;
    color: rgba(19, 49, 108, 1);
}
.news-modal-close {
    display: flex;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(19, 49, 108, 0.5);
    border-radius: 10px;
    padding: 4px;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.news-modal-close:hover {
    color: rgba(19, 49, 108, 1);
    background: rgba(0, 0, 0, 0.05);
}
.news-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 14px 16px 0 16px;
}
/* Form inside modal stretches to fill body */
#newsAddForm {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
/* md-editor fills remaining form space and scrolls internally */
#newsAddForm #blog-add-editor {
    flex: 1;
    min-height: 100px;
    overflow-y: auto;
}
.news-modal-actions {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .news-modal-overlay {
        padding: 0;
        align-items: stretch;
    }
    .news-modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        height: 100%;
        border-radius: 0 !important;
        margin: 0 !important;
    }
}


/* =========================
   Страница ошибки (renderErrorPage)
   ========================= */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 50px 20px 40px;
    gap: 14px;
    min-height: 320px;
}

.error-page__illustration {
    margin-bottom: 4px;
    line-height: 0;
}

/* Большой номер ошибки — розовый градиент (цвета из --color-outline-btn) */
.error-page__code {
    font-family: var(--font-main);
    font-weight: 900;
    font-size: 7em;
    line-height: 1;
    letter-spacing: -3px;
    background: linear-gradient(to right, rgba(235, 67, 178, 1), rgba(185, 17, 128, 1));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.error-page__title {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.7em;
    color: white;
    margin: 0;
    line-height: 1.25;
}

.error-page__message {
    font-family: var(--font-main);
    font-weight: 400;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.65);
    max-width: 420px;
    line-height: 1.6;
    margin: 0;
}

.error-page__actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 768px) {
    .error-page {
        padding: 30px 16px 24px;
    }
    .error-page__code {
        font-size: 5em;
    }
    .error-page__title {
        font-size: 1.35em;
    }
    .error-page__actions {
        margin-top: 12px;
    }
}

/* =========================
   Лайтбокс изображений задач + рисование пометок
   ========================= */
.task-image { cursor: zoom-in; }

.card--editing .task-image,
.card--editing .task-image-container img,
.card--editing #view-text img,
.card--editing #view-solution img,
.card--editing .view-text-image img,
.card--editing .view-solution-image img,
.card--editing .img-edit-area img,
.card--editing .img-edit-preview img,
body.ilb-lock .task-image,
body.ilb-lock .chat-img,
body.ilb-lock .inline-task-img,
body.ilb-lock #view-text img,
body.ilb-lock #view-solution img,
body.ilb-lock .blog-text-rendered img,
body.ilb-lock .col1-task img,
body.ilb-lock .view-text-image img,
body.ilb-lock .view-solution-image img {
    cursor: default !important;
}

body.ilb-lock { overflow: hidden; }

.ilb-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    flex-direction: column;
    align-items: center;
    /* Панель инструментов идёт первым блоком в потоке, сцена с картинкой —
       ниже и центрируется в оставшемся пространстве (margin:auto). Так панель
       НИКОГДА не накладывается на изображение, даже если переносится на
       несколько строк (узкое/квадратное окно). */
    justify-content: flex-start;
    /* Плотный непрозрачный фон вместо backdrop-filter: blur —
       блюр постоянно переразмывал анимированный фон сайта и грузил GPU. */
    background: #0e1524;
    padding: 10px 12px 16px;
    gap: 10px;
    box-sizing: border-box;
}
.ilb-overlay.open { display: flex; }

.ilb-toolbar {
    position: static;
    transform: none;
    flex: 0 0 auto;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100vw - 24px);
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 14px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}

.ilb-palette {
    display: flex;
    gap: 6px;
    align-items: center;
}
.ilb-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.15);
    padding: 0;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ilb-color:hover { transform: scale(1.12); }
.ilb-color.active {
    box-shadow: 0 0 0 3px rgba(19, 49, 108, 0.55);
    transform: scale(1.12);
}

.ilb-thick {
    width: 96px;
    cursor: pointer;
    accent-color: #13316C;
}

.ilb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(19, 49, 108, 0.18);
    border-radius: 10px;
    background: #fff;
    color: #13316C;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    white-space: nowrap;
}
.ilb-btn:hover {
    background: #f3f6fb;
    border-color: rgba(19, 49, 108, 0.32);
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}
.ilb-btn.active {
    background: #13316C;
    color: #fff;
    border-color: #13316C;
}
.ilb-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ilb-close {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    padding: 0;
    font-weight: 700;
}

.ilb-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
    line-height: 0;
    cursor: crosshair;
    /* Центрируем сцену в пространстве, оставшемся под панелью инструментов */
    margin: auto;
    flex: 0 1 auto;
    min-height: 0;
    /* При зуме картинка может выходить за пределы области — прокручиваем сцену,
       вместо того чтобы искажать пропорции обрезкой через max-width/height. */
    overflow: auto;
}
.ilb-img {
    display: block;
    /* Итоговый размер задаёт JS (fitCanvas) с сохранением пропорций. Никаких
       независимых max-width/max-height — именно они ломали соотношение сторон
       (ширина обрезалась, а высота оставалась прежней → картинка вытягивалась). */
    width: auto;
    height: auto;
    background: #fff;
    border-radius: 8px;
    user-select: none;
    -webkit-user-drag: none;
}
.ilb-canvas {
    position: absolute;
    top: 0;
    left: 0;
    touch-action: none;
    cursor: crosshair;
}

@media (max-width: 620px) {
    .ilb-toolbar { gap: 7px; padding: 7px 9px; }
    .ilb-btn { width: 32px; height: 32px; }
    .ilb-thick { width: 74px; }
    .ilb-color { width: 22px; height: 22px; }
}

/* =========================
   Ввод формул в чате (MathLive + чипы)
   ========================= */
/* Кнопка «формула» в поле ввода — круглая, с обводкой (не залитая) */
.mfe-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    padding: 0;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    background: transparent;
    color: #4a5b7a;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.mfe-fab:hover {
    background: rgba(19, 49, 108, 0.09);
}
.mfe-fab--loading {
    opacity: 0.5;
    cursor: progress;
    pointer-events: none;
}
/* В боковой панели (светлый фон) — контур синеватый, компактнее */
.chat-input-bar .mfe-fab {
    width: 34px;
    height: 34px;
    color: #3a4a6b;
    border-color: rgba(19, 49, 108, 0.35);
}
.chat-input-bar .mfe-fab:hover {
    color: #13316C;
    border-color: rgba(19, 49, 108, 0.55);
    background: rgba(19, 49, 108, 0.08);
}
/* На странице чат-бота (тёмный фон) — светлый контур, чтобы не сливался */
.cb-composer-inner .mfe-fab {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
}
.cb-composer-inner .mfe-fab:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.12);
}

/* Поле ввода как contenteditable (текст + формулы-чипы) */
.cb-rich, .chat-rich {
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    outline: none;
    height: auto;
    cursor: text;
}
.cb-rich { min-height: 24px; max-height: 200px; overflow-y: auto; }
.chat-rich {
    min-height: 22px;
    max-height: 140px;
    overflow-y: auto;
    line-height: 1.5;
    /* тонкий скроллбар, не заходящий на скруглённую обводку поля */
    scrollbar-width: thin;
    scrollbar-color: rgba(19, 49, 108, 0.3) transparent;
}
.chat-rich::-webkit-scrollbar { width: 6px; }
.chat-rich::-webkit-scrollbar-track { background: transparent; margin: 9px 0; }
.chat-rich::-webkit-scrollbar-thumb {
    background: rgba(19, 49, 108, 0.28);
    border-radius: 3px;
}
.chat-rich::-webkit-scrollbar-thumb:hover { background: rgba(19, 49, 108, 0.45); }
/* Плейсхолдер (когда поле пустое). position:absolute сохраняет статическую
   позицию текста, но убирает его из потока — курсор встаёт в начало поля. */
.cb-rich.is-empty::before,
.chat-rich.is-empty::before {
    content: attr(data-placeholder);
    color: #9aa4b6;
    pointer-events: none;
    position: absolute;
}

/* Отрендеренная формула-чип (кликабельная для редактирования) */
.math-chip {
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
    padding: 1px 7px;
    border-radius: 8px;
    background: #eef3fb;
    border: 1px solid #dbe4f3;
    cursor: pointer;
    user-select: none;
    line-height: 1.15;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.math-chip:hover { background: #e2ebfa; border-color: #b9c9e8; }
.math-chip:focus { outline: none; box-shadow: 0 0 0 2px rgba(54, 120, 168, 0.4); }
.math-chip .katex { font-size: 1.02em; color: #16223c; }

/* Формула-редактор — верхняя строка единой панели «поле + клавиатура» */
.mfe-formula-area {
    display: none;
    position: relative;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(180deg, #f7f9fc 0%, #edf3fa 100%);
    border: 1px solid #d8e1ee;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    box-sizing: border-box;
    overflow: hidden;
}
.mfe-formula-area.active { display: flex; }
/* В боковой панели — чуть компактнее */
.mfe-formula-area--sidebar { padding: 6px 8px; gap: 6px; }

math-field.mfe-block-field {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
    min-height: 40px;
    padding: 6px 12px;
    font-size: 1.05rem;
    border: 1.5px solid #c6d2e4;
    border-radius: 8px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(30, 60, 95, 0.03), 0 0 0 2px rgba(41, 81, 129, 0.06);
    --caret-color: #1e3b5f;
    --selection-background-color: #dceafe;
    --contains-highlight-background-color: #f2f7ff;
}
/* Прячем встроенную панель MathLive в поле (меню и переключатель клавиатуры) —
   клавиатурой управляем сами, а иконки перекрывали наши кнопки ✓/✕. */
math-field.mfe-block-field::part(menu-toggle),
math-field.mfe-block-field::part(virtual-keyboard-toggle) {
    display: none !important;
}

/* Кнопки «Готово/Отмена» — в строке поля справа, часть панели клавиатуры */
.mfe-fa-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.mfe-fa-hint { display: none; }
.mfe-fa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid #d1dbee;
    background: #ffffff;
    color: #435570;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.mfe-fa-btn:hover { background: #f2f6fb; color: #22385e; border-color: #bad0ee; }
.mfe-fa-btn--ok {
    background: linear-gradient(110deg, #1d4d7a 0%, #3f79ad 55%, #1d4d7a 100%);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}
.mfe-fa-btn--ok:hover { opacity: 0.96; background: linear-gradient(110deg, #1d4d7a 0%, #3f79ad 55%, #1d4d7a 100%); }

/* Тема виртуальной клавиатуры MathLive под наш стиль (официальные переменные).
   Задаём на :root — клавиатура-синглтон может рендериться вне .mfe-kb-host,
   а наследуемые CSS-переменные доходят до неё отовсюду. */
:root {
    --keyboard-background: #f4f7fb;
    --keyboard-border: #dfe7f2;
    --keyboard-accent-color: #2a5a8c;
    --keyboard-padding-horizontal: 10px;
    --keyboard-padding-top: 8px;
    --keyboard-padding-bottom: 12px;
    --keyboard-row-padding-left: 4px;
    --keyboard-row-padding-right: 4px;
    --keyboard-toolbar-text: #5a6982;
    --keyboard-toolbar-text-active: #1d3d5f;
    --keyboard-toolbar-background-selected: #dfeaf8;
    --keycap-background: #ffffff;
    --keycap-background-hover: #f3f7ff;
    --keycap-background-active: #deebff;
    --keycap-background-pressed: #d1e2ff;
    --keycap-text: #1d2a3d;
    --keycap-text-hover: #244d7d;
    --keycap-text-active: #244d7d;
    --keycap-text-pressed: #244d7d;
    --keycap-border: #d7dfed;
    --keycap-border-bottom: #c4d0e6;
    --keycap-primary-background: #2a5a8c;
    --keycap-primary-background-hover: #214c79;
    --keycap-primary-text: #ffffff;
    --keycap-secondary-background: #edf3fb;
    --keycap-secondary-background-hover: #e0ebfa;
    --keycap-secondary-text: #374a69;
    --keycap-secondary-border: #d3deee;
    --keycap-secondary-border-bottom: #c0cfeb;
    --keycap-shift-color: #3f7cae;
}

/* Прямая тема клавиш (глобально, т.к. клавиатура-синглтон висит в document, а её
   стили — в adoptedStyleSheets). Селектор повторяет внутренний селектор MathLive
   (.MLK__rows > .MLK__row > div), но с классом .ML__keyboard → выше по важности. */
.ML__keyboard .MLK__rows > .MLK__row > div {
    background: #ffffff !important;
    color: #1b2743 !important;
    fill: currentColor !important;
    border: 1px solid #d7e0ee !important;
    border-bottom: 2px solid #c7d3e8 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 0 !important;
    min-width: 0 !important;
}
/* Сепараторы должны быть прозрачными */
.ML__keyboard .MLK__rows > .MLK__row > div.separator,
.ML__keyboard .MLK__rows > .MLK__row > div[class*="separator"] {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    pointer-events: none !important;
    box-shadow: none !important;
}
/* SVG и формулы внутри клавиш не вылезают */
.ML__keyboard .MLK__rows > .MLK__row > div .ML__latex {
    display: block !important;
    font-size: 0.82em !important;
    line-height: 1 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    transform: scale(0.92);
    transform-origin: center center;
}
.ML__keyboard .MLK__rows > .MLK__row > div.small .ML__latex {
    font-size: 0.7em !important;
}
.ML__keyboard .MLK__rows > .MLK__row > div svg {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 22px !important;
    max-height: 22px !important;
}
.ML__keyboard .MLK__rows > .MLK__row > div:hover {
    background: #eef4ff !important;
    color: #13316C !important;
    border-color: #bcd0f2 !important;
}
.ML__keyboard .MLK__rows > .MLK__row > div.action {
    background: #e6edf9 !important;
    color: #33405c !important;
}

/* Хост клавиатуры — нижняя часть единой панели (стыкуется с полем формулы) */
.mfe-kb-host {
    display: none;
    width: 100%;
    flex-shrink: 0;
    border: 1px solid #dfe7f2;
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    background: linear-gradient(180deg, #f4f7fb 0%, #edf3fa 100%);
    box-sizing: border-box;
    position: relative;
}
.mfe-kb-host.active {
    display: block;
    /* Не даём клавиатуре занять полэкрана — высота ограничена, внутри можно прокрутить */
    max-height: min(44vh, 320px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

/* Когда клавиатура в хосте, MathLive ставит .MLK__backdrop с position:absolute
   и bottom:-192px. Переопределяем: позиционируем нормально (не из низа экрана). */
.mfe-kb-host .ML__keyboard {
    position: relative !important;
    height: auto !important;
    overflow: hidden !important;
}
.mfe-kb-host .MLK__plate,
.mfe-kb-host .ML__keyboard,
.mfe-kb-host .MLK__backdrop {
    overflow: hidden !important;
}
.mfe-kb-host .MLK__backdrop {
    position: relative !important;
    bottom: auto !important;
    top: auto !important;
    display: block !important;
    /* Тень снизу убрать — она для полноэкранного режима */
    box-shadow: none !important;
    border-top: none !important;
    border-radius: 0 0 12px 12px !important;
}

/* Клавиатура вписывается в ширину панели; размеры клавиш MathLive считает сам. */
.mfe-kb-host .MLK__plate {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border: none !important;
}
.mfe-kb-host .MLK__layer {
    box-sizing: border-box;
    width: 100%;
}
.mfe-kb-host [class^="MLK__"],
.mfe-kb-host [class*=" MLK__"] {
    box-sizing: border-box;
}
/* Скрываем tooltip-попап клавиш (::after-подсказку), но не сами элементы с этим классом */
.mfe-kb-host [data-tooltip]::after,
.mfe-kb-host [data-tooltip]::before {
    display: none !important;
    content: none !important;
}
.mfe-kb-host .MLK__keycap:hover,
.mfe-kb-host .action:hover,
.mfe-kb-host .MLK__keycap:active,
.mfe-kb-host .action:active {
    box-shadow: none !important;
}

/* Пока редактируется формула — прячем обычное поле ввода целиком, чтобы нельзя
   было случайно отправить сообщение без подтверждённой формулы. */
.cb-composer-wrap:has(.cb-composer-inner.mfe-editing) { display: none; }
.chat-input-bar.mfe-editing { display: none; }

/* =========================
   Админ: управление токенами ИИ
   ========================= */
.admin-tokens {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}
.admin-tokens h1 {
    margin-top: 0;
}
.admin-tokens-intro {
    color: rgba(0, 0, 0, 0.7);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 20px 0;
}
.admin-tokens-search {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.admin-tokens-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 1px solid rgba(19, 49, 108, 0.18);
    border-radius: var(--radius-btn);
    font-family: var(--font-main);
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.admin-tokens-input:focus {
    border-color: rgba(54, 120, 168, 0.65);
}
.admin-tokens-btn {
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-btn);
    background: var(--color-btn-gradient);
    color: #fff;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}
.admin-tokens-btn:hover { opacity: 0.92; }
.admin-tokens-btn:disabled { opacity: 0.5; cursor: default; }
.admin-tokens-btn--ghost {
    background: transparent;
    color: rgba(19, 49, 108, 1);
    border: 1px solid rgba(19, 49, 108, 0.3);
}
.admin-tokens-btn--ghost:hover {
    background: rgba(19, 49, 108, 0.06);
    opacity: 1;
}
.admin-tokens-hint {
    color: rgba(0, 0, 0, 0.5);
    font-size: 13px;
    margin-bottom: 16px;
}
.admin-tokens-results {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-token-card {
    border: 1px solid rgba(19, 49, 108, 0.14);
    border-radius: var(--radius-main);
    padding: 18px 20px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(17, 34, 62, 0.05);
}
.admin-token-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.admin-token-card__ident {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.admin-token-card__username {
    font-weight: 800;
    font-size: 16px;
    color: rgba(19, 49, 108, 1);
    word-break: break-word;
}
.admin-token-card__email,
.admin-token-card__name {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.55);
    word-break: break-word;
}
.admin-token-card__role {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(100, 100, 100, 0.12);
    color: rgba(50, 50, 50, 0.9);
    white-space: nowrap;
    flex-shrink: 0;
}
.admin-token-card__role.is-admin {
    background: rgba(19, 49, 108, 0.12);
    color: rgba(19, 49, 108, 1);
}

.admin-token-card__status {
    margin-bottom: 16px;
}
.admin-token-bar {
    height: 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.07);
    overflow: hidden;
    margin-bottom: 10px;
}
.admin-token-bar__fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
    background: #9aa7b8;
}
.admin-token-bar__fill.is-ok       { background: linear-gradient(90deg, #2fa96b, #37c47e); }
.admin-token-bar__fill.is-medium   { background: linear-gradient(90deg, #d9a42b, #f0c14b); }
.admin-token-bar__fill.is-low      { background: linear-gradient(90deg, #e07b2a, #f0983f); }
.admin-token-bar__fill.is-critical { background: linear-gradient(90deg, #c0392b, #e05546); }
.admin-token-bar__fill.is-empty    { background: #b9c0cb; }
.admin-token-card__meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.admin-token-card__metarow {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.78);
}
.admin-token-card__metarow--muted {
    color: rgba(0, 0, 0, 0.45);
}

.admin-token-card__controls {
    border-top: 1px solid rgba(19, 49, 108, 0.1);
    padding-top: 14px;
}
.admin-token-card__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
    margin-bottom: 6px;
}
.admin-token-card__inputrow {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.admin-token-input {
    width: 220px;
    max-width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(19, 49, 108, 0.18);
    border-radius: var(--radius-btn);
    font-family: var(--font-main);
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.admin-token-input:focus {
    border-color: rgba(54, 120, 168, 0.65);
}
.admin-token-card__reqhint {
    font-size: 12px;
    color: rgba(54, 120, 168, 0.95);
    margin-top: 6px;
}
.admin-token-card__actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.admin-token-card__formstatus {
    margin-top: 10px;
    font-size: 13px;
    min-height: 16px;
    color: rgba(0, 0, 0, 0.55);
}
.admin-token-card__formstatus.is-ok { color: #1a7a1a; }
.admin-token-card__formstatus.is-error { color: #c0392b; }

/* Блок «оплачено до» */
.admin-token-card__paid {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(19, 49, 108, 0.14);
}
.admin-token-input--date { width: 180px; }

/* Статус оплаты в сводке карточки */
.admin-token-paid {
    font-weight: 600;
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    margin-top: 6px;
}
.admin-token-paid--active {
    color: #1a7a1a;
    background: rgba(26, 122, 26, 0.10);
}
.admin-token-paid--soon {
    color: #9a6400;
    background: rgba(214, 158, 0, 0.14);
}
.admin-token-paid--expired {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.12);
}

@media (max-width: 600px) {
    .admin-token-input { width: 100%; }
    .admin-token-input--date { width: 100%; }
    .admin-tokens-btn { flex: 1; }
}

/* ============================================================
   МОБИЛЬНЫЕ УТОЧНЕНИЯ (каталог, карточки заданий, редактор картинок)
   ============================================================ */
@media (max-width: 768px) {
    /* --- Стеклянная подложка шире: правый край почти касается узкого
           скроллбара (4px у правого края экрана) --- */
    .main-content {
        width: calc(100% - 8px);
        padding: 16px;
    }

    /* --- Каталог: компактнее заголовок и управляющие элементы --- */
    .main-content h1 {
        font-size: 24px;
    }
    .catalog-controls {
        margin-bottom: 16px;
        gap: 8px;
    }
    .catalog-section-btn {
        padding: 12px 14px;
        font-size: 1em;
    }
    .search-container {
        font-size: 16px;
        padding: 5px;
    }

    /* --- Карточки заданий (каталог/вариант/тема): меньше шрифт,
           межстрочный интервал и внутренние отступы --- */
    .card {
        padding: 16px;
        margin-top: 12px;
    }
    .col1-task {
        font-size: 16px;
        line-height: 1.4;
        /* Переносы длинных слов по дефису — только на мобилках, чтобы при
           выравнивании по левому краю не оставались большие пустоты справа. */
        hyphens: auto;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
        overflow-wrap: break-word;
    }
    /* Формулы (KaTeX) не переносим — это ломает вёрстку математики. */
    .col1-task .katex,
    .col1-task .katex-display {
        hyphens: manual;
        -webkit-hyphens: manual;
        -ms-hyphens: manual;
    }
    .col1-task .katex,
    .katex {
        font-size: 16px !important;
    }
    .task-source {
        font-size: 11px;
        margin-top: 10px;
    }

    /* --- Страница темы/задания: подложка к краям и h1 как в каталоге --- */
    .theme-layout {
        width: calc(100% - 8px);
        gap: 0;
    }
    .theme-tasks-col {
        width: 100%;
        padding: 16px;
    }
    .theme-tasks-col h1,
    #theme-page h1 {
        font-size: 24px;
    }
}

/* --- Редактор пометок на картинках (лайтбокс): панель инструментов во всю
       ширину с небольшими отступами, изображение центрируется симметрично --- */
@media (max-width: 620px) {
    .ilb-overlay {
        padding-left: 10px;
        padding-right: 10px;
    }
    .ilb-toolbar {
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
        width: auto;
        box-sizing: border-box;
        justify-content: center;
    }
    .ilb-stage {
        margin-left: auto;
        margin-right: auto;
    }
    .ilb-thick {
        flex: 1 1 auto;
        min-width: 80px;
        max-width: 160px;
    }
}