/* ==========================================================================
   Генератор: тема оформления (десктоп + мобильные, системные шрифты)
   ========================================================================== */
:root {
    /* Миниатюры галереи: фактический размер задаёт JS (layoutHistoryThumbs), здесь запас и потолок */
    --ai-thumb-min: 132px;
    --ai-thumb-max: 180px;
    --ai-thumb-gap: 12px;

    --ai-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --ai-text: #0f172a;
    --ai-muted: #64748b;
    --ai-border: rgba(15, 23, 42, 0.1);
    --ai-surface: #ffffff;
    --ai-surface-2: #f8fafc;
    /* Акцент по умолчанию (спиннеры, ссылки) */
    --ai-accent: #4f46e5;
    --ai-accent-dim: rgba(79, 70, 229, 0.12);
    --ai-accent-hover: #4338ca;
    --ai-radius: 14px;
    --ai-radius-sm: 10px;
    --ai-shadow: 0 4px 24px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --ai-ring: 0 0 0 3px rgba(79, 70, 229, 0.3);
    --ai-accent-field-border: rgba(79, 70, 229, 0.55);

    /* Единая геометрия кнопок */
    --ai-btn-radius: 10px;
    --ai-btn-min-h: 44px;
    --ai-btn-pad-y: 10px;
    --ai-btn-pad-x: 10px;

    /* Роли: переключатель режима (не путать с «Сгенерировать») */
    --ai-nav-active-from: #334155;
    --ai-nav-active-to: #1e293b;
    --ai-ring-nav: 0 0 0 3px rgba(51, 65, 85, 0.35);

    /* Главное действие в форме — генерация */
    --ai-cta-generate-from: #4f46e5;
    --ai-cta-generate-to: #4338ca;
    --ai-cta-generate-hover-from: #4338ca;
    --ai-cta-generate-hover-to: #3730a3;
    --ai-ring-generate: 0 0 0 3px rgba(79, 70, 229, 0.35);

    /* Вспомогательное действие — загрузка файла */
    --ai-secondary-border: #cbd5e1;
    --ai-secondary-text: #334155;
    --ai-secondary-hover-bg: #f1f5f9;
    --ai-ring-secondary: 0 0 0 3px rgba(100, 116, 139, 0.35);

    /* Коммерция — корзина / оплата */
    --ai-commerce-from: #059669;
    --ai-commerce-to: #047857;
    --ai-commerce-hover-from: #047857;
    --ai-commerce-hover-to: #065f46;
    --ai-ring-commerce: 0 0 0 3px rgba(5, 150, 105, 0.35);

    /* VK — бесплатное скачивание */
    --ai-vk-accent: #f97316;
    --ai-vk-accent-hover: #ea580c;
    --ai-vk-hover-from: #ea580c;
    --ai-vk-hover-to: #c2410c;
    --ai-ring-vk: 0 0 0 3px rgba(249, 115, 22, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.ai-form-mode-heading {
    margin: 0 0 14px;
    font-size: clamp(1.05rem, 2.5vw, 1.35rem);
    font-weight: 650;
    line-height: 1.25;
    color: var(--ai-text);
    width: 100%;
    letter-spacing: -0.02em;
}

.ai-mode-row {
    width: 100%;
    flex: 1 1 100%;
    margin-bottom: 8px;
}

.ai-mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    padding: 5px;
    background: var(--ai-surface-2);
    border-radius: var(--ai-radius-sm);
    border: 1px solid var(--ai-border);
}

/* Режимы: явный контраст — глобальные стили Astra/Woo (.button, цвета шапки) иначе дают белый текст на светлом фоне */
.ai-image-generator-wrapper .ai-mode-btn,
.ai-image-generator-wrapper .ai-mode-buttons .button.ai-mode-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    min-height: var(--ai-btn-min-h);
    border: none;
    border-radius: var(--ai-btn-radius);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    box-shadow: none;
    text-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.ai-image-generator-wrapper .ai-mode-btn:not(.is-active) {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--ai-secondary-text) !important;
    border: 1px solid var(--ai-secondary-border) !important;
}

.ai-image-generator-wrapper .ai-mode-btn:not(.is-active):hover {
    background: var(--ai-secondary-hover-bg) !important;
    color: var(--ai-text) !important;
    border-color: #94a3b8 !important;
}

.ai-image-generator-wrapper .ai-mode-btn.is-active {
    font-weight: 600;
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-nav-active-from) 0%, var(--ai-nav-active-to) 100%) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    border: none !important;
}

.ai-image-generator-wrapper .ai-mode-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-nav);
}

.ai-image-generator-wrapper .ai-cost-preview-old {
    text-decoration: line-through;
    opacity: 0.65;
    margin-right: 0.35em;
}
.ai-image-generator-wrapper .ai-cost-preview-new {
    font-weight: 700;
}
.ai-image-generator-wrapper .ai-cost-preview-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}
.ai-image-generator-wrapper .ai-video-discount-hint {
    margin: 0;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    color: #c2410c;
    text-align: left;
}
.ai-image-generator-wrapper .ai-video-upscale-extra {
    font-weight: 400;
}

.ai-image-generator-wrapper .ai-mode-btn.ai-mode-video--new:not(.is-active) {
    border-color: #ea580c !important;
    color: #9a3412 !important;
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%) !important;
}

.ai-image-generator-wrapper .ai-mode-btn.ai-mode-video--new.is-active {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%) !important;
}

.ai-image-generator-wrapper .ai-mode-new-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    color: #fff;
    background: #ea580c;
    text-transform: uppercase;
}

.ai-image-generator-wrapper .ai-mode-btn.ai-mode-video--new.is-active .ai-mode-new-badge {
    background: rgba(255, 255, 255, 0.25);
}

@keyframes ai-mode-video-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); }
    50% { box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.22); }
}

.ai-image-generator-wrapper .ai-thumb-video .ai-thumb-image-wrap {
    position: relative;
}

.ai-image-generator-wrapper .ai-thumb-video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 0;
    background: transparent;
    display: block;
    line-height: 0;
    pointer-events: none;
    box-shadow: none;
    padding: 0;
    box-sizing: border-box;
}

.ai-image-generator-wrapper .ai-thumb-video-badge-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin: 0;
}

.ai-image-generator-wrapper .ai-result-video-preview {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    cursor: pointer;
}

.ai-image-generator-wrapper .ai-result-video-preview .ai-result-video-frame {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.ai-image-generator-wrapper .ai-result-video-preview .ai-thumb-video-badge {
    width: 56px;
    height: 56px;
    padding: 0;
}

.ai-gallery-video-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ai-gallery-video-download[hidden] {
    display: none !important;
}

.ai-gallery-video-download:hover,
.ai-gallery-video-download:focus {
    background: rgba(37, 99, 235, 0.95);
    border-color: rgba(147, 197, 253, 0.9);
    color: #fff;
    text-decoration: none;
}

.ai-gallery-video-download:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.ai-gallery-video-download::before {
    content: '';
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3a1 1 0 0 1 1 1v9.59l2.3-2.3a1 1 0 1 1 1.4 1.42l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 1 1 1.4-1.42L11 13.59V4a1 1 0 0 1 1-1Zm-7 14a1 1 0 0 1 1 1v1h12v-1a1 1 0 1 1 2 0v2a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3a1 1 0 0 1 1 1v9.59l2.3-2.3a1 1 0 1 1 1.4 1.42l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 1 1 1.4-1.42L11 13.59V4a1 1 0 0 1 1-1Zm-7 14a1 1 0 0 1 1 1v1h12v-1a1 1 0 1 1 2 0v2a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ai-mode-help {
    font-size: 13px;
    color: var(--ai-muted);
    line-height: 1.5;
    margin: 0;
}

.ai-mode-help p {
    margin: 0 0 0.55em;
}

.ai-mode-help p:last-child {
    margin-bottom: 0;
}

.ai-mode-help ul,
.ai-mode-help ol {
    margin: 0.35em 0 0.55em 1.2em;
    padding: 0;
}

.ai-mode-help a {
    color: inherit;
    text-decoration: underline;
}

.ai-quality-hint {
    font-size: 12px;
    color: #646970;
    line-height: 1.4;
    margin: 0 0 8px;
}

.ai-field input.ai-quality-range.ai-quality-range--admin-zones {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    accent-color: var(--ai-quality-thumb-color, var(--ai-accent));
}

.ai-field input.ai-quality-range.ai-quality-range--admin-zones::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: var(--ai-quality-track-gradient, #e4e6e8);
}

.ai-field input.ai-quality-range.ai-quality-range--admin-zones::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    border: none;
    border-radius: 50%;
    background: var(--ai-quality-thumb-color, var(--ai-accent));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.ai-field input.ai-quality-range.ai-quality-range--admin-zones::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--ai-quality-track-gradient, #e4e6e8);
    border: none;
}

.ai-field input.ai-quality-range.ai-quality-range--admin-zones::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--ai-quality-thumb-color, var(--ai-accent));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.ai-prompt-photo-tip,
.ai-video-speech-hint {
    font-size: 12px;
    color: #646970;
    line-height: 1.45;
    margin: 8px 0 0;
    padding: 8px 10px;
    background: #f6f7f7;
    border-radius: 4px;
    border-left: 3px solid #2271b1;
}

.ai-video-speech-hint p {
    margin: 0 0 0.45em;
}

.ai-video-speech-hint p:last-child {
    margin-bottom: 0;
}

.ai-video-speech-hint ul,
.ai-video-speech-hint ol {
    margin: 0.25em 0 0.45em 1.2em;
    padding: 0;
}

.ai-video-speech-hint a {
    color: inherit;
    text-decoration: underline;
}

.ai-edit-upload-inner {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Нативная кнопка «Выберите файл» скрыта — выбор только через «Загрузить изображение». */
.ai-edit-file-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    z-index: 0;
}

.ai-edit-upload-btn {
    position: relative;
    z-index: 1;
}

.ai-upload-thumb-wrap {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    line-height: 0;
}

.ai-upload-thumb {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--ai-accent-field-border, #c3c4c7);
    background: #f6f7f7;
}

