/* ============================================================
 * SECTIONS - AUTH
 * ============================================================ */

.auth-modal-new {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 100px -200px, #FFFFFF 31%, #82B7DC 99%, #82B7DC 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 3000;
    padding: 20px;
    overflow-y: auto;
    padding-top: 60px;
}

.auth-modal-new.active {
    display: flex;
}

.auth-modal-new-content {
    width: 100%;
    max-width: 400px;
    padding: 40px 24px;
    border-radius: 28px;
    background: transparent;
    animation: slideUpAuth 0.5s ease;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 0;
    border-bottom: none;
}

.auth-logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-logo {
    width: 55px;
    height: 55px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    box-shadow: none;
    margin-bottom: 12px;
}

.auth-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-logo-fallback {
    font-size: 36px;
    display: none;
}

.auth-title {
    font-size: 20px;
    font-weight: 300;
    color: #1C1C1C;
    letter-spacing: 2px;
    font-family: 'Cormorant Garamond', serif;
    margin-top: 20px;
}

.auth-title sup {
    font-size: 18px;
    vertical-align: super;
}

.auth-subtitle {
    font-size: 20px;
    color: #000000;
    margin: 0;
    font-weight: 300;
    letter-spacing: 0.2px;
    font-family: 'Jost', sans-serif;
}

.auth-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 30px;
}

.auth-instruction {
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 16px 4px;
    margin-left: 20px;
}

.auth-dots {
    display: flex;
    justify-content: left;
    gap: 2px;
    padding: 4px 2px;
    margin-top: -6px;
}

.instruction-link {
    color: #000000;
    text-decoration: underline;
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    transition: all 0.2s;
}

.instruction-link:hover {
    text-decoration: underline;
    color: #114185;
}

.instruction-title {
    font-size: 15px;
    font-weight: 600;
    color: #000000;
    letter-spacing: 0.6px;
    font-family: 'Jost', sans-serif;
    margin-left: -20px;
}

.instruction-list {
    list-style: decimal;
}

.instruction-list li {
    font-size: 15px;
    color: #000000;
    line-height: 1.5;
    font-family: 'Jost', sans-serif;
    font-weight: 400;
}

.auth-btn-primary,
.auth-btn-secondary {
    width: 100%;
    padding: 14px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    font-family: 'Jost', sans-serif;
    transition: all 0.3s;
    border: 2px solid #114185;
}

.auth-btn-primary {
    background: #3366A9;
    color: #FFFFFF;
    box-shadow: 0 4px 16px rgba(17, 65, 133, 0.2);
}

.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(17, 65, 133, 0.3);
}

.auth-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn-secondary {
    background: transparent;
    color: #114185;
}

.auth-btn-secondary:hover {
    background: rgba(17, 65, 133, 0.05);
    transform: translateY(-1px);
}

.auth-btn-secondary:active {
    transform: translateY(0);
}

.auth-message {
    padding: 12px 14px;
    border-radius: 8px;
    display: none;
    font-size: 13px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.auth-message.success {
    display: block;
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.auth-message.error {
    display: block;
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

#modal-auth-btn {
    width: 100%;
    border: none;
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Jost', sans-serif;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 16px;
}

#modal-auth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(17, 65, 133, 0.25);
}

#modal-auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#modal-auth-message {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    display: none;
    font-size: 13px;
    font-weight: 500;
    animation: slideDown 0.2s ease;
}

#modal-auth-message.success {
    display: block;
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

#modal-auth-message.error {
    display: block;
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Старая модалка авторизации */
.auth-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.auth-modal.active {
    display: flex;
}

.auth-modal-content {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.auth-modal h2 {
    font-size: 26px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.auth-modal > p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 4px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
}

.auth-modal .auth-form {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

.auth-modal .form-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    width: 100%;
    transition: all 0.2s;
}

.auth-modal .form-input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(17, 65, 133, 0.1);
    outline: none;
}

.auth-modal .hint {
    margin-top: 10px;
    padding: 12px;
    background: var(--bg-primary-light);
    border-left: 3px solid var(--primary);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    border-radius: 4px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
    font-size: 13px;
}

@media (max-width: 768px) {
    .auth-subtitle {
        font-size: 18px;
    }
}

/* ============================================================
 * SECTIONS - CHAT
 * ============================================================ */

#chat-section {
    padding: 0;
    display: none !important;
    flex-direction: column;
    height: 100%;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

#chat-section.active {
    display: flex !important;
}

#chat-section .chat-messages {
    padding: 24px 20px 12px;
}

@media (max-width: 768px) {
    #chat-section .chat-messages {
        padding: 70px 24px 12px;
    }
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
    position: relative;
    min-height: 0;
}

.chat-container.full-width .examples-section {
    display: none !important;
}

.chat-container.full-width .chat-messages {
    flex: 1;
    min-height: 0;
}

.chat-container.full-width .input-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0 20px 20px;
}

@media (max-width: 768px) {
    .chat-container {
        min-height: 0;
    }

    .chat-messages {
        padding: 20px 24px 12px;
        min-height: 0;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px 20px 12px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: msgIn 0.25s ease;
    padding: 6px 0;
}

.message.user {
    flex-direction: row-reverse;
}

.message.system {
    display: none !important;
}

.message > :is(p, .msg) {
    max-width: 72%;
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 15px;
    white-space: pre-wrap;
    font-family: 'Jost', sans-serif;
    font-weight: 400;
}

@media (max-width: 768px) {
    .message > :is(p, .msg) {
        max-width: 88%;
        /* На телефоне текст на пункт крупнее: 15px читались мелко. */
        font-size: 16px;
    }
}

.message.user > :is(p, .msg) {
    background: var(--user-bubble);
    color: var(--white);
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(17, 65, 133, 0.15);
}

.message.assistant > :is(p, .msg) {
    background: transparent;
    color: var(--text);
    border: none;
    border-bottom-left-radius: 4px;
    max-width: 80%;
}

@media (max-width: 768px) {
    .message.assistant > :is(p, .msg) {
        max-width: 92%;
    }
}

.message.system > :is(p, .msg) {
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    max-width: 100%;
}

/* --- Разметка внутри сообщения -------------------------------------
   Ответ приходит с разметкой (**важное**, списки, «## заголовок») и
   разбирается в теги, см. Utils.renderRichText в app.js. Отступы здесь
   скромные: пузырь узкий, и типографика «как в статье» в нём выглядит
   рыхло. --- */

.message > .msg {
    /* Переносы строк теперь дают сами абзацы и <br>, pre-wrap добавил бы
       поверх них пустые строки. */
    white-space: normal;
}

.message .msg-p {
    margin: 0;
}

.message .msg-p + *,
.message .msg-ul + *,
.message .msg-ol + * {
    margin-top: 10px;
}

.message .msg-h {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    font-family: 'Jost', sans-serif;
}

.message .msg-h + * {
    margin-top: 6px;
}

.message .msg-ul,
.message .msg-ol {
    margin: 0;
    padding-left: 20px;
}

.message .msg-ul li,
.message .msg-ol li {
    margin: 0;
}

.message .msg-ul li + li,
.message .msg-ol li + li {
    margin-top: 4px;
}

.message .msg strong {
    font-weight: 600;
}

.message.loading p {
    background: var(--ai-bubble);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 0;
}

.input-actions-inline {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    padding-right: 4px;
    flex-shrink: 0;
    margin-bottom: 2px;
}

/* ------------------------------------------------------------
 * Живая строка прогресса: «✻ Смотрю остатки на складе… (12с · 3 шага)».
 * Заполняется из /api/chat/progress/<id>, см. addLoading() и
 * renderLoadingSteps() в app.js. Раньше здесь был пузырь с точками и
 * растущий список шагов — список накапливался и уезжал вверх, хотя
 * пользователю важно только текущее действие и то, что процесс идёт.
 * ------------------------------------------------------------ */

.message.loading {
    flex-direction: column;
    align-items: flex-start;
}

.loading-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 2px 0;
    /* Тот же шрифт и кегль, что у сообщений (.message p) — строка стоит
       с ними в одной колонке и не должна выглядеть чужой. */
    font-family: 'Jost', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    animation: fadeInStep 0.25s ease-out;
}

