/* Виджет помощника и блок инструкций — те же токены, что панель / v6 (--v6-*) */

.help-instructions-list {
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.help-instructions-list__item {
    margin: 0;
    padding: 16px 18px;
    border: 1px solid var(--v6-border, #e2e8f0);
    border-radius: 12px;
    background: var(--v6-card, #fff);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.help-instructions-list__item:hover {
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.help-instructions-list__link {
    font-weight: 600;
    font-size: 1rem;
    color: var(--v6-accent, #f59e0b);
    text-decoration: none;
    font-family: var(--v6-font, inherit);
}

.help-instructions-list__link:hover {
    text-decoration: underline;
}

.help-instructions-list__excerpt {
    margin: 8px 0 0;
    font-size: 0.875rem;
    color: var(--v6-muted, #64748b);
    line-height: 1.5;
}

.help-instruction-body {
    margin-top: 16px;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--v6-text, #0f172a);
    font-family: var(--v6-font, inherit);
}

.help-instruction-body h2,
.help-instruction-body h3 {
    margin: 1.25em 0 0.5em;
    font-weight: 700;
}

.help-instruction-body p {
    margin: 0.65em 0;
}

.help-instruction-body ul,
.help-instruction-body ol {
    margin: 0.5em 0 0.5em 1.25em;
}

.help-instruction-back {
    margin-top: 28px;
}

.help-instruction-back a {
    font-family: var(--v6-font, inherit);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--v6-accent, #f59e0b);
    text-decoration: none;
}

.help-instruction-back a:hover {
    text-decoration: underline;
}

.help-instructions-list--compact {
    gap: 10px;
    margin-top: 12px;
}

.help-instructions-list--compact .help-instructions-list__item {
    padding: 12px 14px;
}

/* ——— Каталог /instructions ——— */
.v6-tool-card--instructions-index {
    padding-bottom: 28px;
}

.v6-tool-card--instructions-category {
    padding-bottom: 28px;
}

.instructions-category-head {
    margin-bottom: 16px;
}

.instructions-category-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
}

.instructions-category-head__title {
    margin: 0;
    flex: 1 1 200px;
    min-width: 0;
}

.instructions-category-product-pill {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
    padding: 5px 11px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--v6-accent, #d97706);
    background: var(--v6-accent-bg, #fffbeb);
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-family: var(--v6-font, inherit);
}

.instructions-category-count {
    margin: 8px 0 0;
    font-size: 0.875rem;
    color: var(--v6-muted, #64748b);
    line-height: 1.45;
}

.instructions-category-content {
    margin-top: 6px;
}

/* Сетка как у /documents; верхний отступ сетки из v6-docs-grid — слегка уменьшаем у первого блока */
.instructions-category-docs-grid {
    margin-top: 8px;
}

.instructions-category-empty {
    margin: 0;
    padding: 14px 16px;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--v6-muted, #64748b);
    border: 1px dashed var(--v6-border, #cbd5e1);
    border-radius: 12px;
    box-sizing: border-box;
}

@media (max-width: 520px) {
    .instructions-category-head__row {
        flex-direction: column;
        align-items: stretch;
    }

    .instructions-category-product-pill {
        align-self: flex-start;
    }
}

.instructions-catalog-hero__lead {
    max-width: 42rem;
}

.instructions-catalog {
    margin-top: 4px;
}

.instructions-catalog-section {
    margin-top: 22px;
}

.instructions-catalog-section:first-child {
    margin-top: 0;
}

.instructions-catalog-product-shell {
    padding: 20px 20px 16px;
    border-radius: 14px;
    border: 1px solid var(--v6-border, #e2e8f0);
    background: linear-gradient(165deg, rgba(255, 251, 235, 0.55) 0%, var(--v6-card, #fff) 42%);
}

.instructions-catalog-product-shell--solo {
    padding-bottom: 20px;
}

.instructions-catalog-product-title {
    margin: 0 0 16px;
    padding-left: 12px;
    border-left: 4px solid var(--v6-accent, #f59e0b);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--v6-text, #0f172a);
    font-family: var(--v6-font, inherit);
    line-height: 1.3;
}

.instructions-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 14px;
}

.instructions-catalog-card {
    padding: 16px 16px 14px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: var(--v6-card, #fff);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    min-height: 100%;
    box-sizing: border-box;
}

.instructions-catalog-card__title {
    margin: 0 0 12px;
    font-size: 0.9375rem;
    font-weight: 700;
    font-family: var(--v6-font, inherit);
    line-height: 1.35;
}

.instructions-catalog-card__title a {
    color: var(--v6-text, #0f172a);
    text-decoration: none;
}

.instructions-catalog-card__title a:hover {
    color: var(--v6-accent, #d97706);
}

.instructions-catalog-card__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instructions-catalog-card__list--solo {
    margin-top: 4px;
}

.instructions-catalog-card__item {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.instructions-catalog-card__link {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--v6-accent, #f59e0b);
    text-decoration: none;
    font-family: var(--v6-font, inherit);
    line-height: 1.4;
}

.instructions-catalog-card__link:hover {
    text-decoration: underline;
}

.instructions-catalog-card__hint {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--v6-muted, #64748b);
}

.instructions-catalog-card__empty {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--v6-muted, #64748b);
}

.instructions-catalog-card__empty a {
    color: var(--v6-accent, #f59e0b);
    font-weight: 600;
    text-decoration: none;
}

.instructions-catalog-card__empty a:hover {
    text-decoration: underline;
}

/* Шапка страницы одной инструкции: заголовок слева, PDF справа */
.help-instruction-show-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 0;
}

.help-instruction-show-head__main {
    flex: 1 1 240px;
    max-width: 100%;
    min-width: 0;
}

.help-instruction-show-head__main .v6-tool-card__title {
    margin-top: 0;
}

.help-instruction-show-head__actions {
    flex: 0 0 auto;
    align-self: flex-start;
    padding-top: 2px;
}

@media (max-width: 540px) {
    .help-instruction-show-head__actions {
        flex-basis: 100%;
    }

    .help-instruction-show-head__actions .help-instruction-pdf-link {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }
}

.help-instruction-pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--v6-border, #e2e8f0);
    background: var(--v6-card, #fff);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--v6-accent, #f59e0b);
    text-decoration: none;
    font-family: var(--v6-font, inherit);
}

.help-instruction-pdf-link:hover {
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.instructions-steps {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
    counter-reset: hi-step;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.instructions-step {
    counter-increment: hi-step;
    margin: 0;
    padding: 18px 18px 18px 52px;
    border: 1px solid var(--v6-border, #e2e8f0);
    border-radius: 14px;
    background: var(--v6-card, #fff);
    position: relative;
}

.instructions-step::before {
    content: counter(hi-step);
    position: absolute;
    left: 14px;
    top: 16px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.15);
    color: var(--v6-accent, #d97706);
    font-weight: 700;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--v6-font, inherit);
}

.instructions-step__title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--v6-text, #0f172a);
    font-family: var(--v6-font, inherit);
}

.instructions-step__body {
    margin-top: 0;
}

.instructions-step__figure {
    margin: 14px 0 0;
}

.instructions-step__img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--v6-border, #e2e8f0);
}

/* ——— FAB ——— */
.help-assistant-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10050;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    border: 2px solid var(--v6-accent, #f59e0b);
    cursor: pointer;
    background: var(--v6-accent, #f59e0b);
    color: #fff;
    box-shadow: 0 10px 28px rgba(245, 158, 11, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: filter 0.2s, transform 0.15s ease, box-shadow 0.2s;
}

.help-assistant-fab:hover {
    filter: brightness(1.08);
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.42);
}

.help-assistant-fab:active {
    transform: scale(0.97);
}

.help-assistant-fab:focus-visible {
    outline: 2px solid var(--v6-accent, #f59e0b);
    outline-offset: 3px;
}

.help-assistant-fab svg {
    display: block;
    width: 26px;
    height: 26px;
}

/* ——— Окно (как выпадающее меню уведомлений в панели) ——— */
.help-assistant-shell {
    position: fixed;
    right: 20px;
    bottom: 88px;
    z-index: 10051;
    width: min(392px, calc(100vw - 40px));
    max-height: min(576px, calc(100vh - 140px));
    display: none;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    font-family: var(--v6-font, 'Outfit', system-ui, sans-serif);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--v6-border, #e2e8f0);
    background: var(--v6-card, #fff);
}

.help-assistant-shell.is-open {
    display: flex;
}

.help-assistant-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--v6-card, #fff);
    border-bottom: 1px solid var(--v6-border, #e2e8f0);
    flex-shrink: 0;
}

.help-assistant-head__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.help-assistant-head__mark {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--v6-accent-bg, #fffbeb);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--v6-accent, #f59e0b);
}

.help-assistant-head__mark svg {
    width: 22px;
    height: 22px;
}

.help-assistant-head__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.help-assistant-head__title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--v6-text, #0f172a);
    line-height: 1.25;
}

.help-assistant-head__sub {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--v6-muted, #64748b);
    line-height: 1.3;
}

.help-assistant-head__close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--v6-text, #0f172a);
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.help-assistant-head__close:hover {
    background: var(--v6-main, #f1f5f9);
    color: var(--v6-accent, #f59e0b);
}

.help-assistant-head__close svg {
    width: 20px;
    height: 20px;
}

/* Вкладки — как .panel-finance__tab */
.help-assistant-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    background: var(--v6-main, #f1f5f9);
    border-bottom: 1px solid var(--v6-border, #e2e8f0);
    flex-shrink: 0;
}

.help-assistant-tabs button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--v6-muted, #64748b);
    border-radius: 10px;
    border: 1px solid var(--v6-border, #e2e8f0);
    background: var(--v6-card, #fff);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.help-assistant-tabs button:hover {
    border-color: var(--v6-accent, #f59e0b);
    color: var(--v6-text, #0f172a);
}

.help-assistant-tabs button.is-active {
    border-color: rgba(245, 158, 11, 0.55);
    background: var(--v6-accent-bg, #fffbeb);
    color: var(--v6-accent, #f59e0b);
}

.help-assistant-pane {
    flex: 1;
    min-height: 0;
    display: none;
    flex-direction: column;
}

.help-assistant-pane.is-active {
    display: flex;
}

.help-assistant-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    gap: 12px;
    display: flex;
    flex-direction: column;
    background: var(--v6-main, #f1f5f9);
}

.help-assistant-msgs::-webkit-scrollbar {
    width: 8px;
}

.help-assistant-msgs::-webkit-scrollbar-thumb {
    background: var(--v6-border, #cbd5e1);
    border-radius: 8px;
}

.help-assistant-msg {
    max-width: 94%;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    font-family: inherit;
}

.help-assistant-msg__p {
    margin: 0;
}

.help-assistant-msg__p + .help-assistant-msg__p {
    margin-top: 8px;
}

.help-assistant-msg__aside {
    margin: 10px 0 0;
    font-size: 0.8125rem;
    color: var(--v6-muted, #64748b);
    line-height: 1.45;
}

.help-assistant-msg__aside a {
    color: var(--v6-accent, #f59e0b);
    font-weight: 600;
    text-decoration: none;
}

.help-assistant-msg__aside a:hover {
    text-decoration: underline;
}

.help-assistant-msg--bot {
    align-self: flex-start;
    background: var(--v6-card, #fff);
    border: 1px solid var(--v6-border, #e2e8f0);
    color: var(--v6-text, #0f172a);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.help-assistant-msg--user {
    align-self: flex-end;
    background: var(--v6-accent-bg, #fffbeb);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: var(--v6-text, #0f172a);
}

.help-assistant-msg a {
    color: var(--v6-accent, #f59e0b);
    font-weight: 600;
    word-break: break-word;
}

.help-assistant-links {
    margin: 10px 0 0;
    padding-left: 1.15rem;
}

.help-assistant-links li {
    margin: 5px 0;
}

.help-assistant-links a {
    font-weight: 600;
    font-size: 0.8125rem;
}

/* Компоновщик сообщения — как .panel-form */
.help-assistant-composer {
    display: flex;
    gap: 10px;
    align-items: stretch;
    padding: 12px;
    border-top: 1px solid var(--v6-border, #e2e8f0);
    background: var(--v6-card, #fff);
    flex-shrink: 0;
}

.help-assistant-field {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--v6-border, #e2e8f0);
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--v6-text, #0f172a);
    background: var(--v6-card, #fff);
}

.help-assistant-field:focus {
    outline: none;
    border-color: var(--v6-accent, #f59e0b);
}

.help-assistant-field::placeholder {
    color: var(--v6-muted, #94a3b8);
}

.help-assistant-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid var(--v6-border, #e2e8f0);
    background: var(--v6-card, #fff);
    color: var(--v6-text, #0f172a);
    transition: border-color 0.2s, background 0.2s, filter 0.2s;
}

.help-assistant-btn:hover:not(:disabled) {
    border-color: var(--v6-accent, #f59e0b);
    background: var(--v6-accent-bg, #fffbeb);
}

.help-assistant-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.help-assistant-btn--primary {
    background: var(--v6-accent, #f59e0b);
    border-color: var(--v6-accent, #f59e0b);
    color: #fff;
}

.help-assistant-btn--primary:hover:not(:disabled) {
    background: var(--v6-accent, #f59e0b);
    border-color: var(--v6-accent, #f59e0b);
    color: #fff;
    filter: brightness(1.08);
}

.help-assistant-btn--sm {
    padding: 8px 14px;
    flex-shrink: 0;
}

.help-assistant-btn--block {
    width: 100%;
}

.help-assistant-tickets {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 0.8125rem;
    background: var(--v6-main, #f1f5f9);
}

.help-assistant-ticket {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--v6-border, #e2e8f0);
    margin-bottom: 8px;
    background: var(--v6-card, #fff);
}

.help-assistant-ticket:last-child {
    margin-bottom: 0;
}

.help-assistant-ticket__sub {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--v6-text, #0f172a);
    margin-bottom: 6px;
}

.help-assistant-ticket__meta {
    font-size: 0.75rem;
    color: var(--v6-muted, #64748b);
}

.help-assistant-ticket__num {
    font-size: 0.75rem;
    color: var(--v6-muted, #64748b);
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}

.help-assistant-ticket--clickable {
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.help-assistant-ticket--clickable:hover {
    border-color: var(--v6-accent, #f59e0b);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.help-assistant-ticket--clickable:focus-visible {
    outline: 2px solid var(--v6-accent, #f59e0b);
    outline-offset: 2px;
}

.help-assistant-ticket-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.help-assistant-ticket-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.help-assistant-ticket-modal__dialog {
    position: relative;
    width: min(620px, calc(100vw - 24px));
    height: min(82vh, 720px);
    background: var(--v6-card, #fff);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--v6-border, #e2e8f0);
}

.help-assistant-ticket-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--v6-border, #e2e8f0);
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--v6-text, #0f172a);
}

.help-assistant-ticket-modal__close {
    border: none;
    background: transparent;
    padding: 6px;
    cursor: pointer;
    border-radius: 8px;
    color: var(--v6-muted, #64748b);
    line-height: 0;
}

.help-assistant-ticket-modal__close:hover {
    background: var(--v6-main, #f1f5f9);
    color: var(--v6-text, #0f172a);
}

.help-assistant-ticket-modal__iframe {
    flex: 1;
    width: 100%;
    border: 0;
    background: var(--v6-main, #f8fafc);
}

.help-assistant-newticket {
    padding: 12px 14px;
    border-top: 1px solid var(--v6-border, #e2e8f0);
    background: var(--v6-card, #fff);
    flex-shrink: 0;
}

.help-assistant-newticket label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--v6-muted, #64748b);
}

.help-assistant-newticket .help-assistant-field {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.help-assistant-newticket textarea.help-assistant-field {
    min-height: 76px;
    resize: vertical;
}

.help-assistant-note {
    margin: 0;
    padding: 8px 4px;
    font-size: 0.8125rem;
    color: var(--v6-muted, #64748b);
    line-height: 1.45;
    text-align: center;
}

/* Тёмная тема панели ([data-theme="dark"] уже переопределяет --v6-*) */
[data-theme="dark"] .help-assistant-shell {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .help-assistant-head__close:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .help-assistant-msgs::-webkit-scrollbar-thumb {
    background: #475569;
}

[data-theme="dark"] .help-instructions-list__item:hover {
    box-shadow: none;
}

[data-theme="dark"] .instructions-step::before {
    background: rgba(245, 158, 11, 0.22);
}

[data-theme="dark"] .help-instruction-pdf-link {
    background: rgba(15, 23, 42, 0.6);
}

[data-theme="dark"] .instructions-catalog-product-shell {
    background: linear-gradient(165deg, rgba(245, 158, 11, 0.07) 0%, var(--v6-card, #1e293b) 45%);
    border-color: rgba(148, 163, 184, 0.25);
}

[data-theme="dark"] .instructions-catalog-card {
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: none;
}

[data-theme="dark"] .instructions-catalog-card__title a {
    color: var(--v6-text, #f1f5f9);
}

[data-theme="dark"] .instructions-category-product-pill {
    border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .instructions-category-empty {
    border-color: rgba(148, 163, 184, 0.35);
}

@media (max-width: 520px) {
    .instructions-catalog-product-shell {
        padding: 16px 14px 12px;
    }

    .instructions-catalog-grid {
        grid-template-columns: 1fr;
    }
}