.ai-upload-thumb-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #1d2327;
    color: #fff;
    font-size: 14px;
    line-height: 18px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ai-upload-thumb-remove:hover {
    background: #c62828;
}

.ai-multi-upload-slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}

.ai-multi-upload-slot {
    position: relative;
    min-width: 0;
}

.ai-multi-upload-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.ai-image-generator-wrapper .ai-multi-upload-btn.button,
.ai-image-generator-wrapper .ai-multi-upload-btn.button-primary {
    width: 100%;
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    border-radius: var(--ai-btn-radius) !important;
    color: var(--ai-secondary-text) !important;
    background: #fff !important;
    background-color: #fff !important;
    border: 1px solid var(--ai-accent-field-border) !important;
    box-shadow: var(--ai-ring);
    text-shadow: none !important;
    font-weight: 600;
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
}

.ai-image-generator-wrapper .ai-multi-upload-btn.button:not(:disabled):hover,
.ai-image-generator-wrapper .ai-multi-upload-btn.button-primary:not(:disabled):hover {
    color: var(--ai-text) !important;
    background: var(--ai-secondary-hover-bg) !important;
    border-color: var(--ai-accent-field-border) !important;
    box-shadow: var(--ai-ring);
}

.ai-image-generator-wrapper .ai-multi-upload-btn.button:focus-visible,
.ai-image-generator-wrapper .ai-multi-upload-btn.button-primary:focus-visible {
    outline: none;
    border-color: var(--ai-accent-field-border) !important;
    box-shadow: var(--ai-ring);
}

.ai-image-generator-wrapper .ai-multi-upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--ai-secondary-text) !important;
    background: #f6f7f7 !important;
    background-color: #f6f7f7 !important;
    border-color: var(--ai-accent-field-border) !important;
}

.ai-multi-upload-thumb-wrap {
    align-self: center;
}

@media (max-width: 560px) {
    .ai-multi-upload-slots {
        grid-template-columns: 1fr;
    }
}

.ai-multi-file-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    z-index: 0;
}

.ai-multi-upload-status {
    display: none;
    margin: 6px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #c62828;
    line-height: 1.35;
}

.ai-multi-upload-status.is-error {
    display: block;
}

.ai-multi-upload-loading,
.ai-image-generator-wrapper.ai-multi-upload-pending .ai-multi-upload-loading {
    display: none;
}

.ai-image-generator-wrapper.ai-multi-upload-pending .ai-multi-upload-loading {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #50575e;
}

.ai-edit-upload-status {
    display: none;
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #c62828;
    line-height: 1.4;
}

.ai-edit-upload-status.is-error {
    display: block;
}

.ai-image-generator-wrapper .ai-edit-upload-btn.button,
.ai-image-generator-wrapper .ai-edit-upload-btn.button-primary {
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    border-radius: var(--ai-btn-radius) !important;
    color: var(--ai-secondary-text) !important;
    background: #fff !important;
    background-color: #fff !important;
    border: 1px solid var(--ai-accent-field-border) !important;
    box-shadow: var(--ai-ring);
    text-shadow: none !important;
    font-weight: 600;
    font-size: 14px;
}

.ai-image-generator-wrapper .ai-edit-upload-btn.button:hover,
.ai-image-generator-wrapper .ai-edit-upload-btn.button-primary:hover {
    color: var(--ai-text) !important;
    background: var(--ai-secondary-hover-bg) !important;
    border-color: var(--ai-accent-field-border) !important;
    box-shadow: var(--ai-ring);
}

.ai-image-generator-wrapper .ai-edit-upload-btn.button:focus-visible,
.ai-image-generator-wrapper .ai-edit-upload-btn.button-primary:focus-visible {
    outline: none;
    border-color: var(--ai-accent-field-border) !important;
    box-shadow: var(--ai-ring);
}

.ai-edit-upload-loading {
    display: none;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 14px;
    background: linear-gradient(90deg, #f0f6fc 0%, #e8f4fd 50%, #f0f6fc 100%);
    background-size: 200% 100%;
    border: 1px solid #c3d9ed;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: #1d2327;
    animation: ai-upload-banner-shift 2s ease-in-out infinite;
}

.ai-image-generator-wrapper.ai-edit-upload-pending .ai-edit-upload-loading {
    display: flex;
}

@keyframes ai-upload-banner-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.ai-edit-upload-spinner {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border: 3px solid #c3d9ed;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: ai-spin 0.7s linear infinite;
}

.ai-edit-upload-loading-msg {
    flex: 1;
    min-width: 0;
}

.ai-submit-wait-upload-hint {
    display: none;
    flex: 1 1 100%;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.45;
    color: #135e96;
    background: #f0f6fc;
    border-radius: 4px;
    border-left: 3px solid #2271b1;
    animation: ai-submit-hint-pulse 1.8s ease-in-out infinite;
}

.ai-image-generator-wrapper.ai-edit-upload-pending .ai-submit-wait-upload-hint {
    display: block;
}

@keyframes ai-submit-hint-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.82; }
}

.ai-image-generator-wrapper {
    font-family: var(--ai-font);
    color: var(--ai-text);
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 24px);
    border: 1px solid var(--ai-border);
    padding: clamp(16px, 3vw, 28px);
    border-radius: var(--ai-radius);
    background: var(--ai-surface);
    box-sizing: border-box;
    box-shadow: var(--ai-shadow);
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.ai-image-generator-form {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(16px, 3vw, 28px);
    align-items: stretch;
}

.ai-image-form-left {
    flex: 1 1 min(100%, 380px);
    min-width: 0;
}

.ai-image-form-right {
    flex: 1 1 min(100%, 380px);
    min-height: 220px;
    /* svh стабильнее vh при открытии мобильной клавиатуры (меньше скачков layout). */
    max-height: 80vh;
    max-height: 80svh;
    overflow: hidden;
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-sm);
    padding: clamp(12px, 2vw, 18px);
    background: linear-gradient(180deg, var(--ai-surface-2) 0%, #fff 48%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    justify-content: flex-start;
    text-align: center;
}

.ai-field {
    margin-bottom: 14px;
}

.ai-field > label:first-child {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ai-text);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.ai-field textarea,
.ai-field input[type="text"],
.ai-field input[type="number"].ai-size-input,
.ai-field input[type="text"].ai-size-input,
.ai-field select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-sm);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background: #fff;
    color: inherit;
}

.ai-field textarea {
    min-height: 88px;
    resize: vertical;
}

/* Промпт — акцентная обводка всегда (не только при фокусе) */
.ai-image-generator-wrapper .ai-field-prompt textarea,
.ai-image-generator-wrapper .ai-field-prompt textarea:focus,
.ai-image-generator-wrapper .ai-field-prompt textarea:focus-visible {
    outline: none;
    border-color: var(--ai-accent-field-border);
    box-shadow: var(--ai-ring);
}

.ai-field input:focus-visible,
.ai-field select:focus-visible {
    outline: none;
    border-color: var(--ai-accent-field-border);
    box-shadow: var(--ai-ring);
}

.ai-field:not(.ai-field-prompt) textarea:focus-visible {
    outline: none;
    border-color: var(--ai-accent-field-border);
    box-shadow: var(--ai-ring);
}

.ai-field input[type="range"],
.ai-field input.ai-steps-range,
.ai-field input.ai-quality-range,
.ai-field input.ai-gen-priority-range {
    width: 100%;
    max-width: 100%;
    accent-color: var(--ai-accent);
    touch-action: pan-x;
    min-height: 28px;
    -webkit-tap-highlight-color: transparent;
}

.ai-prompt-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.ai-prompt-label-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
}

.ai-prompt-label-main label,
.ai-prompt-label-row label {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ai-text);
    letter-spacing: 0.01em;
    margin-bottom: 0;
}

.ai-prompt-label-main label {
    display: inline;
    flex: 0 1 auto;
}

.ai-gen-prompt-hint-btn {
    width: 1em;
    height: 1em;
    min-width: 1em;
    min-height: 1em;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.22);
    background: #fff;
    color: #111;
    font-weight: 800;
    font-size: 1em;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.ai-gen-prompt-hint-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring, 0 0 0 2px rgba(27, 94, 32, 0.25));
}