/* Пульсирующая точка. Рисуется CSS, а не символом в тексте: так она
   ровно круглая в любой теме и шрифте, и не требует таймера в JS. */
.loading-glyph {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    /* baseline-выравнивание строки тянуло бы точку вниз — компенсируем. */
    align-self: center;
    border-radius: 50%;
    background: var(--primary);
    animation: glyphPulse 1.3s ease-in-out infinite;
}

.loading-status {
    /* Текст шага приходит с сервера и может быть любой длины —
       переносим, а не обрезаем: обрезанное действие ничего не сообщает. */
    min-width: 0;
}

.loading-meta {
    flex-shrink: 0;
    /* ⚠️ Было var(--text-muted) — в тёмной теме это почти фон, счётчик не
       читался. Берём тот же цвет, что у самой строки, и приглушаем
       прозрачностью: контраст остаётся достаточным в обеих темах. */
    color: var(--text-secondary);
    opacity: 0.75;
    font-family: 'Jost', sans-serif;
    font-size: 13px;
    /* Цифры одной ширины: иначе строка дёргается на каждой секунде. */
    font-variant-numeric: tabular-nums;
}

@keyframes glyphPulse {
    0%, 100% { opacity: 1;    transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.7); }
}

@keyframes fadeInStep {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Пользователь отключил анимации в системе — символ просто стоит. */
@media (prefers-reduced-motion: reduce) {
    .loading-glyph,
    .loading-line {
        animation: none;
        opacity: 1;
    }
}

/* ============================================================
 * SECTIONS - EXAMPLES
 * ============================================================ */

.examples-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 40px 24px 20px;
    background: transparent;
    border-radius: 0;
    border: none;
    margin: 0;
    animation: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    position: relative;
    padding-bottom: 20px;
    overflow: visible;
    max-height: none;
}

@media (max-width: 768px) {
    .examples-section {
        padding: 40px 24px 20px;
    }
}

.examples-section.hidden {
    display: none !important;
}

.divider-line {
    width: 327px;
    height: auto;
    margin: 0 auto;
    display: block;
}

@media (max-width: 768px) {
    .divider-line {
        width: 327px;
        height: auto;
        margin: 0 auto;
    }
}

.examples-section .help-grid {
    display: flex;
    flex-direction: column;
    padding: 0px 0px 0px;
    gap: 12px;
    margin: 0;
    flex: none;
    align-content: center;
    width: 100%;
    max-width: 327px;
    position: relative;
    overflow: visible;
}

@media (max-width: 768px) {
    .examples-section .help-grid {
        flex-direction: column;
        padding: 0px 0px 0px;
        gap: 12px;
        margin-bottom: 0;
        width: 100%;
        max-width: 327px;
        overflow: visible;
    }
}

.help-card-wrapper {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    opacity: 1;
    position: relative;
    overflow: visible;
}

@media (max-width: 768px) {
    .help-card-wrapper {
        width: 100%;
        overflow: visible;
    }
}

.help-card-wrapper:nth-child(1) {
    order: 1;
}

.help-card-wrapper:nth-child(2) {
    order: 2;
}

.help-grid.examples-active .help-card-wrapper:nth-child(1) {
    transform: translateY(-160px);
    z-index: 20;
}

.help-grid.examples-active .help-card-wrapper:nth-child(2) {
    opacity: 0;
    pointer-events: none;
    max-height: 0;
    margin: 0;
    transform: scale(0.95);
}

.help-grid.tips-active .help-card-wrapper:nth-child(2) {
    transform: translateY(-180px);
    z-index: 20;
}

.help-grid.tips-active .help-card-wrapper:nth-child(1) {
    opacity: 0;
    pointer-events: none;
    max-height: 0;
    margin: 0;
    transform: scale(0.95);
}

.examples-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.examples {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (max-width: 768px) {
    .examples {
        grid-template-columns: 1fr;
    }
}

.example-btn {
    padding: 10px 12px;
    background: var(--white);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    transition: all 0.2s;
    text-align: left;
    line-height: 1.4;
    font-family: 'Cormorant Garamond', serif;
}

.example-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-all-features {
    width: 100%;
    max-width: 327px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid #AAAAAA;
    color: #AAAAAA;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    transition: all 0.2s;
    font-family: 'Jost', sans-serif;
    margin: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(var(--button-offset, 0px));
    margin-top: calc(220px + var(--button-offset, 0px));
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .btn-all-features {
        border-color: #AAAAAA;
        color: #AAAAAA;
    }
}

.btn-all-features:hover {
    background: rgba(170, 170, 170, 0.1);
    border-color: #999999;
    color: #999999;
}

@media (max-width: 768px) {
    .btn-all-features:hover {
        background: rgba(170, 170, 170, 0.1);
        border-color: #999999;
        color: #999999;
    }
}

.btn-all-features:active {
    transform: scale(0.98);
}

/* ============================================================
 * SECTIONS - TABLES
 * ============================================================ */

.message.assistant-table {
    justify-content: flex-start;
    margin: 20px 0;
    animation: msgIn 0.25s ease;
}

.table-scroll {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Jost', sans-serif;
    font-size: 13px;
    min-width: 400px;
}

.data-table thead {
    background: rgba(17, 65, 133, 0.1);
}

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 11px 14px;
    color: var(--text);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.5);
}

/* ---- Сворачиваемые группы в таблице --------------------------------------
 * Строка-заголовок группы (контрагент или товар) + её строки. Группировка
 * включается во фронтенде только когда первая колонка реально повторяется —
 * см. groupTableRows() в app.js.
 * ------------------------------------------------------------------------ */