/* Попап «Подсказка»: прокрутка длинного текста на узких/низких экранах */
.ai-gen-auth-popup[data-auth-popup="prompt-hint"] {
    align-items: center;
    padding: max(12px, env(safe-area-inset-top, 0px)) 0 max(12px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.ai-gen-auth-popup[data-auth-popup="prompt-hint"] .ai-gen-prompt-hint-modal {
    display: flex;
    flex-direction: column;
    max-height: min(90vh, 90dvh);
    overflow: hidden;
}

.ai-gen-auth-popup[data-auth-popup="prompt-hint"] .ai-gen-auth-header {
    flex-shrink: 0;
}

.ai-gen-auth-popup[data-auth-popup="prompt-hint"] .ai-gen-auth-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.ai-gen-auth-popup[data-auth-popup="prompt-hint"] .ai-gen-prompt-hint-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.ai-gen-auth-popup[data-auth-popup="prompt-hint"] .ai-gen-prompt-hint-scroll p {
    margin: 0 0 8px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.ai-gen-auth-popup[data-auth-popup="prompt-hint"] .ai-gen-auth-actions {
    flex-shrink: 0;
    margin-top: 14px;
}

/* Текстовая ссылка — без .button; иначе Astra/Woo дают синий фон и hover */
.ai-image-generator-wrapper button.ai-prompt-clear-btn,
.ai-image-generator-wrapper button.ai-prompt-clear-btn:hover,
.ai-image-generator-wrapper button.ai-prompt-clear-btn:focus,
.ai-image-generator-wrapper button.ai-prompt-clear-btn:focus-visible,
.ai-image-generator-wrapper button.ai-prompt-clear-btn:active {
    flex: 0 0 auto;
    display: inline;
    margin: 0;
    padding: 0 2px;
    min-height: 0;
    height: auto;
    border: 0 !important;
    border-radius: 0;
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
    color: var(--ai-muted) !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.15s ease;
}

.ai-image-generator-wrapper .ai-prompt-clear-btn:hover,
.ai-image-generator-wrapper .ai-prompt-clear-btn:focus-visible {
    opacity: 0.75;
    outline: none;
}

.ai-prompt-counter {
    margin-top: 6px;
    font-size: 12px;
    color: var(--ai-muted);
}

.ai-prompt-counter.ai-prompt-counter-over {
    color: #dc3232;
    font-weight: 600;
}

.ai-captcha {
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafafa;
}

.ai-captcha-title {
    font-size: 13px;
    margin-bottom: 8px;
}

.ai-captcha-image-wrapper {
    position: relative;
    height: 60px;
    margin-bottom: 8px;
    background: 
        repeating-linear-gradient(
            45deg,
            #667eea,
            #667eea 10px,
            #764ba2 10px,
            #764ba2 20px
        );
    border-radius: 4px;
    overflow: hidden;
}

.ai-captcha-image {
    position: relative;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            45deg,
            #667eea,
            #667eea 10px,
            #764ba2 10px,
            #764ba2 20px
        );
}

/* Вырез в фоне - цель для пазла (более заметный) */
.ai-captcha-image::after {
    content: '';
    position: absolute;
    top: 8px;
    left: var(--captcha-target, 50%);
    width: 60px;
    height: 44px;
    background: rgba(255, 255, 255, 0.3);
    border: 3px dashed #fff;
    border-radius: 4px;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5) inset;
    animation: ai-captcha-pulse 2s ease-in-out infinite;
}

@keyframes ai-captcha-pulse {
    0%, 100% {
        opacity: 0.8;
        border-color: #fff;
    }
    50% {
        opacity: 1;
        border-color: #ffeb3b;
    }
}

.ai-captcha-piece {
    position: absolute;
    top: 8px;
    left: 0;
    width: 60px;
    height: 44px;
    background: 
        repeating-linear-gradient(
            45deg,
            #667eea,
            #667eea 10px,
            #764ba2 10px,
            #764ba2 20px
        );
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: left 0.1s linear;
    border: 2px solid rgba(255, 255, 255, 0.9);
    z-index: 2;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.ai-captcha-piece:active {
    cursor: grabbing;
}

.ai-captcha-piece.ai-captcha-piece-dragging {
    transition: none;
}

.ai-captcha-slider input[type="range"] {
    width: 100%;
}

.ai-captcha-message {
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

.ai-captcha.ai-captcha-success .ai-captcha-message {
    color: #2e7d32;
}

.ai-captcha.ai-captcha-error .ai-captcha-message {
    color: #c62828;
}

.ai-field-row {
    display: flex;
    gap: 10px;
}

.ai-field-row > div {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}

.ai-field-row > div input[type="number"],
.ai-field-row > div input[type="text"].ai-size-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.ai-size-field label {
    display: inline;
}

.ai-size-error {
    color: #c62828;
    font-size: 12px;
    font-weight: 600;
    margin-left: 0.25em;
}

.ai-field-row .ai-size-invalid {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 1px #c62828;
}

.ai-submit-btn {
    margin-top: 10px;
    padding: 8px 16px;
    min-height: var(--ai-btn-min-h);
    background: linear-gradient(135deg, var(--ai-cta-generate-from) 0%, var(--ai-cta-generate-to) 100%);
    border: none;
    color: #fff;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    font-weight: 600;
}

.ai-submit-btn:hover {
    background: linear-gradient(135deg, var(--ai-cta-generate-hover-from) 0%, var(--ai-cta-generate-hover-to) 100%);
}

.ai-submit-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.ai-image-generator-wrapper .ai-submit-row button[type="submit"] {
    min-height: 48px;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-cta-generate-from) 0%, var(--ai-cta-generate-to) 100%) !important;
    border: none !important;
    text-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.35);
}

.ai-image-generator-wrapper .ai-submit-row button[type="submit"]:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.38);
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-cta-generate-hover-from) 0%, var(--ai-cta-generate-hover-to) 100%) !important;
}

.ai-image-generator-wrapper .ai-submit-row button[type="submit"]:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-generate);
}

.ai-cost-preview-label {
    font-size: 13px;
    color: var(--ai-muted);
    line-height: 1.4;
}

.ai-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    padding: 14px 16px;
    border-top: 1px solid var(--ai-border);
    background: var(--ai-surface-2);
    border-radius: var(--ai-radius-sm);
}

.ai-total-row-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.ai-total-label {
    font-size: 15px;
    font-weight: 650;
    color: var(--ai-text);
}

.ai-topup-bonus-offer {
    margin: 0;
    padding: 0;
    text-align: left;
    line-height: 1.35;
}

.ai-cost-preview-block .ai-topup-bonus-offer {
    margin-top: 6px;
}

.ai-topup-bonus-offer-link,
.ai-gen-topup-bonus-live {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    color: #c2410c;
    text-decoration: none;
}

.ai-topup-bonus-offer-link:hover,
.ai-topup-bonus-offer-link:focus {
    color: #9a3412;
    text-decoration: underline;
}

.ai-gen-topup-amount-label-row {
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.ai-gen-topup-bonus-live {
    white-space: nowrap;
}

.ai-image-generator-wrapper .ai-total-row .ai-pay-download-btn,
.ai-image-generator-wrapper button.ai-pay-download-btn {
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    background: linear-gradient(135deg, var(--ai-commerce-from) 0%, var(--ai-commerce-to) 100%) !important;
    border: none !important;
    color: #fff !important;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    text-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}

.ai-image-generator-wrapper .ai-pay-download-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(5, 150, 105, 0.38);
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-commerce-hover-from) 0%, var(--ai-commerce-hover-to) 100%) !important;
}

.ai-image-generator-wrapper .ai-pay-download-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-commerce);
}

.ai-image-generator-wrapper .ai-pay-download-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-commerce-from) 0%, var(--ai-commerce-to) 100%) !important;
}

.ai-total-row-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.ai-image-generator-wrapper .ai-total-row .ai-vk-free-download-btn,
.ai-image-generator-wrapper button.ai-vk-free-download-btn {
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    background: linear-gradient(135deg, var(--ai-vk-accent) 0%, var(--ai-vk-accent-hover) 100%) !important;
    border: none !important;
    color: #fff !important;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    text-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}

.ai-image-generator-wrapper .ai-vk-free-download-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(249, 115, 22, 0.38);
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-vk-hover-from) 0%, var(--ai-vk-hover-to) 100%) !important;
    filter: none;
}

.ai-image-generator-wrapper .ai-vk-free-download-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-vk);
}

.ai-image-generator-wrapper .ai-vk-free-download-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-vk-accent) 0%, var(--ai-vk-accent-hover) 100%) !important;
    transform: none;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.18);
}

.ai-vk-panel {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--ai-surface-2);
    border-radius: var(--ai-radius-sm);
    border: 1px solid var(--ai-border);
}

.ai-vk-hint {
    margin: 0 0 6px;
    font-size: 14px;
    color: var(--ai-text);
}

.ai-vk-hint-small,
.ai-vk-legal {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--ai-muted);
}

.ai-vk-publish-btn {
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    background: var(--ai-vk-accent);
    color: #fff;
    border: none;
    border-radius: var(--ai-btn-radius);
    font-weight: 600;
    cursor: pointer;
}

.ai-vk-publish-btn:hover {
    background: var(--ai-vk-accent-hover);
}

.ai-thumb.ai-vk-selectable .ai-thumb-image-wrap {
    position: relative;
}

.ai-thumb-checkbox {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 22px;
    height: 22px;
    accent-color: var(--ai-vk-accent);
    cursor: pointer;
}

.ai-image-generator-wrapper.ai-vk-select-mode .ai-thumb-checkbox {
    display: block;
}

.ai-purchase-checkbox {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    width: 22px;
    height: 22px;
    accent-color: var(--ai-commerce-from);
    cursor: pointer;
}

.ai-image-generator-wrapper.ai-purchase-select-mode:not(.ai-vk-select-mode) .ai-purchase-checkbox {
    display: block;
}

.ai-thumb.ai-purchase-selected .ai-thumb-image-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--ai-commerce-from);
    border-radius: 8px;
    pointer-events: none;
    z-index: 2;
}

.ai-image-generator-wrapper.ai-vk-select-mode .ai-thumb.ai-purchase-selected .ai-thumb-image-wrap::before {
    display: none;
}

.ai-thumb.ai-vk-selected .ai-thumb-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--ai-vk-accent);
    border-radius: 8px;
    pointer-events: none;
}

.ai-gen-download-archives-wrap,
.ai-vk-archives-wrap {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--ai-border);
}

.ai-gen-download-archives-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.ai-image-generator-wrapper .ai-gen-download-archives-toggle,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:hover,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:focus,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    filter: none !important;
    outline: none;
    color: var(--ai-text, #1a1a1a) !important;
}

.ai-image-generator-wrapper .ai-gen-download-archives-toggle .ai-gen-download-archives-title,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:hover .ai-gen-download-archives-title,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:focus .ai-gen-download-archives-title,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:active .ai-gen-download-archives-title {
    color: var(--ai-text, #1a1a1a) !important;
}

.ai-image-generator-wrapper .ai-gen-download-archives-toggle:hover .ai-gen-download-archives-caret,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:focus .ai-gen-download-archives-caret,
.ai-image-generator-wrapper .ai-gen-download-archives-toggle:active .ai-gen-download-archives-caret {
    color: var(--ai-muted, #666) !important;
}

.ai-gen-download-archives-title,
.ai-vk-archives-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.ai-gen-download-archives-caret {
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid currentColor;
    color: var(--ai-muted, #666);
    transition: transform 0.2s ease;
}

.ai-gen-download-archives-wrap.is-expanded .ai-gen-download-archives-caret {
    transform: rotate(90deg);
}

.ai-gen-download-archives-body {
    margin-top: 10px;
}

.ai-gen-download-archives-body[hidden] {
    display: none !important;
}

.ai-gen-archives-section {
    margin-bottom: 12px;
}

.ai-gen-archives-section:last-child {
    margin-bottom: 0;
}

.ai-gen-archives-section-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ai-text-muted, #666);
}

.ai-gen-archives-list,
.ai-vk-archives-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
    font-size: 13px;
}

.ai-gen-archives-list > li,
.ai-vk-archives-list > li {
    padding: 8px 10px;
    margin: 0 0 4px;
    border-radius: 6px;
}

.ai-gen-archives-list > li:nth-child(odd),
.ai-vk-archives-list > li:nth-child(odd) {
    background: #f3f5f7;
}

.ai-gen-archives-list > li:nth-child(even),
.ai-vk-archives-list > li:nth-child(even) {
    background: #fff3e8;
}

.ai-gen-archives-list a {
    word-break: break-word;
}

.ai-gen-archive-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.ai-gen-archive-row > a {
    flex: 1 1 auto;
    min-width: 0;
}

.ai-gen-archive-delete-btn {
    flex: 0 0 auto;
    margin: 0;
    margin-left: auto;
    padding: 0 2px;
    border: none;
    background: transparent;
    color: #dc2626;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
}

.ai-gen-archive-delete-btn:hover,
.ai-gen-archive-delete-btn:focus-visible {
    opacity: 1;
    color: #b91c1c;
}

.ai-gen-archive-delete-btn:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.ai-paid-archive-delete-confirm-popup .ai-clear-confirm-yes {
    background: linear-gradient(135deg, var(--ai-vk-accent) 0%, var(--ai-vk-hover-from) 100%);
    color: #fff;
    border-radius: var(--ai-btn-radius);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.ai-paid-archive-delete-confirm-popup .ai-clear-confirm-yes:hover {
    filter: brightness(1.05);
}

.ai-paid-archive-delete-confirm-popup .ai-clear-confirm-yes:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-vk);
}

.ai-gen-archive-delete-notice {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    color: #c2410c;
    line-height: 1.35;
}

.ai-vk-report-list {
    margin: 12px 0;
    padding: 0;
    list-style: none;
}

.ai-vk-report-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--ai-border);
    font-size: 13px;
}

.ai-vk-status-ok {
    color: #059669;
    font-weight: 600;
}

.ai-vk-status-error {
    color: #dc2626;
    font-weight: 600;
}

.ai-vk-picker-content {
    max-width: 520px;
}

.ai-vk-picker-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0 16px;
}

.ai-vk-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 0 0 auto;
    max-width: 140px;
}

.ai-vk-picker-item input[type="radio"] {
    accent-color: var(--ai-vk-accent);
}

.ai-vk-picker-thumb {
    display: block;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.ai-vk-picker-item:has(input:checked) .ai-vk-picker-thumb {
    border-color: var(--ai-vk-accent);
}

.ai-vk-picker-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ai-vk-picker-label {
    font-size: 12px;
    text-align: center;
    color: var(--ai-muted);
}

.ai-vk-picker-text,
.ai-vk-publish-text {
    width: 100%;
    resize: vertical;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.45;
}

.ai-vk-publish-page h1,
.ai-vk-publish-page h2 {
    margin-top: 0;
}

.ai-vk-publish-step {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-vk-publish-step:last-of-type {
    border-bottom: none;
}

/* Native shell: no WP/Astra .button — picker + publish page */
.ai-vk-picker-popup .button,
.ai-vk-publish-page .button,
.ai-vk-publish-shell .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 44px;
    margin: 0 8px 8px 0;
    padding: 10px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.ai-vk-picker-popup .button:hover,
.ai-vk-publish-page .button:hover,
.ai-vk-publish-shell .button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    text-decoration: none;
}
.ai-vk-picker-popup .button-primary,
.ai-vk-publish-page .button-primary,
.ai-vk-publish-shell .button-primary,
.ai-vk-publish-page a.button-primary,
.ai-vk-publish-shell a.button-primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--ai-vk-accent, #f97316) 0%, var(--ai-vk-hover-from, #ea580c) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}
.ai-vk-picker-popup .button-primary:hover,
.ai-vk-publish-page .button-primary:hover,
.ai-vk-publish-shell .button-primary:hover,
.ai-vk-publish-page a.button-primary:hover,
.ai-vk-publish-shell a.button-primary:hover {
    filter: brightness(1.05);
    border-color: transparent;
    color: #fff;
}
.ai-vk-picker-popup .button:disabled,
.ai-vk-publish-page .button:disabled,
.ai-vk-publish-shell .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ai-vk-picker-popup .ai-clear-confirm-buttons .button {
    margin: 0;
}
.ai-vk-publish-page .ai-vk-feed-url,
.ai-vk-publish-shell .large-text.ai-vk-feed-url {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 8px 0 12px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
    font-size: 15px;
}

.ai-vk-publish-preview-img {
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

.ai-vk-protected-media {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.ai-vk-protected-media img {
    pointer-events: none;
}

.ai-vk-og-parser-image {
    margin: 0 0 1rem;
    max-width: 537px;
}

.ai-vk-og-parser-image .ai-vk-publish-og-img {
    display: block;
    width: 100%;
    max-width: 537px;
    height: auto;
    border-radius: 8px;
}

.ai-vk-verify-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0 8px;
}

.ai-vk-verify-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--ai-vk-accent), var(--ai-vk-accent-hover));
    transition: width 0.1s linear;
}

@media (max-width: 640px) {
    .ai-total-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-total-row-buttons {
        flex-direction: column;
        width: 100%;
    }

    .ai-total-row-buttons .ai-pay-download-btn,
    .ai-total-row-buttons .ai-vk-free-download-btn {
        width: 100%;
    }
}

/* Стили для неактивной кнопки генерации */
.ai-image-generator-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.ai-result-placeholder {
    color: var(--ai-muted);
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
    padding: 14px 12px;
}

.ai-result-placeholder:empty {
    display: none;
}

.ai-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ai-loader-text {
    text-align: center;
    white-space: pre-line;
    line-height: 1.45;
    max-width: 100%;
}

.ai-queue-stay-notice {
    margin: 0;
    padding: 10px 12px;
    max-width: 22rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #7a1f1f;
    background: #fff4f4;
    border: 1px solid #f0b4b4;
    border-radius: 8px;
}

.ai-gen-queue-priority-promo-link {
    display: inline-block;
    font-weight: 700;
    text-align: center;
    color: var(--ai-accent, #4f46e5);
    text-decoration: underline;
    font-size: 0.95rem;
    line-height: 1.35;
    max-width: 100%;
}

.ai-gen-result-speed-promo-wrap {
    width: 100%;
    text-align: center;
    padding: 10px 8px 4px;
    flex-shrink: 0;
}

.ai-gen-result-speed-promo-wrap[hidden] {
    display: none !important;
}

.ai-gen-result-speed-promo-wrap .ai-gen-auth-view-only-hint {
    margin: 0;
    font-size: 13px;
    color: #dc3232;
    font-weight: 600;
    line-height: 1.45;
}

.ai-gen-queue-priority-promo-body p {
    margin: 0 0 0.75em;
}

.ai-gen-queue-priority-promo-list {
    margin: 0 0 1.25em 1.25em;
    padding: 0;
}

.ai-gen-queue-priority-promo-list li {
    margin-bottom: 0.35em;
}

.ai-gen-auth-actions--split {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.ai-gen-auth-actions--split .ai-gen-auth-btn-primary,
.ai-gen-auth-actions--split .ai-gen-auth-btn-secondary {
    flex: 1 1 140px;
    max-width: 100%;
}

/* Secondary вне --split тоже (Плагиат «Понятно», «Закрыть», профиль и т.п.) */
.ai-gen-auth-btn-secondary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #333 !important;
    background: #f0f0f0 !important;
    border: none !important;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ai-gen-auth-btn-secondary:hover {
    background: #e0e0e0 !important;
    color: #333 !important;
}

.ai-gen-auth-btn-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.45);
}

.ai-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(79, 70, 229, 0.2);
    border-top-color: var(--ai-accent);
    border-radius: 50%;
    animation: ai-spin 1s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

/* Блок результата: колонка + растягивание по высоте (иначе превью остаётся ~220px и «крошечным») */
.ai-result-image {
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}
.ai-result-image:not(:has(img)) {
    flex: 0 0 auto;
    min-height: 0;
}
.ai-result-image:has(img) {
    flex: 1 1 auto;
    /* svh — стабильная высота viewport при появлении soft keyboard на мобильных. */
    min-height: clamp(280px, 48vh, 78vh);
    min-height: clamp(280px, 48svh, 78svh);
}

.ai-result-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    border-radius: 4px;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.ai-compare-view {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    border-radius: 4px;
    touch-action: none;
    user-select: none;
    cursor: ew-resize;
    background: linear-gradient(145deg, #e2e8f0 0%, #f1f5f9 100%);
}

.ai-compare-view--original-only {
    cursor: default;
    touch-action: auto;
}

.ai-compare-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Один и тот же прямоугольник; contain — весь кадр виден, при разных пропорциях возможны поля */
.ai-compare-view .ai-compare-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    object-position: center;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.ai-thumb-image-wrap img,
.ai-gallery-image {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.ai-protect-notice-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
}

.ai-protect-notice-popup.show {
    display: flex;
}

.ai-protect-notice-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.ai-protect-notice-content {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    margin: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
    padding: 18px 18px 16px;
    box-sizing: border-box;
    z-index: 1;
}

.ai-protect-notice-header {
    font-size: 20px;
    font-weight: 700;
    color: var(--ai-text);
    margin-bottom: 10px;
}

.ai-protect-notice-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ai-text);
}

.ai-protect-notice-actions {
    margin-top: 16px;
    text-align: right;
}

.ai-protect-notice-close {
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: #fff;
    color: var(--ai-text);
    font-weight: 600;
    cursor: pointer;
}

/* Правая часть сравнения: маска + inner (без clip-path — стабильнее с PNG/JPEG в GPU) */
.ai-compare-before-layer {
    z-index: 1;
}

.ai-compare-after-mask {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 2;
    pointer-events: none;
}

.ai-compare-after-inner {
    position: absolute;
    top: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.ai-compare-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    z-index: 3;
}

.ai-compare-handle {
    position: absolute;
    top: 50%;
    width: 28px;
    height: 28px;
    margin-left: -14px;
    margin-top: -14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--ai-accent);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 3;
}