.data-table tbody tr.table-group-header,
.data-table tbody tr.table-group-header:nth-child(even) {
    /* Заголовок группы не должен попадать в «зебру»: иначе одни группы
       выглядят выделенными, другие нет, и структура читается хуже. */
    background: rgba(17, 65, 133, 0.06);
}

.data-table tbody tr.table-group-header:hover {
    background: rgba(17, 65, 133, 0.1);
}

.data-table td.table-group-title {
    padding: 10px 14px;
}

.table-group-toggle {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    text-align: left;
}

.table-group-toggle:hover {
    text-decoration: underline;
}

.table-group-count {
    color: var(--text-muted, #7a869a);
    font-size: 12px;
    margin-left: 6px;
}

.data-table td.table-group-total {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.data-table tbody tr.table-group-row td:first-child {
    /* Значение группы уже написано в заголовке — в строках оно пустое,
       и эта колонка работает как отступ. */
    border-left: 2px solid var(--border);
}

/* ============================================================
 * SECTIONS - FILE CARD (файл, сгенерированный агентом в чате)
 * ============================================================ */

.message.assistant-file {
    justify-content: flex-start;
    margin: 12px 0;
    animation: msgIn 0.25s ease;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    max-width: 340px;
    width: 100%;
}

.file-card-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.file-card-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-family: 'Jost', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-size {
    font-family: 'Jost', sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.file-card-download-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-lighter);
    color: var(--white, #fff);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.15s, opacity 0.15s;
}

.file-card-download-icon {
    width: 16px;
    height: 16px;
    /* У SVG, подключённого как <img>, нет доступа к CSS-цвету кнопки
       (см. icons/download.svg) — перекрашиваем в белый фильтром. */
    filter: brightness(0) invert(1);
}

.file-card-download-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.file-card-download-btn:active {
    transform: translateY(0);
}

.file-card-save-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* primary-lighter (не bg-hover — тот почти белый в светлой теме и
       "съел" бы принудительно-белую иконку) даёт достаточный контраст в обеих темах */
    background: var(--primary-lighter);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s, background-color 0.15s;
}

.file-card-save-icon {
    width: 16px;
    height: 16px;
    /* Как и с icons/download.svg: у <img> нет доступа к CSS-цвету кнопки,
       поэтому красим в белый фильтром — иконка видна независимо от темы. */
    filter: brightness(0) invert(1);
}

/* Сохранение недоступно на тарифе: кнопка видна, но погашена — скачивание
   рядом работает как обычно (см. setSavedState в app.js). */
.file-card-save-btn.is-locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.file-card-save-btn.is-locked:hover {
    transform: none;
}

.file-card-save-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.file-card-save-btn:active {
    transform: translateY(0);
}

.file-card-save-btn.is-saved {
    cursor: default;
    background: var(--primary);
}

.file-card-save-btn:disabled {
    opacity: 1;
}

@media (max-width: 768px) {
    .file-card {
        max-width: 100%;
    }
}

/* ============================================================
 * SECTIONS - НАСТРОЙКИ (раздел "Настройки" — чекбокс "Только аналитик")
 * ============================================================ */

.settings-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px;
}

.settings-page-title {
    font-family: 'Jost', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px;
}

.settings-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-hover);
}

.settings-row-info {
    flex: 1;
    min-width: 0;
}

.settings-row-title {
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.settings-row-desc {
    font-family: 'Jost', sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Переключатель — минимальный стилизованный checkbox без сторонних либ */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Ползунок на время сохранения настройки (см. initSettingsUI() в app.js). */
.settings-toggle input:disabled + .settings-toggle-slider {
    cursor: not-allowed;
    opacity: 0.45;
}

.settings-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.settings-toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--white, #fff);
    border-radius: 50%;
    transition: transform 0.15s;
}

.settings-toggle input:checked + .settings-toggle-slider {
    background: var(--primary);
}

.settings-toggle input:checked + .settings-toggle-slider::before {
    transform: translateX(18px);
}

.settings-toggle input:disabled + .settings-toggle-slider {
    opacity: 0.6;
    cursor: default;
}

/* ============================================================
 * SECTIONS - ВСЕ ВОЗМОЖНОСТИ
 * ============================================================ */

.features-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.features-page-title {
    font-family: 'Jost', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 10px;
}

.features-page-subtitle {
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0 0 24px;
    max-width: 640px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    font-family: 'Jost', sans-serif;
}

.feature-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.feature-card-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-hover);
    flex-shrink: 0;
}

.feature-card-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.feature-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.feature-card-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* ============================================================
 * SECTIONS - ПОМОЩЬ
 * ============================================================ */

.help-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.help-page-title {
    font-family: 'Jost', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.faq-question {
    font-family: 'Jost', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px;
}

.faq-answer {
    font-family: 'Jost', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================================
 * SECTIONS - ACTION CARD (предложенное агентом изменение МойСклад,
 * ждёт "Подтвердить"/"Отклонить" — см. addPendingActionCard в app.js)
 * ============================================================ */

.message.assistant-action {
    justify-content: flex-start;
    margin: 12px 0;
    animation: msgIn 0.25s ease;
}

.action-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-hover);
    max-width: 380px;
}

.action-card-info {
    min-width: 0;
}

.action-card-info:empty {
    display: none;
}

.action-card-status {
    font-family: 'Jost', sans-serif;
    font-size: 12px;
    color: var(--text-muted);
}

.action-card-status.is-confirmed {
    color: var(--success, #2e9e5b);
}

.action-card-status.is-rejected,
.action-card-status.is-failed {
    color: var(--danger, #e05252);
}

.action-card-buttons {
    display: flex;
    gap: 8px;
}

.action-card-btn {
    font-family: 'Jost', sans-serif;
    font-size: 12px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

.action-card-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.action-card-btn:active {
    transform: translateY(0);
}

.action-card-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.action-card-confirm {
    background: var(--primary);
    color: var(--white, #fff);
}

.action-card-reject {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .action-card {
        max-width: 100%;
    }
}

/* ============================================================
 * SECTIONS - PROFILE
 * ============================================================ */

#profile-section {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    overflow-y: auto;
    display: none !important;
    flex-direction: column;
}

#profile-section.active {
    display: flex !important;
}

.profile-container {
    width: 100%;
    max-width: 500px;
    animation: slideUp 0.3s ease;
    padding: 20px;
    margin-top: 0;
}

.profile-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.profile-header h2 {
    font-size: 26px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.5px;
    margin: 0;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 13px;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    color: var(--text);
    font-weight: 600;
    text-align: right;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

#profile-logout-btn {
    padding: 13px 20px;
    background: transparent;
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #DC2626;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    font-family: 'Jost', sans-serif;
}

#profile-logout-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

#profile-logout-btn:active {
    transform: translateY(0);
}

#profile-message {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    display: none;
    font-size: 13px;
    font-weight: 500;
}

#profile-message.success {
    display: block;
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

#profile-message.error {
    display: block;
    background: rgba(220, 38, 38, 0.15);
    color: #DC2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