.ai-status-text {
    margin-top: 6px;
    font-size: 13px;
    color: var(--ai-muted);
    white-space: pre-line;
}

.ai-status-text.ai-status-error {
    color: #dc3232;
    font-weight: 600;
}

.ai-gen-maintenance-stub {
    margin: 0;
    padding: clamp(28px, 5vw, 48px) clamp(20px, 4vw, 32px);
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    line-height: 1.55;
    font-weight: 500;
    text-align: center;
    background: var(--ai-surface-2);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    box-shadow: var(--ai-shadow);
    white-space: pre-line;
}

.ai-image-generator-wrapper--maintenance .ai-gen-maintenance-stub {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* Миниатюры: одна ширина ячейки на всю галерею (считает ai-image-generator.js), перенос строк как раньше */
.ai-history-storage-notice {
    margin: 12px 0 0;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ai-muted);
    background: var(--ai-surface-2);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-sm);
}

.ai-image-history {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ai-thumb-gap);
    border-top: 1px solid var(--ai-border);
    padding-top: 14px;
    margin-top: 4px;
}

.ai-thumb {
    flex: 0 0 var(--ai-thumb-min);
    width: var(--ai-thumb-min);
    max-width: var(--ai-thumb-max);
    min-width: 0;
    box-sizing: border-box;
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s ease;
}

.ai-thumb:hover {
    transform: translateY(-2px);
}

.ai-thumb.ai-thumb-guest-locked {
    cursor: default;
    opacity: 0.92;
}

.ai-thumb.ai-thumb-guest-locked:hover {
    transform: none;
}

.ai-thumb-image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--ai-radius-sm);
    border: 1px solid var(--ai-border);
    background: var(--ai-surface-2);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.ai-thumb-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ai-thumb-label {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ai-muted);
}

.ai-log-wrapper {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
}

.ai-log-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.ai-log-output {
    max-height: 250px;
    overflow: auto;
    background: #111;
    color: #e5e5e5;
    padding: 10px;
    border-radius: 4px;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 12px;
    white-space: pre-wrap;
}

.ai-gallery-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.ai-gallery-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.88) !important;
    background-image: none !important;
}

.ai-gallery-content {
    position: relative;
    width: min(92vw, 1400px);
    height: min(90vh, 90dvh);
    max-height: min(90vh, 90dvh);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 48px;
}

.ai-gallery-image-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ai-gallery-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border: 4px solid rgba(255, 255, 255, 0.22);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ai-spin 1s linear infinite;
    display: none;
    z-index: 2;
    pointer-events: none;
}

.ai-gallery-image-wrap.is-loading .ai-gallery-spinner {
    display: block;
}

.ai-gallery-image-wrap.is-loading .ai-gallery-image {
    opacity: 0;
}

.ai-gallery-image-wrap img,
.ai-gallery-overlay .ai-gallery-video {
    max-width: 100%;
    max-height: min(72vh, 72dvh, 820px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: block;
    transition: opacity 0.15s ease;
}

.ai-gallery-overlay .ai-gallery-video {
    max-height: min(72vh, 72dvh, 720px);
    background: #0f172a;
}

.ai-gallery-caption {
    display: none;
    margin: 12px 0 0;
    padding: 0 12px;
    max-width: 100%;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.45;
    color: #e8e8e8;
    flex-shrink: 0;
}

.ai-gallery-close,
.ai-gallery-prev,
.ai-gallery-next {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.6) !important;
    background-image: none !important;
    color: #fff !important;
    border: 0 !important;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 18px;
    border-radius: 3px;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
}

.ai-gallery-close:hover,
.ai-gallery-prev:hover,
.ai-gallery-next:hover {
    background-color: rgba(0, 0, 0, 0.82) !important;
}

.ai-gallery-close:focus,
.ai-gallery-prev:focus,
.ai-gallery-next:focus {
    outline: none !important;
}

.ai-gallery-close:focus-visible,
.ai-gallery-prev:focus-visible,
.ai-gallery-next:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.55) !important;
    outline-offset: 2px;
}

.ai-gallery-close {
    top: 10px;
    right: 10px;
}

.ai-gallery-prev {
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
}

.ai-gallery-next {
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
}

/* Адаптивность */
@media (max-width: 768px) {
    .ai-image-generator-wrapper {
        padding: 14px;
        margin-left: 0;
        margin-right: 0;
        border-radius: var(--ai-radius-sm);
    }

    .ai-image-generator-form {
        flex-direction: column;
        gap: 18px;
    }

    .ai-image-form-right {
        max-height: 65vh;
        padding: 12px;
    }

    .ai-field-row {
        flex-direction: column;
    }

    .ai-field-row > div {
        flex: 0 0 auto;
        min-width: 100%;
    }

    .ai-gallery-content {
        width: 100vw;
        height: min(100vh, 100dvh);
        max-height: min(100vh, 100dvh);
        padding: 52px 12px 16px;
    }

    .ai-gallery-image-wrap img,
    .ai-gallery-overlay .ai-gallery-video {
        max-height: min(70vh, 70dvh);
    }

    .ai-gallery-prev {
        left: 5px;
    }

    .ai-gallery-next {
        right: 5px;
    }

    .ai-gallery-close {
        top: 8px;
        right: 8px;
        z-index: 3;
    }
}

/* Кнопка удаления готовых изображений */
.ai-clear-history-wrapper {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--ai-border);
    text-align: center;
}

.ai-clear-history-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    background: linear-gradient(135deg, var(--ai-vk-accent) 0%, var(--ai-vk-hover-from) 100%);
    color: #fff;
    border: none;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.28);
    transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.ai-clear-history-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.36);
}

.ai-clear-history-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-vk);
}

.ai-clear-history-btn:active {
    transform: scale(0.98);
}

/* Попап подтверждения очистки / удаления архива — на весь viewport (как auth-модалки).
   HTML из формы переносится в body в JS, иначе fixed «залипает» в блоке формы.
   Видимость только через .show — иначе hide()+css(display:'') снова открывает окно. */
.ai-clear-confirm-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
}

.ai-clear-confirm-popup.show {
    display: flex;
}

body > .ai-clear-confirm-popup {
    z-index: 100000;
}

.ai-clear-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.ai-clear-confirm-content {
    position: relative;
    box-sizing: border-box;
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    /* Как auth: 16px от края экрана на мобиле (не width:90% без border-box — уезжает в края). */
    max-width: 400px;
    width: min(400px, calc(100vw - 32px));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.ai-clear-confirm-content h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
    color: #333;
}

.ai-clear-confirm-content p {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.ai-clear-history-confirm-popup .ai-clear-warning,
.ai-clear-video-history-confirm-popup .ai-clear-warning {
    color: #9a3412 !important;
    font-weight: 600;
    background: rgba(249, 115, 22, 0.1);
    padding: 10px 12px;
    border-radius: var(--ai-radius-sm);
    border-left: 3px solid var(--ai-vk-accent);
}

.ai-clear-history-confirm-popup .ai-clear-warning:empty,
.ai-clear-video-history-confirm-popup .ai-clear-warning:empty {
    display: none;
}

.ai-clear-confirm-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: stretch;
}

.ai-clear-confirm-yes,
.ai-clear-confirm-no,
.ai-vk-dialog-popup .ai-vk-dialog-ok,
.ai-purchase-select-popup .ai-purchase-select-ok,
.ai-image-generator-wrapper .ai-vk-dialog-ok,
.ai-image-generator-wrapper .ai-purchase-select-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    border: none;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    transition: opacity 0.2s, filter 0.15s ease, background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ai-clear-history-confirm-popup .ai-clear-confirm-yes,
.ai-clear-video-history-confirm-popup .ai-clear-confirm-yes {
    background: linear-gradient(135deg, var(--ai-vk-accent) 0%, var(--ai-vk-hover-from) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.ai-clear-history-confirm-popup .ai-clear-confirm-yes:hover,
.ai-clear-video-history-confirm-popup .ai-clear-confirm-yes:hover {
    filter: brightness(1.05);
}

.ai-clear-history-confirm-popup .ai-clear-confirm-yes:focus-visible,
.ai-clear-video-history-confirm-popup .ai-clear-confirm-yes:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-vk);
}

.ai-clear-confirm-no {
    background-color: #f0f0f0;
    color: #333;
    box-shadow: none;
}

.ai-clear-confirm-no:hover {
    background-color: #e0e0e0;
}

/* Попап лимита монтируется в body (mountClearConfirmToBody) — без .ai-image-generator-wrapper. */
.ai-limit-popup .ai-limit-message,
.ai-image-generator-wrapper .ai-limit-message {
    white-space: pre-line;
}

/* Три CTA: колонка на всю ширину — без space-between/wrap «лесенкой». */
.ai-limit-popup .ai-clear-confirm-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 22px;
}

.ai-limit-popup .ai-limit-pay-btn,
.ai-limit-popup .ai-limit-secondary-btn,
.ai-limit-popup .ai-limit-tertiary-btn,
.ai-image-generator-wrapper .ai-limit-pay-btn,
.ai-image-generator-wrapper .ai-limit-secondary-btn,
.ai-image-generator-wrapper .ai-limit-tertiary-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: var(--ai-btn-min-h);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-transform: none;
    color: #fff !important;
    border: none !important;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ai-limit-popup .ai-limit-pay-btn,
.ai-image-generator-wrapper .ai-limit-pay-btn {
    background: linear-gradient(135deg, var(--ai-commerce-from) 0%, var(--ai-commerce-to) 100%) !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.28);
}

.ai-limit-popup .ai-limit-secondary-btn,
.ai-image-generator-wrapper .ai-limit-secondary-btn {
    background: linear-gradient(135deg, var(--ai-cta-generate-from) 0%, var(--ai-cta-generate-to) 100%) !important;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.35);
}

.ai-limit-popup .ai-limit-tertiary-btn,
.ai-image-generator-wrapper .ai-limit-tertiary-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%) !important;
    box-shadow: 0 2px 12px rgba(91, 33, 182, 0.35);
}

.ai-limit-popup .ai-limit-pay-btn:hover,
.ai-image-generator-wrapper .ai-limit-pay-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(5, 150, 105, 0.38);
    background: linear-gradient(135deg, var(--ai-commerce-hover-from) 0%, var(--ai-commerce-hover-to) 100%) !important;
}

.ai-limit-popup .ai-limit-secondary-btn:hover,
.ai-image-generator-wrapper .ai-limit-secondary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.38);
    background: linear-gradient(135deg, var(--ai-cta-generate-hover-from) 0%, var(--ai-cta-generate-hover-to) 100%) !important;
}

.ai-limit-popup .ai-limit-tertiary-btn:hover,
.ai-image-generator-wrapper .ai-limit-tertiary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(91, 33, 182, 0.38);
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
}

.ai-limit-popup .ai-limit-pay-btn:focus-visible,
.ai-image-generator-wrapper .ai-limit-pay-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-commerce);
}

.ai-limit-popup .ai-limit-secondary-btn:focus-visible,
.ai-image-generator-wrapper .ai-limit-secondary-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-generate);
}

@media (max-width: 480px) {
    .ai-clear-confirm-content {
        padding: 20px;
    }

    .ai-clear-confirm-yes,
    .ai-clear-confirm-no {
        width: 100%;
    }
}

/* ==========================================================================
   Виртуальные страницы /generation/: разметка как у Astra + полноширинный hero
   ========================================================================== */

.ai-gen-hero.ai-gen-hero--fullbleed {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    box-sizing: border-box;
    /* min-height и background-position можно переопределить из настроек плагина (inline) */
    min-height: clamp(160px, 26vw, 300px);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.ai-generation-landing {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px 15px;
}

.ai-generation-landing--no-hero {
    /* Прозрачная / липкая шапка: контент не заезжает под меню, если фона нет */
    padding-top: clamp(72px, 14vh, 140px);
}

.ai-generation-landing__title {
    margin: 0 0 16px;
    font-size: clamp(1.35rem, 3vw, 2rem);
    line-height: 1.2;
}

.ai-gen-breadcrumbs {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--ai-muted, #64748b);
}

.ai-gen-seo-text {
    margin-top: 24px;
    font-family: var(--ai-font);
    color: var(--ai-text);
}

/* Типографика длинного SEO-текста (h2–h4 из редактора, без ручных классов) */
.ai-gen-seo-text__inner {
    line-height: 1.65;
}

.ai-gen-seo-text__inner h2 {
    font-size: clamp(1.25rem, 2.4vw, 1.65rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.28;
    margin: 0 0 0.75em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--ai-border);
    color: var(--ai-text);
}

.ai-gen-seo-text__inner h3 {
    font-size: clamp(1.05rem, 1.9vw, 1.22rem);
    font-weight: 650;
    line-height: 1.32;
    margin: 1.65em 0 0.5em;
    padding-left: 0.6rem;
    border-left: 3px solid var(--ai-accent);
    color: var(--ai-text);
}

.ai-gen-seo-text__inner h2 + h3 {
    margin-top: 1em;
}

.ai-gen-seo-text__inner h4 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.38;
    margin: 1.35em 0 0.45em;
    color: #334155;
}

.ai-gen-seo-text__inner p {
    margin: 0.65em 0;
}

.ai-gen-seo-text__inner ul,
.ai-gen-seo-text__inner ol {
    margin: 0.6em 0 0.85em;
    padding-left: 1.35em;
}

.ai-gen-seo-text__inner li {
    margin: 0.4em 0;
}

.ai-gen-seo-text__inner li > p {
    margin: 0.35em 0;
}

.ai-gen-seo-text__inner a {
    color: var(--ai-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-gen-seo-text__inner a:hover {
    color: var(--ai-accent-hover);
}

.ai-gen-seo-text__inner > *:first-child {
    margin-top: 0;
}

.ai-gen-seo-text__inner > *:last-child {
    margin-bottom: 0;
}

.ai-gen-examples {
    margin-top: 24px;
}

.ai-gen-examples__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.ai-gen-examples__figure {
    margin: 0;
}

.ai-gen-examples__payload {
    display: none !important;
}

.ai-gen-examples__open {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    background: rgba(0, 0, 0, 0.04);
    line-height: 0;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ai-gen-examples__open:hover,
.ai-gen-examples__open:focus-visible {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    outline: none;
}

.ai-gen-examples__open:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.45);
}

.ai-gen-examples__open img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    vertical-align: middle;
    display: block;
}

.ai-gen-ready-templates {
    margin-top: 24px;
}

.ai-gen-ready-templates__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ai-gen-ready-templates__links a {
    color: var(--ai-accent);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    line-height: 1.3;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.ai-gen-ready-templates__links a:hover,
.ai-gen-ready-templates__links a:focus-visible {
    color: var(--ai-accent-hover);
    border-color: var(--ai-accent);
    outline: none;
}

.ai-creative-landing .ai-generation-landing__title {
    margin-bottom: 20px;
}

.ai-gen-creative-grid {
    column-count: 1;
    column-gap: 16px;
    width: 100%;
    margin: 0 0 28px;
}

@media (min-width: 640px) {
    .ai-gen-creative-grid {
        column-count: 2;
        column-gap: 18px;
    }
}

@media (min-width: 1024px) {
    .ai-gen-creative-grid {
        column-count: 3;
        column-gap: 20px;
    }
}

.ai-gen-creative-card {
    position: relative;
    display: inline-block;
    width: 100%;
    margin: 0 0 16px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ai-gen-creative-card:hover,
.ai-gen-creative-card:focus-within {
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.ai-gen-creative-card__link {
    display: block;
    line-height: 0;
}

.ai-gen-creative-card__img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    vertical-align: top;
}

/* Доступность Comfy по кешу и отмена в очереди */
.ai-gen-comfy-health {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 0 0 14px;
}

.ai-gen-comfy-health__msg {
    white-space: pre-line;
}

.ai-gen-video-activation {
    margin-top: 10px;
}

.ai-gen-video-activation[hidden],
.ai-gen-video-activation-btn[hidden],
.ai-gen-video-activation-done[hidden] {
    display: none !important;
}

.ai-gen-video-activation-btn {
    margin: 0;
}

.ai-gen-video-activation-done {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.4;
    color: #78350f;
    white-space: pre-line;
}

.ai-image-generator-form button.ai-gen-queue-cancel {
    background: #c62828 !important;
    border-color: #b71c1c !important;
    color: #fff !important;
}

/* Аккаунт, баланс, приоритет очереди */
.ai-gen-verify-notice {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: var(--ai-btn-radius);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.ai-gen-verify-notice--ok {
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
}

.ai-gen-verify-notice--error {
    color: #c62828;
    background: #ffebee;
    border: 1px solid #ef9a9a;
}

.ai-gen-auth-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.ai-image-generator-wrapper .ai-gen-auth-email {
    font-size: 14px;
    color: var(--ai-muted);
}

.ai-image-generator-wrapper .ai-gen-auth-via-provider {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.ai-image-generator-wrapper .ai-gen-auth-via-provider .ai-gen-oauth-provider-icon {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.ai-gen-admin-user-identity,
.ai-gen-oauth-provider-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
    flex-wrap: wrap;
}

.ai-gen-oauth-provider-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    flex: 0 0 auto;
}

.ai-gen-queue-auth-email .ai-gen-oauth-provider-icon {
    margin-left: 2px;
}

/* Выйти — как неактивная вкладка «Изменение изображения», ширина по тексту */
.ai-image-generator-wrapper .ai-gen-btn-secondary,
.ai-image-generator-wrapper .ai-gen-auth-logout-btn.ai-gen-btn-secondary {
    flex: 0 0 auto;
    width: auto;
    min-height: var(--ai-btn-min-h);
    margin: 0;
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    border-radius: var(--ai-btn-radius);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: none;
    text-shadow: none;
    text-transform: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent !important;
    background-color: transparent !important;
    color: var(--ai-secondary-text) !important;
    border: 1px solid var(--ai-secondary-border) !important;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.ai-image-generator-wrapper .ai-gen-btn-secondary:hover,
.ai-image-generator-wrapper .ai-gen-auth-logout-btn.ai-gen-btn-secondary:hover {
    background: var(--ai-secondary-hover-bg) !important;
    color: var(--ai-text) !important;
    border-color: #94a3b8 !important;
}

.ai-image-generator-wrapper .ai-gen-btn-secondary:focus-visible,
.ai-image-generator-wrapper .ai-gen-auth-logout-btn.ai-gen-btn-secondary:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-secondary);
}

/* Пополнить баланс — круглая кнопка с «+» */
.ai-image-generator-wrapper .ai-gen-topup-btn,
.ai-gen-balance-toolbar .ai-gen-topup-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    margin: 0;
    border: none !important;
    border-radius: 50%;
    background: var(--ai-accent) !important;
    color: #fff !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.32);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
    text-shadow: none !important;
}

.ai-image-generator-wrapper .ai-gen-topup-btn:hover:not(:disabled),
.ai-gen-balance-toolbar .ai-gen-topup-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--ai-accent-hover) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.ai-image-generator-wrapper .ai-gen-topup-btn:focus-visible,
.ai-gen-balance-toolbar .ai-gen-topup-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring);
}

.ai-image-generator-wrapper .ai-gen-topup-btn:disabled,
.ai-gen-balance-toolbar .ai-gen-topup-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.ai-gen-topup-btn__icon {
    position: relative;
    display: block;
    width: 14px;
    height: 14px;
}

.ai-gen-topup-btn__icon::before,
.ai-gen-topup-btn__icon::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 1px;
}