@media (max-width: 768px) {
    .profile-container {
        max-width: 100%;
        padding: 70px 24px 20px;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .info-value {
        text-align: left;
        max-width: 100%;
        white-space: normal;
    }
    
    .profile-header {
        margin-bottom: 24px;
        padding-bottom: 20px;
    }
    
    .profile-avatar {
        font-size: 40px;
        margin-bottom: 10px;
    }
    
    .profile-header h2 {
        font-size: 22px;
    }
}

/* ============================================================
 * SECTIONS - EMPTY PAGES
 * ============================================================ */

.empty-page-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
    height: 100%;
}

.empty-page-content {
    text-align: center;
    animation: slideUp 0.3s ease;
}

.empty-page-content h2 {
    font-size: 32px;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 16px 0;
    letter-spacing: -0.5px;
}

@media (max-width: 768px) {
    .empty-page-content h2 {
        font-size: 24px;
    }
}

.empty-page-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

@media (max-width: 768px) {
    .empty-page-content p {
        font-size: 16px;
    }
}

#profile-section,
#reports-section,
#settings-section,
#all-features-section,
#help-section {
    font-family: 'Jost', sans-serif;
}

#help-section {
    padding: 0;
    display: none !important;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

#help-section.active {
    display: flex !important;
}

@media (max-width: 768px) {
    #help-section {
        padding: 70px 24px 20px;
    }
}

/* ============================================================
 * SECTIONS - REPORTS
 * ============================================================ */

#reports-section {
    display: none !important;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    overflow-y: auto;
}

#reports-section.active {
    display: flex !important;
}

.reports-container {
    width: 100%;
    padding: 20px;
    animation: slideUp 0.3s ease;
}

.reports-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 20px 0;
    letter-spacing: -0.5px;
    font-family: 'Jost', sans-serif;
}

.reports-table-wrapper {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Jost', sans-serif;
}

.reports-table thead {
    background: var(--bg-primary-light);
    border-bottom: 1px solid var(--border);
}

.reports-table th {
    padding: 16px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.reports-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.reports-table tbody tr:hover {
    background-color: var(--bg-hover);
}

.reports-table tbody tr:last-child {
    border-bottom: none;
}

.reports-table td {
    padding: 16px 12px;
    font-size: 14px;
    color: var(--text);
    vertical-align: middle;
    font-family: 'Jost', sans-serif;
}

/* Колонка Дата */
.col-date {
    width: 15%;
    min-width: 80px;
}

.reports-table td.col-date {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
}

/* Колонка Название отчета */
.col-name {
    width: 32%;
    min-width: 150px;
}

.report-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    /* ⚠️ Имя файла приходит от ассистента и бывает длинным и без пробелов
       («Выручка_и_прибыль_2026_по_месяцам.xlsx»). Без переноса такая строка
       задаёт таблице минимальную ширину и выдавливает правые колонки за
       край экрана. */
    overflow-wrap: anywhere;
}

.report-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.report-arrow {
    font-size: 18px;
    color: var(--primary);
    margin-left: 4px;
    display: inline-block;
}

/* Колонка Комментарий */
.col-comment {
    width: 30%;
    min-width: 130px;
}

.comment-dots {
    color: var(--text-muted);
    letter-spacing: 2px;
    font-size: 12px;
    user-select: none;
}

.comment-text {
    color: var(--text-secondary);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Колонка Действия ("⋮") */
.col-actions {
    width: 44px;
    min-width: 44px;
    text-align: center;
}

.report-actions {
    position: relative;
    display: inline-block;
}

.report-actions-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.report-actions-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.report-actions-menu {
    display: none;
    /* fixed, а не absolute: меню крепится к <body> (см. buildReportActionsMenu
       в app.js — .reports-table-wrapper режет overflow, absolute внутри неё
       обрезался бы). top/left проставляются из JS по getBoundingClientRect
       кнопки — это viewport-координаты, поэтому только fixed даёт совпадение. */
    position: fixed;
    z-index: 1000;
    min-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 6px;
    flex-direction: column;
    gap: 2px;
}

.report-actions-menu.is-open {
    display: flex;
}

.report-actions-item {
    text-align: left;
    padding: 9px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-family: 'Jost', sans-serif;
    cursor: pointer;
    transition: background-color 0.15s;
}

.report-actions-item:hover {
    background: var(--bg-hover);
}

.report-actions-item-danger {
    color: var(--error, #DC2626);
}

/* Колонка Размер */
.col-size {
    width: 14%;
    min-width: 60px;
    text-align: right;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
}

/* Пустое состояние */
.reports-empty-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.reports-empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.reports-empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

.reports-empty-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Адаптивность */
@media (max-width: 768px) {
    .reports-container {
        padding: 16px 16px 20px;
    }

    .reports-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .reports-table th,
    .reports-table td {
        padding: 12px 8px;
        font-size: 12px;
    }

    .col-date {
        width: 16%;
    }

    .col-name {
        width: 30%;
    }

    .col-comment {
        width: 28%;
    }

    .col-size {
        width: 16%;
    }

    .comment-dots,
    .comment-text {
        display: none;
    }

    .report-arrow {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .reports-table-wrapper {
        border-radius: 8px;
    }

    .reports-table th,
    .reports-table td {
        padding: 10px 6px;
        font-size: 11px;
    }

    .col-comment {
        display: none;
    }

    .col-date {
        width: 25%;
    }

    .col-name {
        width: 50%;
    }

    .col-size {
        width: 25%;
    }

    .reports-title {
        font-size: 18px;
    }
}

/* --- Телефон: строка отчёта — карточка, а не строка таблицы ------------
   Пять колонок в 360–430 px не помещаются: даже ужатые до 11px они уезжали
   за правый край, а .reports-table-wrapper их обрезал — «РАЗМ…» на краю
   экрана и недоступная кнопка «⋮». Поэтому на узких экранах таблица
   раскладывается по строкам. --- */

@media (max-width: 560px) {
    .reports-table,
    .reports-table tbody,
    .reports-table tr,
    .reports-table td {
        display: block;
        width: auto;
    }

    /* Шапка не нужна: подписи колонок заменяет сама раскладка карточки. */
    .reports-table thead {
        display: none;
    }

    .reports-table tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "date    size    actions"
            "name    name    name"
            "comment comment comment";
        align-items: center;
        gap: 2px 8px;
        padding: 12px 14px;
    }

    .reports-table td {
        padding: 0;
        font-size: 14px;
    }

    .reports-table td.col-date {
        grid-area: date;
        font-size: 12px;
    }

    .reports-table td.col-name {
        grid-area: name;
    }

    /* Размер встаёт рядом с датой: отдельная строка ради «14 КБ» не нужна. */
    .reports-table td.col-size {
        grid-area: size;
        justify-self: start;
        margin-left: 10px;
        font-size: 12px;
        color: var(--text-secondary);
    }

    .reports-table td.col-comment {
        grid-area: comment;
        display: block;
        font-size: 13px;
        color: var(--text-secondary);
    }

    .reports-table td.col-actions {
        grid-area: actions;
        justify-self: end;
    }

    /* Пунктир «.....» вместо комментария на узком экране только шумит —
       показываем строку, только если комментарий и правда написан. */
    .comment-text {
        display: block;
    }

    .comment-dots {
        display: none;
    }

    .report-link {
        font-size: 14px;
    }
}

/* ============================================================================
   INACTIVE SUBSCRIPTION MODAL
   ============================================================================ */

.inactive-subscription-modal.modal-overlay {
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.inactive-subscription-modal.modal-overlay.active {
    opacity: 1;
}

.inactive-subscription-modal .modal-content {
    /* ⚠️ Базовое правило .modal-content (components.css) задаёт background: white
       без привязки к теме — раньше здесь фон не переопределялся явно, и в тёмной
       теме карточка модалки оставалась белой (перекрывалась только заголовком/
       телом, но при первом кадре анимации и по краям всё равно проглядывал белый
       фон вместо тёмного). Явно привязываем к теме через переменную. */
    background: var(--bg-main);
    max-width: 440px;
    width: 90%;
    text-align: center;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(17, 65, 133, 0.18);
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    animation: none;
}

.inactive-subscription-modal.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.inactive-subscription-modal .modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px 24px 8px;
    border-bottom: none;
    background: linear-gradient(180deg, var(--bg-hover) 0%, var(--bg-main) 100%);
}

.inactive-subscription-modal .status-icon-badge {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: rgba(220, 38, 38, 0.1);
}

.inactive-subscription-modal .modal-header h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    font-family: 'Jost', sans-serif;
    color: var(--text);
}

.inactive-subscription-modal .modal-body {
    padding: 8px 28px 28px;
    background: var(--bg-main);
}

.inactive-subscription-content .modal-message {
    font-size: 15px;
    line-height: 1.6;
    font-family: 'Jost', sans-serif;
    color: var(--text-secondary);
    margin: 0 0 24px 0;
}

/* ⚠️ .info-label/.info-value используются и в разделе "Профиль" (index.html) —
   не удалять при чистке разметки inactive-subscription-modal, это общие классы. */
.info-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.info-value {
    color: var(--text);
    font-size: 13px;
    text-align: right;
}

.inactive-subscription-modal .modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.inactive-subscription-modal .modal-btn {
    flex: none;
    width: 100%;
    padding: 14px 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Jost', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
}

.inactive-subscription-modal .modal-btn-primary {
    background: var(--user-bubble);
    color: var(--text-white);
    box-shadow: 0 8px 20px rgba(17, 65, 133, 0.25);
}

.inactive-subscription-modal .modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(17, 65, 133, 0.32);
}

.inactive-subscription-modal .modal-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.inactive-subscription-modal .modal-btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ============================================================
 * DESKTOP ADAPTATIONS (main-content на широких экранах)
 * На мобильном многие блоки чата/профиля жёстко ограничены
 * узкими шириной ~327px и прижаты влево — на десктопе это
 * оставляет огромное пустое пространство справа. Здесь только
 * расширяем/центрируем эти блоки для широких экранов, не трогая
 * мобильную вёрстку (медиа-запрос ниже срабатывает только от 769px).
 * ============================================================ */

@media (min-width: 769px) {

    /* --- Профиль и отчёты: центрируем вместо прижатия к левому краю --- */
    #profile-section,
    #reports-section {
        align-items: center;
    }

    .profile-container {
        max-width: 560px;
    }

    .reports-container {
        max-width: 720px;
        margin: 0 auto;
    }

    /* --- Чат: стартовый экран (подсказки, разделитель, кнопка "Все возможности") --- */
    .divider-line {
        width: 420px;
    }

    .examples-section .help-grid,
    .btn-all-features {
        max-width: 420px;
    }

    /* --- Ширина колонки чата.
       ⚠️ ОДНО значение на сообщения и на поле ввода. Раньше их было два
       (900px и 640px), и поле ввода заметно не дотягивало до края таблиц в
       ответах агента — выглядело как съехавшая вёрстка. Таблицы «кто что
       купил» и остатки по складам широкие, поэтому колонка тоже шире. --- */
    .chat-container.full-width .input-wrapper,
    .input-wrapper {
        max-width: var(--chat-width);
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    /* ⚠️ Колонка сообщений НЕ ограничивается max-width, а растягивается на
       всю ширину с симметричными отступами. Причина — полоса прокрутки:
       она рисуется у правого края САМОГО прокручиваемого элемента, и при
       max-width висела бы вплотную к тексту, посреди экрана. Теперь
       прокручивается вся ширина, полоса уходит к правому краю окна, а
       содержимое всё так же стоит колонкой шириной --chat-width. */
    #chat-section .chat-messages,
    .chat-messages {
        max-width: none;
        width: 100%;
        /* ⚠️ Полоса прокрутки съедает ширину справа, и колонка сообщений
           уезжала бы влево на её половину относительно поля ввода (у него
           полосы нет). both-edges резервирует место с обеих сторон — центр
           колонки совпадает с центром поля ввода. Там, где свойство не
           поддерживается, вёрстка просто остаётся прежней. */
        scrollbar-gutter: stable both-edges;
        padding-left: max(32px, calc((100% - var(--chat-width)) / 2));
        padding-right: max(32px, calc((100% - var(--chat-width)) / 2));
    }

    #chat-section .chat-messages {
        padding-top: 24px;
        padding-bottom: 12px;
    }

    .chat-container.full-width .input-wrapper {
        padding: 8px 12px;
        margin-bottom: 16px;
    }

    /* --- Затемнение по краям прокрутки: содержимое растворяется в фоне,
       а не обрывается ровной линией у шапки и над полем ввода.
       ⚠️ Сделано маской самой колонки сообщений, а не полоской-градиентом
       поверх неё: полоску пришлось бы привязывать к высоте поля ввода, а
       оно растёт вместе с текстом — и затемнение уезжало бы. Маска всегда
       совпадает с краями области прокрутки. --- */
    .chat-messages {
        -webkit-mask-image: linear-gradient(
            to bottom,
            transparent 0,
            #000 36px,
            #000 calc(100% - 28px),
            transparent 100%
        );
        mask-image: linear-gradient(
            to bottom,
            transparent 0,
            #000 36px,
            #000 calc(100% - 28px),
            transparent 100%
        );
    }

    /* --- Пузыри сообщений: ограничиваем абсолютной шириной, чтобы не растягивались на весь экран --- */
    .message > :is(p, .msg) {
        max-width: min(72%, 760px);
    }

    .message.assistant > :is(p, .msg) {
        max-width: min(82%, 820px);
    }

    /* --- Логотип в шапке: на десктопе его роль уже выполняет логотип в
       боковой панели, в шапке он только занимает место. На мобильном
       сайдбар скрыт, поэтому там логотип остаётся. --- */
    .header-logo {
        display: none;
    }

    /* --- Шапка на десктопе почти пуста: логотипа нет, шестерёнки нет,
       бургер скрыт при открытом сайдбаре. Оставшиеся 60px высоты — просто
       пустая полоса над чатом, поэтому схлопываем её до высоты кнопки
       «назад». Разделительная линия под шапкой убрана там же. --- */
    .app-header {
        height: auto;
        min-height: 0;
        padding: 8px 30px 0;
    }

    .deviding-line {
        display: none;
    }
}
/* ============================================================
 * SIDEBAR - Кнопки мессенджеров (Telegram / Max)
 * ============================================================ */