.ai-gen-topup-btn__icon::before {
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

.ai-gen-topup-btn__icon::after {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}
.ai-gen-balance-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 14px;
}
.ai-gen-balance-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}
.ai-gen-priority-block {
    margin: 12px 0 16px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
}
.ai-gen-priority-layout {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
}
.ai-gen-priority-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-gen-priority-left {
    flex: 1 1 auto;
    min-width: 0;
}
.ai-gen-priority-right {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
}
.ai-gen-priority-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ai-gen-priority-head .ai-gen-priority-label {
    margin: 0;
}
.ai-gen-priority-info-btn {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.22);
    background: #fff;
    color: #111;
    font-weight: 800;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.ai-gen-priority-info-btn:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring, 0 0 0 2px rgba(27, 94, 32, 0.25));
}
.ai-gen-priority-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}
.ai-gen-priority-range {
    flex: 1 1 160px;
    min-width: 120px;
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0;
}
.ai-field .ai-gen-priority-input {
    min-height: 40px;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
}
.ai-gen-priority-input-desktop {
    display: inline-block;
    width: 30px !important;
    min-width: 30px;
    max-width: 30px !important;
    padding: 0 !important;
    text-indent: 0;
}
.ai-gen-priority-mobile-input-wrap {
    display: none;
    margin-top: 10px;
}
.ai-gen-priority-mobile-input-wrap .ai-gen-priority-input-mobile {
    width: 100%;
}
.ai-gen-priority-position-line {
    margin: 10px 0 0;
    font-size: 0.92rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.ai-gen-priority-pos {
    display: inline-block;
    min-width: 1.2em;
    font-weight: 700;
}

.ai-gen-queue-pos-dots {
    display: inline-flex;
    align-items: flex-end;
    gap: 1px;
    min-width: 1.4em;
    line-height: 1;
    vertical-align: baseline;
}

.ai-gen-queue-pos-dots span {
    display: inline-block;
    font-weight: 700;
    animation: ai-gen-queue-pos-dot 1s ease-in-out infinite;
}

.ai-gen-queue-pos-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-gen-queue-pos-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ai-gen-queue-pos-dot {
    0%,
    70%,
    100% {
        opacity: 0.2;
        transform: translateY(0);
    }
    35% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.ai-gen-priority-balance-hint {
    margin: 8px 0 0;
    font-size: 0.88rem;
}

.ai-gen-priority-balance-hint[hidden] {
    display: none !important;
}
.ai-image-generator-wrapper .ai-gen-queue-view-btn {
    margin: 0;
    padding: 6px 12px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ai-accent, #1b5e20) !important;
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.18) !important;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    text-transform: none;
    box-shadow: none;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.ai-image-generator-wrapper .ai-gen-queue-view-btn:hover {
    color: var(--ai-accent, #1b5e20) !important;
    border-color: var(--ai-accent-field-border, rgba(27, 94, 32, 0.45)) !important;
    background: rgba(27, 94, 32, 0.06) !important;
}
.ai-image-generator-wrapper .ai-gen-queue-view-btn:focus-visible {
    outline: none;
    color: var(--ai-accent, #1b5e20) !important;
    box-shadow: var(--ai-ring, 0 0 0 2px rgba(27, 94, 32, 0.25));
}
.ai-gen-queue-help-body p {
    margin: 6px 0;
}
@media (max-width: 782px) {
    .ai-gen-balance-toolbar {
        justify-content: flex-start;
    }
    .ai-gen-balance-bar {
        justify-content: flex-start;
    }
    .ai-gen-priority-layout {
        display: block;
    }
    .ai-gen-priority-right {
        display: none;
    }
    .ai-gen-priority-input-desktop {
        display: none;
    }
    .ai-gen-priority-mobile-input-wrap {
        display: block;
    }
}

/* Модальные окна входа / регистрации */
.ai-gen-auth-popup .ai-gen-auth-modal {
    max-width: 420px;
    width: min(420px, calc(100vw - 32px));
    padding: 22px 22px 24px;
    box-sizing: border-box;
}

.ai-gen-auth-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin-bottom: 18px;
    padding: 0 36px;
}

.ai-gen-auth-header h3 {
    margin: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--ai-text);
    line-height: 1.3;
}

.ai-gen-no-daily-reset-notice-text {
    text-align: left;
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ai-text);
}

.ai-gen-no-daily-reset-notice-text p {
    margin: 0 0 12px;
}

.ai-gen-no-daily-reset-notice-text p:last-child {
    margin-bottom: 0;
}

.ai-gen-no-daily-reset-notice-text ul,
.ai-gen-no-daily-reset-notice-text ol {
    margin: 0 0 12px 1.2em;
    padding: 0;
}

.ai-gen-no-daily-reset-notice-text a {
    color: var(--ai-accent, #4f46e5);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-gen-form-error {
    margin: 0 0 14px;
    padding: 0 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #c62828;
    line-height: 1.35;
    white-space: pre-line;
}

.ai-gen-auth-popup .ai-clear-confirm-content .ai-gen-form-error {
    color: #dc3232 !important;
    font-size: 13px;
    font-weight: 600;
    white-space: pre-line;
}

.ai-gen-form-error:empty {
    display: none;
    margin: 0;
    padding: 0;
}

.ai-gen-auth-panel {
    position: relative;
}

.ai-gen-auth-busy-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    border-radius: var(--ai-radius-sm);
    pointer-events: none;
}

.ai-gen-auth-panel.is-busy .ai-gen-auth-busy-overlay {
    display: flex;
}

.ai-gen-auth-spinner {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

.ai-gen-auth-panel.is-busy {
    pointer-events: none;
}

.ai-gen-auth-panel.is-busy .ai-gen-auth-close {
    pointer-events: auto;
}

.ai-gen-auth-btn-primary .ai-gen-btn-spinner {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-width: 3px;
}

.ai-gen-auth-panel.is-busy .ai-gen-auth-btn-primary .ai-gen-btn-spinner {
    display: block;
}

.ai-gen-auth-panel.is-busy .ai-gen-auth-btn-primary .ai-gen-btn-text {
    visibility: hidden;
}

.ai-gen-auth-btn-primary:disabled {
    opacity: 0.85;
    cursor: wait;
    transform: none !important;
}

.ai-gen-auth-close {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--ai-radius-sm);
    background: transparent;
    color: var(--ai-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.ai-gen-auth-close:hover,
.ai-gen-auth-close:focus-visible {
    color: var(--ai-text);
    background: var(--ai-surface-2);
    outline: none;
}

.ai-gen-auth-body,
.ai-gen-auth-popup .ai-gen-auth-step {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ai-gen-auth-field {
    margin: 0 0 14px;
}

.ai-gen-auth-label-row {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.ai-gen-auth-label-row .ai-gen-auth-label {
    margin-bottom: 0;
}

.ai-gen-auth-hint-trigger {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    background: #fff;
    color: var(--ai-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    font-family: inherit;
    cursor: help;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.ai-gen-auth-hint-trigger:hover,
.ai-gen-auth-hint-trigger:focus-visible {
    color: var(--ai-accent);
    border-color: var(--ai-accent-field-border);
    background: var(--ai-surface-2);
    outline: none;
}

.ai-gen-auth-tooltip {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 5;
    display: none;
    max-width: min(320px, calc(100vw - 48px));
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--ai-text);
    background: #fff;
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-sm);
    box-shadow: var(--ai-shadow);
}

.ai-gen-auth-label-row.is-tooltip-open .ai-gen-auth-tooltip,
.ai-gen-auth-hint-trigger:hover + .ai-gen-auth-tooltip,
.ai-gen-auth-hint-trigger:focus-visible + .ai-gen-auth-tooltip {
    display: block;
}

.ai-gen-auth-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ai-text);
}

.ai-gen-auth-password-wrap {
    position: relative;
    width: 100%;
}

.ai-gen-auth-password-wrap .ai-gen-auth-input {
    padding-right: 44px;
}

.ai-gen-auth-toggle-pw {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--ai-radius-sm);
    background: transparent;
    color: var(--ai-muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.ai-gen-auth-toggle-pw:hover,
.ai-gen-auth-toggle-pw:focus-visible {
    color: var(--ai-text);
    background: var(--ai-surface-2);
    outline: none;
}

.ai-gen-auth-eye {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.ai-gen-auth-toggle-pw .ai-gen-auth-eye--on {
    display: none;
}

.ai-gen-auth-toggle-pw.is-visible .ai-gen-auth-eye--off {
    display: none;
}

.ai-gen-auth-toggle-pw.is-visible .ai-gen-auth-eye--on {
    display: flex;
}

.ai-gen-auth-input {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: var(--ai-btn-min-h);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    color: var(--ai-text);
    background: var(--ai-surface);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-btn-radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-gen-auth-input:focus {
    outline: none;
    border-color: var(--ai-accent-field-border);
    box-shadow: var(--ai-ring);
}

.ai-gen-auth-field .ai-gen-field-error {
    display: block;
    margin: 6px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #c62828;
    line-height: 1.35;
    min-height: 0;
}

.ai-gen-auth-field .ai-gen-field-error:empty {
    display: none;
}

.ai-gen-auth-input.ai-size-invalid {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 1px #c62828;
}

.ai-gen-auth-forgot-wrap {
    margin: -4px 0 16px;
    text-align: left;
}

.ai-gen-auth-forgot-link {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ai-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.ai-gen-auth-forgot-link:hover,
.ai-gen-auth-forgot-link:focus-visible {
    color: var(--ai-accent-hover);
    outline: none;
}

.ai-gen-auth-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 4px;
}

.ai-gen-auth-popup[data-auth-popup="queue-plagiarism"] .ai-gen-auth-actions {
    justify-content: center;
}

.ai-gen-oauth-buttons {
    margin: 0 0 4px;
    padding: 0;
    border: none;
}

.ai-gen-oauth-buttons--top {
    margin: 4px 0 2px;
}

.ai-gen-oauth-list {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.ai-gen-oauth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ai-gen-oauth-btn:hover,
.ai-gen-oauth-btn:focus {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.ai-gen-oauth-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.ai-gen-oauth-icon {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    pointer-events: none;
}

/* Яндекс уже с «воздухом» в SVG; остальные чуть уменьшаем, чтобы визуально совпадали. */
.ai-gen-oauth-btn--mailru .ai-gen-oauth-icon,
.ai-gen-oauth-btn--vk .ai-gen-oauth-icon,
.ai-gen-oauth-btn--ok .ai-gen-oauth-icon {
    width: 34px;
    height: 34px;
}

.ai-gen-oauth-or {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 14px 0 10px;
    color: var(--ai-text-muted, #666);
    font-size: 13px;
    line-height: 1;
}

.ai-gen-oauth-or::before,
.ai-gen-oauth-or::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

.ai-gen-oauth-or span {
    flex: 0 0 auto;
    text-transform: lowercase;
}

.ai-gen-auth-popup .screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

@media (max-width: 480px) {
    .ai-gen-oauth-list {
        gap: 10px;
    }

    .ai-gen-oauth-btn,
    .ai-gen-oauth-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 11px;
    }

    .ai-gen-oauth-btn--mailru .ai-gen-oauth-icon,
    .ai-gen-oauth-btn--vk .ai-gen-oauth-icon,
    .ai-gen-oauth-btn--ok .ai-gen-oauth-icon {
        width: 30px;
        height: 30px;
    }

    .ai-gen-oauth-or {
        margin: 12px 0 8px;
    }
}

.ai-gen-auth-btn-primary {
    position: relative;
    min-width: 140px;
    min-height: var(--ai-btn-min-h);
    padding: var(--ai-btn-pad-y) var(--ai-btn-pad-x);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-commerce-from) 0%, var(--ai-commerce-to) 100%) !important;
    border: none !important;
    border-radius: var(--ai-btn-radius);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ai-gen-auth-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(5, 150, 105, 0.38);
    color: #fff !important;
    background: linear-gradient(135deg, var(--ai-commerce-hover-from) 0%, var(--ai-commerce-hover-to) 100%) !important;
}

.ai-gen-auth-btn-primary:focus-visible {
    outline: none;
    box-shadow: var(--ai-ring-commerce);
}

.ai-gen-auth-hint {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--ai-muted);
    text-align: center;
    line-height: 1.45;
}

.ai-gen-auth-field .ai-gen-topup-limits-hint {
    margin: 4px 0 0;
    font-size: 12px;
    text-align: left;
    font-weight: 500;
}

.ai-gen-auth-popup .ai-gen-auth-error {
    display: none !important;
}

@media (max-width: 480px) {
    .ai-gen-auth-popup .ai-gen-auth-modal {
        padding: 18px 16px 20px;
    }

    .ai-gen-auth-header {
        margin-bottom: 14px;
        padding: 0 32px;
    }

    .ai-gen-auth-header h3 {
        font-size: 18px;
    }

    .ai-gen-auth-btn-primary {
        width: 100%;
    }

    .ai-gen-auth-actions {
        width: 100%;
    }
}

.ai-gen-legal-consent {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 14px;
}

.ai-field.ai-gen-legal-consent > .ai-gen-legal-consent-item,
.ai-gen-legal-consent .ai-gen-legal-consent-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 400;
    letter-spacing: normal;
    cursor: pointer;
}

.ai-field.ai-gen-legal-consent > .ai-gen-legal-consent-item span,
.ai-field.ai-gen-legal-consent > .ai-gen-legal-consent-item a,
.ai-gen-legal-consent .ai-gen-legal-consent-item span,
.ai-gen-legal-consent .ai-gen-legal-consent-item a {
    font-weight: inherit;
}

.ai-gen-legal-consent-item input[type="checkbox"] {
    margin: 3px 0 0;
    flex-shrink: 0;
}

.ai-gen-legal-consent-item a {
    color: inherit;
    text-decoration: underline;
}

.ai-gen-legal-consent-item a:hover,
.ai-gen-legal-consent-item a:focus-visible {
    text-decoration: none;
}

.ai-gen-legal-consent-error {
    margin: 0;
    font-size: 13px;
}

.ai-gen-legal-consent-error:empty {
    display: none;
}

.ai-gen-legal-consent-error:not(:empty) {
    color: #c62828;
    font-weight: 600;
}

.ai-gen-auth-popup .ai-gen-legal-consent {
    margin-bottom: 12px;
}

/* Ссылка на профиль (почта / иконка OAuth в pill) */
a.ai-gen-auth-email-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
}

a.ai-gen-auth-email-link:hover,
a.ai-gen-auth-email-link:focus-visible {
    text-decoration: underline;
    outline: none;
}

a.ai-gen-auth-email-link .ai-gen-auth-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.ai-gen-auth-email-link .ai-gen-auth-via-provider {
    text-decoration: none;
}

/* Страница профиля: вариант 5 — баланс сверху, аккаунт и детали рядом */
.ai-gen-profile-page {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: clamp(96px, 12vh, 140px) 16px 64px;
    color: #0f172a;
}

.ai-gen-profile-inner {
    box-sizing: border-box;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
}

.ai-gen-profile-title {
    margin: 0 0 20px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ai-gen-profile-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 20px;
    padding: 22px 24px;
    border: 1px solid #dbe4ee;
    border-radius: 16px;
    background: #fff;
}

.ai-gen-profile-hero-kicker {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #64748b;
}

.ai-gen-profile-hero-amount {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: #047857;
}

.ai-gen-profile-hero-split {
    margin: 8px 0 0;
    font-size: 14px;
    color: #475569;
}

.ai-gen-profile-hero-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ai-gen-profile-chip {
    min-width: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.ai-gen-profile-chip-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: #64748b;
}

.ai-gen-profile-chip-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.ai-gen-profile-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.ai-gen-profile-card {
    margin-bottom: 16px;
    padding: 20px 22px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
}

.ai-gen-profile-split .ai-gen-profile-card {
    margin-bottom: 0;
    height: 100%;
}

.ai-gen-profile-card h2 {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 700;
}

.ai-gen-profile-identity {
    margin: 0 0 18px;
}

.ai-gen-profile-identity-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
}

.ai-gen-profile-identity-row + .ai-gen-profile-identity-row {
    margin-top: 0.35em;
}

.ai-gen-profile-identity-row .ai-gen-profile-label {
    margin: 0;
    font-size: 15px;
    color: #64748b;
    font-weight: 600;
    flex: 0 0 auto;
}

.ai-gen-profile-label {
    margin: 0 0 6px;
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

.ai-gen-profile-auth-value {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    min-width: 0;
}

.ai-gen-profile-email-current {
    margin: 0;
    min-width: 0;
}

.ai-gen-profile-email-empty {
    color: #64748b;
}

.ai-gen-profile-email-block {
    margin-top: 4px;
}

.ai-gen-profile-stats-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
}

.ai-gen-profile-stats-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 15px;
    line-height: 1.4;
}

.ai-gen-profile-stats-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ai-gen-profile-stats-item:first-child {
    padding-top: 0;
}

.ai-gen-profile-stats-label {
    color: #475569;
    flex: 1 1 220px;
}

.ai-gen-profile-stats-value {
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

.ai-gen-profile-field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.ai-gen-profile-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}

.ai-gen-profile-email-step {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.ai-gen-profile-email-step[hidden] {
    display: none !important;
}

.ai-gen-profile-email-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ai-gen-profile-hint {
    margin: 0;
    font-size: 14px;
    color: #475569;
}

.ai-gen-profile-flash {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.ai-gen-profile-flash--ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.ai-gen-profile-flash--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.ai-gen-profile-notice {
    color: #64748b;
}

.ai-gen-balance-history-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.ai-gen-balance-history-pager-meta {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.ai-gen-balance-history-pager-links {
    display: flex;
    gap: 12px;
}

.ai-gen-balance-history-pager-links a {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
    text-decoration: none;
}

.ai-gen-balance-history-pager-links a:hover {
    text-decoration: underline;
}

.ai-gen-profile-history .ai-gen-balance-history-wrap {
    overflow-x: auto;
    container-type: inline-size;
    container-name: ai-gen-bh;
}

.ai-gen-profile-history .ai-gen-bh-date,
.ai-gen-profile-history .ai-gen-bh-time {
    white-space: nowrap;
}

.ai-gen-profile-history .ai-gen-balance-history-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 14px;
}

.ai-gen-profile-history .ai-gen-balance-history-table th,
.ai-gen-profile-history .ai-gen-balance-history-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.ai-gen-profile-history .ai-gen-balance-history-table th {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
}

.ai-gen-profile-history .ai-gen-balance-history-table th:first-child,
.ai-gen-profile-history .ai-gen-balance-history-table td:first-child,
.ai-gen-profile-history .ai-gen-balance-history-table th:last-child,
.ai-gen-profile-history .ai-gen-balance-history-table td:last-child {
    width: 1%;
    white-space: nowrap;
}

.ai-gen-profile-history .ai-gen-balance-history-table th:nth-child(2),
.ai-gen-profile-history .ai-gen-balance-history-table td:nth-child(2) {
    width: 99%;
}

.ai-gen-profile-history .ai-gen-balance-history-table td:first-child,
.ai-gen-profile-history .ai-gen-balance-history-table th:first-child {
    padding-right: 8px;
}

@container ai-gen-bh (max-width: 860px) {
    .ai-gen-profile-history .ai-gen-balance-history-table td:first-child {
        white-space: normal;
    }

    .ai-gen-profile-history .ai-gen-bh-time {
        display: block;
    }
}

@media (max-width: 860px) {
    .ai-gen-profile-history .ai-gen-balance-history-table td:first-child {
        white-space: normal;
    }

    .ai-gen-profile-history .ai-gen-bh-time {
        display: block;
    }
}

.ai-gen-profile-history .ai-gen-balance-history-table td:last-child,
.ai-gen-profile-history .ai-gen-balance-history-table th:last-child {
    padding-left: 8px;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 860px) {
    .ai-gen-profile-split {
        grid-template-columns: 1fr;
    }

    .ai-gen-profile-hero {
        padding: 18px 16px;
    }

    .ai-gen-profile-card {
        padding: 16px;
    }

    .ai-gen-profile-hero-chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .ai-gen-profile-page {
        padding-left: 12px;
        padding-right: 12px;
    }
}

.ai-gen-profile-email-form.is-busy .ai-gen-btn-spinner {
    display: inline-block;
}

.ai-gen-profile-email-form .ai-gen-btn-spinner {
    display: none;
}

.ai-gen-profile-email-form .is-loading .ai-gen-btn-text {
    opacity: 0.55;
}

.ai-gen-profile-email-form .is-loading .ai-gen-btn-spinner {
    display: inline-block;
}