/* Блок «Мобильная версия» стоит внизу боковой панели, сразу над
   разделительной полосой футера (см. .sidebar-footer в main.css). */
.sidebar-mobile {
    padding: 0 12px;
    margin-bottom: 12px;
}

.sidebar-mobile-title {
    margin-bottom: 8px;
    font-family: 'Jost', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-messengers {
    display: flex;
    gap: 8px;
}

/* ⚠️ На телефоне блока нет вовсе: человек уже сидит с телефона, и
   предлагать ему «открыть мобильную версию» бессмысленно — кнопки только
   занимают место в и без того узкой панели. Скрываем весь блок вместе с
   заголовком, а не только кнопки, иначе остался бы висеть заголовок. */
@media (max-width: 768px) {
    .sidebar-mobile {
        display: none;
    }
}

.messenger-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 10px;
    border: 1px solid var(--border, #E5E9F0);
    background: var(--bg-card, #FFFFFF);
    color: var(--text-secondary, #5A6A7E);
    font-family: 'Jost', sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.messenger-btn .messenger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.messenger-btn .messenger-icon svg {
    display: block;
}

.messenger-btn .messenger-icon img {
    display: block;
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.messenger-btn:hover {
    background: var(--bg-hover, #F0F4FF);
    border-color: var(--border-active, #82B7DC);
    color: var(--primary, #3366A9);
}

body.dark-theme .messenger-btn {
    background: #1E2736;
    border-color: var(--border);
    color: var(--text-secondary);
}

body.dark-theme .messenger-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}
/* ===== Сотрудники в мессенджерах (TeamPanel в app.js) =====
   Карточка #profile-team-card в разделе «Профиль»; видна только владельцу. */
.team-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-family: 'Jost', sans-serif;
}
.team-entry-usage { font-size: 13px; color: var(--text-secondary, #5A6A7E); }
.team-entry-btn {
    padding: 7px 14px; border-radius: 8px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 13px; font-weight: 500;
    border: 1px solid var(--primary, #3366A9);
    background: none; color: var(--primary, #3366A9);
}
.team-entry-btn:hover { background: var(--primary, #3366A9); color: #FFFFFF; }
body.dark-theme .team-entry-btn:hover { color: #0F1419; }

/* Переключатель внутри карточки профиля: рамку и фон даёт сама .info-card. */
.info-card .settings-row { padding: 0; border: none; background: none; }

.team-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 16, 26, 0.45);
}
.team-modal {
    width: min(520px, 100%);
    max-height: calc(var(--app-height) - 32px);
    overflow-y: auto;
    padding: 20px;
    border-radius: 14px;
    background: var(--bg-card, #FFFFFF);
    color: var(--text, #1C1C1C);
    font-family: 'Jost', sans-serif;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
body.dark-theme .team-modal { background: #1A2230; }
.team-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.team-title { font-size: 17px; font-weight: 600; }
.team-close {
    border: none; background: none; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--text-muted, #8A97A8);
}
.team-usage { font-size: 13px; color: var(--text-muted, #8A97A8); margin-bottom: 14px; }
.team-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.team-row {
    display: flex; flex-direction: column; gap: 6px;
    padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--border, #E5E9F0);
}
.team-name { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.team-owner {
    margin-left: 8px; padding: 1px 6px; border-radius: 6px;
    font-size: 11px; font-weight: 500;
    background: var(--bg-hover, #F0F4FF); color: var(--primary, #3366A9);
}
.team-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.team-chip { font-size: 12px; color: var(--text-secondary, #5A6A7E); }
.team-chip.is-disabled { color: #C0392B; }
.team-unlink {
    border: none; background: none; padding: 0; cursor: pointer;
    font-family: inherit; font-size: 12px; color: var(--text-muted, #8A97A8);
    text-decoration: underline;
}
.team-unlink:hover { color: #C0392B; }
.team-empty { font-size: 13px; color: var(--text-muted, #8A97A8); }
.team-invite {
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 14px; padding: 12px; border-radius: 10px;
    background: var(--bg-hover, #F0F4FF);
}
body.dark-theme .team-invite { background: #232D3D; }
.team-invite-note { font-size: 12px; color: var(--text-secondary, #5A6A7E); }
.team-invite-line { display: flex; align-items: center; gap: 8px; }
.team-invite-label { width: 64px; flex-shrink: 0; font-size: 12px; font-weight: 500; }
.team-invite-url {
    flex: 1; min-width: 0; padding: 6px 8px; border-radius: 8px;
    border: 1px solid var(--border, #E5E9F0);
    background: var(--bg-card, #FFFFFF); color: inherit;
    font-family: ui-monospace, monospace; font-size: 12px;
}
body.dark-theme .team-invite-url { background: #1A2230; }
.team-copy, .team-invite-btn {
    padding: 7px 12px; border-radius: 8px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 13px; font-weight: 500;
    border: 1px solid var(--primary, #3366A9);
}
.team-copy { background: none; color: var(--primary, #3366A9); white-space: nowrap; }
.team-invite-btn { width: 100%; background: var(--primary, #3366A9); color: #FFFFFF; }
.team-invite-btn:disabled { opacity: 0.6; cursor: default; }
.team-error { margin-bottom: 12px; font-size: 13px; color: #C0392B; }

/* ===== Раздел «Компания» (CompanySection в app.js) ===== */
/* width: 100% обязательно: секция центрирует содержимое, и без него страница
   сжималась до ширины одной карточки — сетка складывала их в столбик. */
.company-page { width: 100%; max-width: 960px; }
.company-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px;
}
.company-head .settings-page-title { margin: 0; overflow-wrap: anywhere; }
.company-settings-btn {
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; width: 36px; height: 36px; padding: 0;
    border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary);
    cursor: pointer; transition: color 0.2s ease, border-color 0.2s ease;
}
.company-settings-btn:hover { color: var(--primary); border-color: var(--primary); }
/* display: inline-flex выше перебил бы атрибут hidden (кнопка только владельцу). */
.company-settings-btn[hidden] { display: none; }
.company-settings-btn svg { transition: transform 0.3s ease; }
.company-settings-btn:hover svg { transform: rotate(45deg); }

.company-periods {
    display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 16px;
    border-radius: 10px; border: 1px solid var(--border); background: var(--bg-card);
}
.company-period {
    padding: 6px 14px; border: none; border-radius: 7px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 13px; font-weight: 500;
    background: none; color: var(--text-secondary);
}
.company-period:hover { color: var(--text); }
.company-period.is-active { background: var(--primary); color: #FFFFFF; }
body.dark-theme .company-period.is-active { color: #0F1419; }

.company-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
/* На десктопе — всегда один ряд из трёх карточек, на телефоне — столбик. */
@media (min-width: 769px) {
    .company-dashboard { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.company-card {
    display: flex; flex-direction: column; gap: 6px;
    padding: 18px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-card);
    font-family: 'Jost', sans-serif;
}
.company-card-label {
    font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
    text-transform: uppercase; color: var(--primary);
}
.company-card-value {
    font-size: clamp(20px, 2vw, 26px); font-weight: 600; color: var(--text);
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums; margin-bottom: 4px;
}
.company-card-row {
    display: flex; justify-content: space-between; gap: 12px;
    font-size: 13px; color: var(--text-secondary);
}
.company-card-row-value { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.company-delta { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.company-delta.is-up { color: #2E9E5B; }
.company-delta.is-down { color: #C0392B; }
body.dark-theme .company-delta.is-up { color: #5CCB8A; }
body.dark-theme .company-delta.is-down { color: #F07A6A; }

.company-state {
    grid-column: 1 / -1;
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
    padding: 18px; border-radius: var(--radius);
    border: 1px dashed var(--border); color: var(--text-muted);
    font-family: 'Jost', sans-serif; font-size: 13px;
}
.company-state.is-error { color: #C0392B; }
body.dark-theme .company-state.is-error { color: #F07A6A; }
.company-retry {
    padding: 5px 12px; border-radius: 8px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 12px;
    border: 1px solid var(--primary); background: none; color: var(--primary);
}

.company-settings-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.company-settings-label { font-size: 13px; font-weight: 500; }
.company-settings-input {
    padding: 9px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg-input, var(--bg-card));
    color: var(--text); font-family: 'Jost', sans-serif; font-size: 14px;
}
.company-settings-input:focus { outline: none; border-color: var(--primary); }
.company-settings-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }

/* ===== Мобильный чат без шапки =====
   В чате на телефоне от шапки остаётся только бургер (он position: fixed,
   см. .burger-btn в main.css). Логотип и разделительная линия убраны, а
   сообщения растворяются в фоне у верхнего края, чтобы текст не лез под
   кнопку. Как и на десктопе, это маска самой ленты, а не полоска поверх.
   Класс .chat-active ставит switchSection в app.js. */
@media (max-width: 768px) {
    /* ⚠️ Шапку не скрываем целиком: бургер лежит внутри неё, и display: none
       спрятал бы и его, несмотря на position: fixed. Схлопываем по высоте. */
    .main-content.chat-active .app-header {
        height: 0;
        padding: 0;
    }

    .main-content.chat-active .header-logo,
    .main-content.chat-active .deviding-line {
        display: none;
    }

    .main-content.chat-active #chat-section .chat-messages {
        /* От положения бургера (--burger-offset, см. main.css): без
           Telegram это 27px, и значения выходят прежние — 72/40/88px. */
        padding-top: calc(var(--burger-offset) + 45px);
        -webkit-mask-image: linear-gradient(to bottom, transparent 0,
            transparent calc(var(--burger-offset) + 13px), #000 calc(var(--burger-offset) + 61px));
        mask-image: linear-gradient(to bottom, transparent 0,
            transparent calc(var(--burger-offset) + 13px), #000 calc(var(--burger-offset) + 61px));
    }
}

/* ===== Раздел «Отчёты»: вкладки, лимит, мини-FAQ, страницы =====
   (ReportsManager.initTabs / renderMeta / renderPagination в app.js) */

/* У .reports-table-wrapper и др. свой display — без этого атрибут hidden
   бы не срабатывал. */
#reports-section [hidden] { display: none !important; }

.reports-tabs {
    display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
    margin-bottom: 16px; max-width: 100%;
    border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card);
}
.reports-tab {
    padding: 8px 16px; border: none; border-radius: 9px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 14px; font-weight: 500;
    background: none; color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
}
.reports-tab:hover { color: var(--text); }
.reports-tab.is-active { background: var(--primary); color: #FFFFFF; }
body.dark-theme .reports-tab.is-active { color: #0F1419; }

.reports-meta {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
    margin-bottom: 12px;
    font-family: 'Jost', sans-serif; font-size: 13px; color: var(--text-secondary);
}
.reports-meta:empty { display: none; }
.reports-meta-note { color: #B45309; font-weight: 500; }
body.dark-theme .reports-meta-note { color: #F2B45A; }

.reports-faq {
    max-width: 640px; padding: 22px 24px;
    border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card);
    font-family: 'Jost', sans-serif; color: var(--text-secondary); font-size: 14px; line-height: 1.5;
}
.reports-faq-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.reports-faq-lead { margin: 0 0 14px; }
.reports-faq-steps {
    margin: 0 0 16px; padding: 0; list-style: none; counter-reset: faq-step;
    display: flex; flex-direction: column; gap: 12px;
}
.reports-faq-steps li {
    position: relative; padding-left: 38px; counter-increment: faq-step;
}
.reports-faq-steps li::before {
    content: counter(faq-step);
    position: absolute; left: 0; top: -1px;
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--bg-hover); color: var(--primary);
    font-size: 13px; font-weight: 600;
}
.reports-faq-steps strong { color: var(--text); font-weight: 500; }
.reports-faq-facts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px;
    margin: 0 0 18px; padding-top: 14px; border-top: 1px solid var(--border);
}
.reports-faq-facts dt { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.reports-faq-facts dd { margin: 0; font-size: 13px; }
.reports-faq-btn {
    padding: 9px 18px; border-radius: 9px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 14px; font-weight: 500;
    border: none; background: var(--primary); color: #FFFFFF;
}
body.dark-theme .reports-faq-btn { color: #0F1419; }
.reports-faq-btn:hover { opacity: 0.9; }
.reports-faq--soon .reports-faq-lead { margin: 0; }

.reports-pagination {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: 6px; margin-top: 16px;
}
.reports-pagination:empty { display: none; }
.reports-page-btn {
    min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 14px; font-variant-numeric: tabular-nums;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
}
.reports-page-btn:hover:not(:disabled):not(.is-active) { border-color: var(--primary); color: var(--primary); }
.reports-page-btn.is-active { background: var(--primary); border-color: var(--primary); color: #FFFFFF; cursor: default; }
body.dark-theme .reports-page-btn.is-active { color: #0F1419; }
.reports-page-btn:disabled { opacity: 0.4; cursor: default; }
.reports-page-gap { padding: 0 2px; color: var(--text-muted); }

@media (max-width: 768px) {
    .reports-tabs { display: flex; }
    .reports-tab { flex: 1; padding: 8px 10px; font-size: 13px; }
    .reports-faq { padding: 18px 16px; }
}

/* ===== «Профиль» → Отчёты по расписанию (SchedulesPanel в app.js) ===== */
#profile-schedules { display: flex; flex-direction: column; gap: 10px; font-family: 'Jost', sans-serif; }
.schedule-empty { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.schedule-row {
    display: flex; flex-direction: column; gap: 4px;
    padding: 12px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-main);
}
.schedule-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.schedule-title { font-size: 14px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.schedule-when { font-size: 13px; color: var(--primary); font-weight: 500; }
.schedule-status, .schedule-last { font-size: 12px; color: var(--text-secondary); }
.schedule-status.is-muted { color: var(--text-muted); }
.schedule-status.is-info { color: var(--primary); }
.schedule-status.is-warn { color: #B45309; }
.schedule-last.is-error { color: #C0392B; }
body.dark-theme .schedule-status.is-warn { color: #F2B45A; }
body.dark-theme .schedule-last.is-error { color: #F07A6A; }
.schedule-prompt {
    margin-top: 2px; font-size: 12px; line-height: 1.45; color: var(--text-muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.schedule-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.schedule-btn {
    padding: 5px 11px; border-radius: 7px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 12px; font-weight: 500;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
}
.schedule-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.schedule-btn.is-danger:hover:not(:disabled) { border-color: #C0392B; color: #C0392B; }
.schedule-btn:disabled { opacity: 0.45; cursor: default; }
.schedule-footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 2px;
}
.schedule-usage { font-size: 12px; color: var(--text-muted); }
.schedule-add {
    padding: 7px 14px; border-radius: 8px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 13px; font-weight: 500;
    border: 1px solid var(--primary); background: none; color: var(--primary);
}
.schedule-add:hover { background: var(--primary); color: #FFFFFF; }
body.dark-theme .schedule-add:hover { color: #0F1419; }

/* ===== «Профиль» → часовой пояс, «Отчёты», «Сигналы» (ProfileSettings в app.js) ===== */
.delivery-note { margin: -4px 0 12px; font-family: 'Jost', sans-serif; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.delivery-form { display: flex; flex-direction: column; gap: 8px; font-family: 'Jost', sans-serif; }
.delivery-row { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.delivery-field { display: flex; flex-direction: column; gap: 4px; min-width: 96px; }
.delivery-form[data-kind="timezone"] .delivery-field { min-width: min(320px, 100%); }
.delivery-label { font-size: 11px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; color: var(--text-muted); }
.delivery-select {
    padding: 7px 10px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-input, var(--bg-card)); color: var(--text);
    font-family: 'Jost', sans-serif; font-size: 14px;
}
.delivery-select:focus { outline: none; border-color: var(--primary); }
.delivery-hint { font-size: 12px; color: var(--text-secondary); }
.delivery-status { min-height: 16px; font-size: 12px; color: var(--text-muted); }
.delivery-status.is-error { color: #C0392B; }
body.dark-theme .delivery-status.is-error { color: #F07A6A; }

/* ===== «Профиль»: шапка, вкладки, панели =====
   Разметка — index.html (#profile-section), вкладки — selectProfileTab в app.js. */
#profile-section [hidden] { display: none !important; }

@media (min-width: 769px) {
    .profile-container { max-width: 680px; }
}

.profile-hero {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 20px; font-family: 'Jost', sans-serif;
}
.profile-hero .profile-avatar {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 56px; height: 56px; margin: 0; border-radius: 50%;
    background: var(--bg-primary-light, var(--bg-hover)); color: var(--primary);
    font-size: 20px; font-weight: 600; letter-spacing: 0.5px;
}
.profile-hero-text { min-width: 0; }
.profile-hero-text h2 {
    margin: 0; font-size: 22px; font-weight: 600; line-height: 1.25;
    color: var(--text); overflow-wrap: anywhere;
}
.profile-hero-meta { margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.profile-hero-meta:empty { display: none; }

.profile-tabs {
    display: flex; gap: 4px; padding: 4px; margin-bottom: 16px;
    border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card);
    overflow-x: auto; scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tab {
    flex: 1 0 auto; padding: 8px 14px; border: none; border-radius: 9px; cursor: pointer;
    font-family: 'Jost', sans-serif; font-size: 14px; font-weight: 500; white-space: nowrap;
    background: none; color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.is-active { background: var(--primary); color: #FFFFFF; }
body.dark-theme .profile-tab.is-active { color: #0F1419; }

.profile-pane { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }

/* Карточки внутри профиля не «подсвечиваются» при наведении: в них поля
   ввода и кнопки, и смена фона под курсором только отвлекает. */
#profile-section .info-card:hover { background: var(--bg-card); border-color: var(--border); }

.profile-subblock + .profile-subblock {
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.profile-subtitle {
    display: flex; align-items: center; gap: 8px; margin: 0 0 4px;
    font-family: 'Jost', sans-serif; font-size: 14px; font-weight: 600; color: var(--text);
}
.profile-subblock .delivery-note { margin: 0 0 12px; }
.profile-soon {
    padding: 1px 7px; border-radius: 6px;
    font-size: 11px; font-weight: 500; text-transform: lowercase;
    background: var(--bg-hover); color: var(--text-secondary);
}

@media (max-width: 768px) {
    .profile-hero { gap: 12px; margin-bottom: 16px; }
    .profile-hero .profile-avatar { width: 48px; height: 48px; font-size: 18px; }
    .profile-hero-text h2 { font-size: 19px; }
    .profile-tab { flex: 0 0 auto; font-size: 13px; padding: 8px 12px; }
    /* На телефоне строки «Тариф / Статус» остаются в одну строку — они короткие. */
    #profile-section .info-row { flex-direction: row; align-items: center; }
    #profile-section .info-value { text-align: right; }
}

/* ===== «Компания» → сработавшие сигналы (CompanySection.renderSignals) ===== */
.company-signals { margin-top: 22px; font-family: 'Jost', sans-serif; }
.company-signals-title {
    margin: 0 0 10px; font-size: 13px; font-weight: 600;
    letter-spacing: 0.3px; text-transform: uppercase; color: var(--primary);
}
.company-signals-list { display: flex; flex-direction: column; gap: 10px; }
.company-signal {
    padding: 14px 16px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-card);
}
/* Новое срабатывание — с отметкой слева, чтобы его было видно среди прочих. */
.company-signal.is-new { border-left: 3px solid var(--primary); }
.company-signal-head {
    display: flex; flex-wrap: wrap; align-items: baseline;
    justify-content: space-between; gap: 2px 12px; margin-bottom: 4px;
}
.company-signal-title { font-size: 14px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.company-signal-at { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.company-signal-text { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

/* Пример диалога в пустой карточке «Сигналы» («Профиль»). */
.schedule-example {
    margin-top: 10px; padding: 12px 14px; border-radius: 10px;
    background: var(--bg-main); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 6px;
}
.schedule-example-title {
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px;
}
.schedule-example-line { display: flex; gap: 8px; font-size: 12px; line-height: 1.45; }
.schedule-example-who { flex-shrink: 0; width: 68px; font-weight: 600; color: var(--primary); }
.schedule-example-what { color: var(--text-secondary); }
