/* Landing overrides — переменные синхронизированы с app.css */
:root {
    --ag-shadow: 0 12px 40px -16px rgba(14, 116, 178, 0.22);
}

* { box-sizing: border-box; }

body.ag-body {
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(219, 234, 254, 0.55), transparent 60%),
        radial-gradient(900px 500px at 100% 20%, rgba(224, 231, 255, 0.45), transparent 55%),
        #f5f7fb;
    color: var(--ag-text);
    min-height: 100vh;
    margin: 0;
}

a { color: inherit; text-decoration: none; }

.ag-container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.ag-container-wide { max-width: 1240px; }

.ag-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 10px 20px; font-weight: 600; font-size: 14px; border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, background .15s ease, box-shadow .15s ease; font-family: inherit; }
.ag-btn[hidden] { display: none; }
.ag-btn:active { transform: translateY(1px); }
.ag-btn-primary { background: var(--ag-primary); color: #fff; box-shadow: 0 8px 20px -10px rgba(14, 165, 233, 0.65); }
.ag-btn-primary:hover { background: var(--ag-primary-hover); color: #fff; }
.ag-btn-ghost { background: transparent; border-color: var(--ag-border); color: var(--ag-text); }
.ag-btn-ghost:hover { border-color: var(--ag-primary); color: var(--ag-primary); }
.ag-btn-block { width: 100%; }

.ag-token-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    font-size: 1.05em;
    vertical-align: -0.18em;
    color: inherit;
    flex-shrink: 0;
    line-height: 1;
}
.ag-btn .ag-token-icon { font-size: 15px; width: 15px; height: 15px; }
.ag-btn-primary .ag-token-icon { color: #fff; }
.ag-sidebar-user-plan .ag-token-icon { color: var(--ag-primary); font-size: 14px; width: 14px; height: 14px; vertical-align: -0.2em; }
.ag-plan-price-cur .ag-token-icon,
.ag-price-cur .ag-token-icon { font-size: 22px; width: 22px; height: 22px; color: var(--ag-primary); }

/* --- Hero --- */
.ag-hero { padding: 72px 0 48px; text-align: center; }
.ag-hero-sidebar { padding: 4px 0 24px; }
.ag-section-first { padding-top: 4px; }
.ag-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--ag-primary-soft); color: var(--ag-primary); font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.ag-hero h1 { font-size: clamp(30px, 4.6vw, 52px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 16px; font-weight: 700; }
.ag-hero h1 span { background: linear-gradient(135deg, var(--ag-primary), var(--ag-accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ag-hero p { max-width: 620px; margin: 0 auto 28px; color: var(--ag-text-muted); font-size: 16px; line-height: 1.6; }
.ag-hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.ag-hero-compact { padding: 4px 0 16px; }
.ag-hero-compact h1 { font-size: clamp(26px, 3.8vw, 40px); margin-bottom: 10px; }
.ag-hero-compact p { font-size: 15px; margin-bottom: 8px; }
.ag-home-chat-section { padding-top: 0; padding-bottom: 40px; }
.ag-home-chat-widget { min-height: 540px; }
.ag-home-chat-guest-hint { margin: 10px 14px 0; font-size: 12.5px; color: var(--ag-text-muted); text-align: center; }

/* --- Sections --- */
.ag-section { padding: 56px 0; }
.ag-section-head { max-width: 640px; margin: 0 auto 40px; text-align: center; }
.ag-section-head h2 { font-size: clamp(24px, 3.2vw, 32px); letter-spacing: -0.015em; margin: 0 0 10px; font-weight: 700; }
.ag-section-head p { color: var(--ag-text-muted); font-size: 15px; line-height: 1.6; margin: 0; }

.ag-grid { display: grid; gap: 16px; }
.ag-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ag-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .ag-grid-3, .ag-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .ag-grid-3, .ag-grid-4 { grid-template-columns: 1fr; } }

.ag-card { position: relative; background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); padding: 20px; transition: border-color .15s, box-shadow .15s; }
.ag-card[href] { display: block; color: inherit; text-decoration: none; }
.ag-card[href]:hover { border-color: rgba(14, 165, 233, 0.45); box-shadow: var(--ag-shadow); }
.ag-feature-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--ag-primary-soft); color: var(--ag-primary); font-size: 18px; margin-bottom: 12px; }
.ag-card h3 { font-size: 16px; margin: 0 0 6px; font-weight: 600; }
.ag-card p { color: var(--ag-text-muted); font-size: 13.5px; line-height: 1.55; margin: 0; }
.ag-card-badge { position: absolute; top: 16px; right: 16px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ag-text-muted); background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: 999px; padding: 2px 8px; }

/* --- Steps --- */
.ag-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: ag-step; }
@media (max-width: 820px) { .ag-steps { grid-template-columns: 1fr; } }
.ag-step { position: relative; padding: 20px 18px; background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); }
.ag-step::before { counter-increment: ag-step; content: counter(ag-step); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--ag-primary), var(--ag-accent)); color: #fff; font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.ag-step h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.ag-step p { color: var(--ag-text-muted); font-size: 13.5px; margin: 0; line-height: 1.55; }

/* --- Pricing --- */
.ag-pricing-card { max-width: 400px; margin: 0 auto; background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: 16px; padding: 28px; text-align: center; box-shadow: var(--ag-shadow); }
.ag-price { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin: 16px 0 4px; }
.ag-price-value { font-size: 46px; font-weight: 800; letter-spacing: -0.02em; }
.ag-price-cur, .ag-price-period { color: var(--ag-text-muted); font-size: 14px; }
.ag-pricing-features { list-style: none; padding: 0; margin: 22px 0 24px; text-align: left; display: grid; gap: 10px; }
.ag-pricing-features li { display: flex; align-items: center; gap: 10px; color: var(--ag-text); font-size: 14px; }
.ag-pricing-features iconify-icon { color: var(--ag-primary); font-size: 17px; flex-shrink: 0; }

/* --- FAQ --- */
.ag-faq { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.ag-faq-item { background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-radius-sm); overflow: hidden; }
.ag-faq-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.ag-faq-question { flex: 1; color: var(--ag-text); font-weight: 600; font-size: 14.5px; text-decoration: none; line-height: 1.45; }
.ag-faq-question:hover { color: var(--ag-primary); }
.ag-faq-toggle { flex-shrink: 0; width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--ag-text-muted); font-size: 18px; font-weight: 400; cursor: pointer; display: grid; place-items: center; font-family: inherit; }
.ag-faq-toggle:hover { color: var(--ag-primary); background: var(--ag-primary-soft); }
.ag-faq-item.is-open .ag-faq-toggle-icon { transform: rotate(45deg); }
.ag-faq-body { padding: 0 18px 14px; }
.ag-faq-body[hidden] { display: none; }
.ag-faq-body p { color: var(--ag-text-muted); font-size: 14px; line-height: 1.6; margin: 0; }

/* --- Auth pages --- */
.ag-auth-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.ag-auth-card { width: 100%; max-width: 400px; background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); padding: 28px; box-shadow: var(--ag-shadow); }
.ag-auth-card h1 { font-size: 22px; margin: 0 0 18px; letter-spacing: -0.01em; }
.ag-field { margin-bottom: 14px; }
.ag-field label { display: block; font-size: 13px; color: var(--ag-text-muted); margin-bottom: 5px; }
.ag-input-group { display: flex; gap: 8px; }
.ag-input { width: 100%; background: var(--ag-bg-soft); border: 1px solid var(--ag-border); color: var(--ag-text); border-radius: var(--ag-radius-sm); padding: 10px 12px; font-size: 14px; font-family: inherit; }
.ag-input:focus { outline: none; border-color: var(--ag-primary); box-shadow: 0 0 0 3px var(--ag-primary-soft); }
.ag-hint { margin-top: 6px; font-size: 12.5px; }
.ag-hint a { color: var(--ag-primary); font-weight: 600; }
.ag-foot-note { margin-top: 18px; font-size: 13px; color: var(--ag-text-muted); text-align: center; }
.ag-foot-note a { color: var(--ag-primary); font-weight: 600; }

.ag-alert { border-radius: var(--ag-radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.ag-alert-success { background: var(--ag-success-bg); border-color: var(--ag-success-border); color: var(--ag-success-text); }
.ag-alert-danger { background: var(--ag-danger-bg); border-color: var(--ag-danger-border); color: var(--ag-danger-text); }
.ag-alert-info { background: var(--ag-primary-soft); border-color: rgba(14, 165, 233, 0.35); color: var(--ag-info-text); }

/* --- Auth modal --- */
.ag-auth-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease; }
.ag-auth-overlay.is-open { opacity: 1; visibility: visible; }
.ag-auth-modal { position: relative; width: 100%; max-width: 360px; max-height: 90vh; overflow-y: auto; background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); padding: 20px; box-shadow: var(--ag-shadow); transform: translateY(10px); transition: transform .18s ease; }
.ag-auth-overlay.is-open .ag-auth-modal { transform: translateY(0); }
.ag-auth-close { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border: none; background: transparent; color: var(--ag-text-muted); font-size: 18px; line-height: 1; display: grid; place-items: center; border-radius: 8px; cursor: pointer; }
.ag-auth-close:hover { color: var(--ag-text); background: var(--ag-bg-soft); }
.ag-auth-promo {
    margin: 0 28px 14px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(14, 165, 233, 0.12) 0%, rgba(14, 165, 233, 0.03) 100%);
    border: 1px solid rgba(14, 165, 233, 0.2);
}
.ag-auth-promo-lead {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ag-text-muted);
}
.ag-auth-promo-title {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--ag-text);
}
.ag-auth-promo-bonus {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 10px;
    border-radius: 10px;
    background: var(--ag-surface);
    border: 1px solid rgba(14, 165, 233, 0.28);
    color: #0284c7;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}
.ag-auth-promo-bonus iconify-icon { font-size: 16px; flex-shrink: 0; }
.ag-auth-heading { font-size: 18px; font-weight: 700; margin: 0 32px 12px 0; line-height: 1.3; letter-spacing: -0.01em; color: var(--ag-text); }
.ag-auth-oauth { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.ag-oauth-btn { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; padding: 0; border: none; border-radius: 14px; background: transparent; cursor: pointer; font-family: inherit; text-decoration: none; transition: transform .15s ease, opacity .15s ease; }
.ag-oauth-btn:hover:not(:disabled) { transform: scale(1.06); }
.ag-oauth-btn:disabled { cursor: not-allowed; opacity: 0.45; }
.ag-oauth-btn iconify-icon { font-size: 44px; }
.ag-oauth-btn-yandex iconify-icon { color: #fc3f1d; }
.ag-oauth-btn-vk iconify-icon { color: #0077ff; }
.ag-oauth-btn-label { display: none; }
.ag-auth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 12px; color: var(--ag-text-muted); font-size: 12px; }
.ag-auth-divider::before, .ag-auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--ag-border); }
.ag-auth-tabs { display: flex; gap: 4px; background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: 999px; padding: 3px; margin: 0 32px 14px 0; }
.ag-auth-tab { flex: 1; border: none; background: transparent; color: var(--ag-text-muted); font-size: 13px; font-weight: 600; padding: 7px 0; border-radius: 999px; cursor: pointer; font-family: inherit; }
.ag-auth-tab.is-active { background: var(--ag-surface); color: var(--ag-text); box-shadow: 0 2px 8px -4px rgba(15, 23, 42, 0.25); }
.ag-auth-panel { display: none; }
.ag-auth-panel.is-active { display: block; }
.ag-auth-panel .ag-field { margin-bottom: 10px; }
.ag-auth-panel .ag-consent-list { gap: 6px; margin-bottom: 12px; }
.ag-auth-panel .ag-consent-item { font-size: 11.5px; }
.ag-link-btn { background: none; border: none; padding: 0; color: var(--ag-primary); font-weight: 600; font-size: inherit; font-family: inherit; cursor: pointer; }
.ag-link-btn:hover { text-decoration: underline; }
body.ag-modal-open { overflow: hidden; }
.ag-consent-list { display: grid; gap: 8px; margin-bottom: 14px; }
.ag-consent-item { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.45; color: var(--ag-text-muted); cursor: pointer; }
.ag-consent-item input { margin-top: 2px; flex-shrink: 0; accent-color: var(--ag-primary); }
.ag-consent-item a { color: var(--ag-primary); font-weight: 600; }

/* --- Static content pages --- */
.ag-doc { max-width: 760px; margin: 0 auto; padding: 48px 20px; color: var(--ag-text); }
.ag-doc h1 { font-size: 28px; margin-bottom: 20px; font-weight: 700; }
.ag-doc h2 { font-size: 18px; margin: 28px 0 10px; font-weight: 600; }
.ag-doc p, .ag-doc li { color: var(--ag-text-muted); font-size: 14.5px; line-height: 1.7; }

/* --- Tool landing (1.jpg ref) --- */
.ag-tool-landing { padding-bottom: 0; }
.ag-landing-ref .ag-landing-header { padding: 20px 0 8px; text-align: center; }
.ag-landing-ref .ag-landing-header .ag-eyebrow {
    font-size: 16px;
    font-weight: 600;
    padding: 6px 14px;
    margin-bottom: 14px;
    background: rgba(219, 234, 254, 0.65);
    color: #000000;
    border: 1px solid rgba(191, 219, 254, 0.8);
}
.ag-landing-ref .ag-landing-header h1 {
    font-size: clamp(24px, 3.6vw, 24px);
    line-height: 1.15;
    letter-spacing: -0.025em;
    max-width: 760px;
    margin-inline: auto;
    color: #111827;
}
@media (max-width: 900px) {
    .ag-landing-ref .ag-landing-header .ag-eyebrow { font-size: 10px; white-space: nowrap; }
    .ag-landing-ref .ag-landing-header h1 { font-size: 16px; }
    .ag-container-wide { padding-left: 0; padding-right: 0; }
}
.ag-landing-ref .ag-landing-chat { padding: 8px 0 32px; }
.ag-landing-ref .ag-landing-block { padding: 56px 0; }
.ag-landing-ref .ag-section-alt { background: transparent; border: none; }
.ag-landing-ref .ag-section-last { padding-bottom: 64px; }
.ag-landing-ref .ag-section-head-left { margin-bottom: 28px; }
.ag-landing-ref .ag-section-head-left h2 {
    font-size: clamp(22px, 2.6vw, 30px);
    color: #111827;
    letter-spacing: -0.02em;
}
.ag-landing-ref .ag-section-head-left p { font-size: 15px; color: #6b7280; }

/* Capabilities */
.ag-landing-ref .ag-cap-card {
    background: #eef4ff;
    border: none;
    border-radius: 16px;
    padding: 22px 20px;
    height: 100%;
    transition: transform .15s ease, box-shadow .15s ease;
}
.ag-landing-ref .ag-cap-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -16px rgba(37, 99, 235, 0.25);
}
.ag-landing-ref .ag-cap-card .ag-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #dbeafe;
    color: #000;
    font-size: 22px;
    margin-bottom: 14px;
}
.ag-landing-ref .ag-cap-card h3 { font-size: 16px; color: #111827; margin-bottom: 8px; }
.ag-landing-ref .ag-cap-card p { font-size: 14px; color: #6b7280; line-height: 1.55; }

/* Steps timeline */
.ag-landing-ref .ag-steps-ref {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    position: relative;
    counter-reset: none;
}
.ag-landing-ref .ag-steps-ref::before {
    content: '';
    position: absolute;
    top: 28px;
    left: 18%;
    right: 18%;
    height: 2px;
    background: linear-gradient(90deg, #bfdbfe, #93c5fd, #bfdbfe);
    z-index: 0;
}
.ag-landing-ref .ag-step-ref {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 12px;
    background: transparent;
    border: none;
}
.ag-landing-ref .ag-step-ref::before { display: none; }
.ag-landing-ref .ag-step-num {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid #bfdbfe;
    color: #0ea5e9;
    font-size: 22px;
    font-weight: 700;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 14px -6px rgba(37, 99, 235, 0.35);
}
.ag-landing-ref .ag-step-ref h3 { font-size: 16px; color: #111827; margin-bottom: 8px; }
.ag-landing-ref .ag-step-ref p { font-size: 14px; color: #6b7280; line-height: 1.55; }
@media (max-width: 820px) {
    .ag-landing-ref .ag-steps-ref { grid-template-columns: 1fr; gap: 28px; }
    .ag-landing-ref .ag-steps-ref::before { display: none; }
}

/* About text */
.ag-landing-ref .ag-landing-prose {
    max-width: none;
    padding: 28px 32px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.75;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.ag-landing-ref .ag-landing-prose h2,
.ag-landing-ref .ag-landing-prose h3 {
    color: #111827;
    line-height: 1.35;
    margin: 0 0 12px;
}
.ag-landing-ref .ag-landing-prose h2 { font-size: 20px; margin-bottom: 14px; }
.ag-landing-ref .ag-landing-prose h3 { font-size: 16px; margin-top: 22px; }
.ag-landing-ref .ag-landing-prose p { margin: 0 0 12px; }
.ag-landing-ref .ag-landing-prose ul { margin: 0 0 14px; padding-left: 20px; }
.ag-landing-ref .ag-landing-prose li { margin-bottom: 6px; }
.ag-landing-ref .ag-landing-prose li:last-child { margin-bottom: 0; }

/* FAQ */
.ag-landing-ref .ag-faq { max-width: none; gap: 8px; }
.ag-landing-ref .ag-faq-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ag-landing-ref .ag-faq-head {
    padding: 16px 20px;
    gap: 16px;
}
.ag-landing-ref .ag-faq-question {
    font-size: 15px;
    color: #111827;
}
.ag-landing-ref .ag-faq-question:hover { color: var(--ag-primary); }
.ag-landing-ref .ag-faq-toggle {
    width: 28px;
    height: 28px;
    color: #9ca3af;
    font-size: 22px;
    font-weight: 300;
}
.ag-landing-ref .ag-faq-body {
    padding: 0 20px 16px;
}
.ag-landing-ref .ag-faq-body p {
    font-size: 14px;
    color: #6b7280;
}

/* Models */
.ag-landing-ref .ag-model-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}
.ag-landing-ref .ag-model-chip {
    flex: 0 0 auto;
    min-width: 148px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.ag-landing-ref .ag-model-chip-name { font-size: 14px; color: #111827; }
.ag-landing-ref .ag-model-chip-meta { font-size: 12px; color: #9ca3af; margin-top: 2px; }

/* Advantages */
.ag-landing-ref .ag-adv-card-ref {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.ag-landing-ref .ag-adv-card-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    background: #eef4ff;
    color: #000;
    display: grid;
    place-items: center;
    font-size: 24px;
}
.ag-landing-ref .ag-adv-card-body h3 { font-size: 16px; color: #111827; margin: 0 0 6px; }
.ag-landing-ref .ag-adv-card-body p { font-size: 14px; color: #6b7280; margin: 0; line-height: 1.55; }

/* Can create */
.ag-landing-ref .ag-create-list li {
    font-size: 15px;
    color: #374151;
    gap: 10px;
}
.ag-landing-ref .ag-create-list iconify-icon {
    color: #14b8a6;
    font-size: 20px;
}
.ag-sidebar-brand img {
    width: 150px;
    margin-left: 15px;
}
.ag-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .ag-grid-2 { grid-template-columns: 1fr; } }
.ag-create-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
@media (max-width: 620px) { .ag-create-list { grid-template-columns: 1fr; } }
.ag-create-list li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ag-text); }
.ag-related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 820px) { .ag-related-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .ag-related-grid { grid-template-columns: 1fr; } }

/* Related */
.ag-landing-ref .ag-related-link {
    text-align: center;
    padding: 14px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color .15s, color .15s, box-shadow .15s;
}
.ag-landing-ref .ag-related-link:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 14px -6px rgba(37, 99, 235, 0.2);
}

/* Reviews */
.ag-landing-ref .ag-reviews-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}
.ag-landing-ref .ag-review-card {
    flex: 0 0 min(320px, 85vw);
    margin: 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.ag-landing-ref .ag-review-stars { color: #fbbf24; font-size: 14px; margin-bottom: 10px; }
.ag-landing-ref .ag-review-card p { font-size: 14px; color: #374151; line-height: 1.6; }
.ag-landing-ref .ag-review-card footer { font-size: 13px; color: #9ca3af; font-weight: 500; }

/* Legacy tool landing (non-ref pages) */
.ag-tool-landing:not(.ag-landing-ref) .ag-landing-header { padding: 12px 0 4px; text-align: center; }
.ag-tool-landing:not(.ag-landing-ref) .ag-landing-header h1 { font-size: clamp(26px, 4vw, 24px); line-height: 1.12; letter-spacing: -0.02em; margin: 0; max-width: 820px; margin-inline: auto; font-weight: 700; }
.ag-tool-landing:not(.ag-landing-ref) .ag-landing-chat { padding: 6px 0 24px; }
.ag-tool-landing:not(.ag-landing-ref) .ag-landing-block { padding: 48px 0; }
.ag-tool-landing:not(.ag-landing-ref) .ag-section-alt { background: var(--ag-surface); border-block: 1px solid var(--ag-border); }
.ag-tool-landing:not(.ag-landing-ref) .ag-section-last { padding-bottom: 56px; }
.ag-tool-landing:not(.ag-landing-ref) .ag-section-head-left { text-align: left; margin: 0 0 24px; max-width: none; }
.ag-tool-landing:not(.ag-landing-ref) .ag-section-head-left h2 { font-size: clamp(20px, 2.8vw, 28px); margin: 0 0 6px; font-weight: 700; }
.ag-tool-landing:not(.ag-landing-ref) .ag-section-head-left p { margin: 0; color: var(--ag-text-muted); font-size: 14px; }
.ag-cap-card { background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); padding: 18px; }
.ag-cap-card h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.ag-cap-card p { color: var(--ag-text-muted); font-size: 13px; line-height: 1.55; margin: 0; }
.ag-adv-card { padding: 18px 20px; background: linear-gradient(135deg, var(--ag-primary-soft), transparent); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); }
.ag-adv-card h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.ag-adv-card p { color: var(--ag-text-muted); font-size: 13px; margin: 0; line-height: 1.55; }
.ag-landing-prose { max-width: 820px; margin: 0 auto; color: var(--ag-text-muted); font-size: 14.5px; line-height: 1.75; }
.ag-landing-prose h2,
.ag-landing-prose h3 { color: var(--ag-text); margin: 0 0 10px; line-height: 1.35; }
.ag-landing-prose h2 { font-size: 18px; }
.ag-landing-prose h3 { font-size: 15px; margin-top: 18px; }
.ag-landing-prose p { margin: 0 0 10px; }
.ag-landing-prose ul { margin: 0 0 12px; padding-left: 20px; }
.ag-landing-prose a { color: var(--ag-primary); text-decoration: underline; text-underline-offset: 2px; }
.ag-landing-prose a:hover { color: var(--ag-accent); }
.ag-model-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-model-chip { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: 999px; font-size: 12px; }
.ag-model-chip-name { font-weight: 600; color: var(--ag-text); }
.ag-model-chip-meta { font-size: 11px; color: var(--ag-text-muted); }
.ag-related-link { display: block; padding: 12px 14px; background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: var(--ag-radius-sm); font-size: 13px; font-weight: 600; color: var(--ag-text); transition: border-color .15s, color .15s; }
.ag-related-link:hover { border-color: var(--ag-primary); color: var(--ag-primary); }
.ag-reviews-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ag-review-card { margin: 0; padding: 16px; background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); }
.ag-review-stars { color: #f59e0b; font-size: 13px; letter-spacing: 1px; margin-bottom: 8px; }
.ag-review-card p { font-size: 13px; line-height: 1.55; color: var(--ag-text); margin: 0 0 10px; }
.ag-review-card footer { font-size: 12px; color: var(--ag-text-muted); font-weight: 600; }
@media (max-width: 900px) { .ag-reviews-grid:not(.ag-reviews-scroll) { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .ag-reviews-grid:not(.ag-reviews-scroll) { grid-template-columns: 1fr; } }
.ag-reviews-actions { display: flex; justify-content: center; margin-top: 28px; }
.ag-review-modal { max-width: 440px; }
.ag-review-modal-lead { margin: -4px 0 16px; font-size: 13.5px; line-height: 1.5; color: var(--ag-text-muted); }
.ag-review-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ag-review-textarea { resize: vertical; min-height: 120px; }
.ag-review-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 560px) {
    .ag-review-row { grid-template-columns: 1fr; gap: 0; }
}

/* --- Chat categories (rugpt tabs) --- */
.ag-chat-suite { display: flex; flex-direction: column; gap: 14px; }
.ag-chat-categories { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 2px; }
.ag-chat-cat-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--ag-text); font-size: 14px; font-weight: 600; transition: border-color .15s, box-shadow .15s, background .15s, color .15s; }
.ag-chat-cat-btn iconify-icon { font-size: 18px; color: var(--ag-primary); }
.ag-chat-cat-chevron { font-size: 14px !important; color: var(--ag-text-muted) !important; opacity: .6; }
.ag-chat-cat-btn:hover,
.ag-chat-cat-btn.is-active { border-color: var(--ag-primary); background: var(--ag-primary-soft); color: var(--ag-primary); box-shadow: 0 4px 16px -8px rgba(14, 165, 233, 0.35); }
.ag-chat-cat-all .ag-chat-cat-count { margin-left: 2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--ag-primary-soft); color: var(--ag-primary); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.ag-chat-cat-dropdown { position: relative; }
.ag-chat-cat-dropdown-trigger { cursor: pointer; font: inherit; }
.ag-chat-cat-dropdown-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    padding-top: 8px;
    z-index: 60;
}
/* Hover-открытие только на десктопе с мышью — на тач :hover залипает и мешает клику. */
@media (hover: hover) and (pointer: fine) {
    .ag-chat-cat-dropdown:hover .ag-chat-cat-dropdown-panel { display: block; }
}
.ag-chat-cat-dropdown.is-open .ag-chat-cat-dropdown-panel { display: block; }
.ag-chat-cat-dropdown-panel.is-pinned {
    position: fixed;
    padding-top: 0;
    z-index: 220;
    display: block;
}
.ag-chat-cat-dropdown-panel.is-pinned .ag-chat-cat-dropdown-panel-inner {
    min-width: 0;
    width: 100%;
}
.ag-chat-cat-dropdown-panel-inner {
    min-width: 240px;
    background: var(--ag-surface);
    border: 1px solid var(--ag-border);
    border-radius: 12px;
    box-shadow: var(--ag-shadow);
    padding: 6px;
}
.ag-chat-cat-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ag-text);
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.ag-chat-cat-dropdown-item iconify-icon { font-size: 17px; color: var(--ag-text-muted); flex-shrink: 0; }
.ag-chat-cat-dropdown-item:hover { background: var(--ag-bg-soft); }
.ag-chat-cat-dropdown-item.is-active { background: var(--ag-primary-soft); color: var(--ag-primary); font-weight: 600; }
.ag-chat-cat-dropdown-item.is-active iconify-icon { color: var(--ag-primary); }
@media (max-width: 720px) {
    /* Только иконки, в одну строку с горизонтальным скроллом — без подписей, шеврона и счётчика. */
    html, body { overflow-x: hidden; }
    .ag-chat-suite { max-width: 100%; min-width: 0; }
    .ag-media-widget-wrap > .ag-chat-widget { min-height: 0; height: auto; }
    .ag-media-widget-wrap { margin-top: 0; max-width: 100%; }
    .ag-widget-fullscreen-btn { top: 8px; right: 8px; }
    .ag-landing-ref .ag-landing-header { padding: 16px 0 4px; }
    .ag-landing-ref .ag-landing-block { padding: 40px 0; }
    .ag-landing-ref .ag-landing-chat { padding: 4px 0 24px; overflow-x: hidden; }
    .ag-chat-cat-dropdown { width: auto; flex-shrink: 0; }
    .ag-chat-cat-dropdown-trigger { width: 44px; }
    .ag-chat-categories {
        display: flex;
        flex-wrap: nowrap;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding: 8px;
        background: var(--ag-surface);
        border: 1px solid var(--ag-border);
        border-radius: 14px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .ag-chat-categories::-webkit-scrollbar { display: none; }
    .ag-chat-cat-btn {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
        padding: 0;
        justify-content: center;
        border: 1px solid var(--ag-border);
        background: var(--ag-bg-soft);
        border-radius: 12px;
    }
    .ag-chat-cat-btn span,
    .ag-chat-cat-chevron,
    .ag-chat-cat-count { display: none !important; }
    .ag-chat-cat-btn.is-active {
        border-color: var(--ag-primary);
        background: var(--ag-primary-soft);
        box-shadow: none;
    }
    .ag-chat-cat-dropdown-panel { left: 0; right: auto; }
    .ag-chat-cat-dropdown-panel-inner { min-width: min(260px, calc(100% - 28px)); }
    .ag-home-chat-widget { min-height: 68vh; height: auto; }
    .ag-chat-layout { flex-direction: column; }
    .ag-chat-rail { width: 100%; max-height: 140px; border-right: none; border-bottom: 1px solid var(--ag-border); }
}
.ag-home-chat-widget { min-height: 540px; height: min(72vh, 660px); box-shadow: var(--ag-shadow); border-radius: 16px; border: 1px solid var(--ag-border); }

/* --- Media widgets: fullscreen снаружи карточки --- */
.ag-media-widget-wrap { position: relative; margin-top: 8px; }
.ag-media-widget-wrap > .ag-chat-widget { height: min(72vh, 660px); min-height: 720px; }
.ag-widget-fullscreen-btn {
    position: absolute; top: -14px; right: -14px; z-index: 6;
    width: 36px; height: 36px; border-radius: 10px;
    border: 1px solid var(--ag-border); background: var(--ag-surface);
    color: var(--ag-text-muted); display: grid; place-items: center;
    cursor: pointer; box-shadow: var(--ag-shadow); font-size: 18px;
}
.ag-widget-fullscreen-btn:hover { color: var(--ag-primary); border-color: rgba(14, 165, 233, 0.45); }

.ag-gallery-grid-split {
    width: 100%; height: 100%; overflow-y: auto; padding: 16px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px; align-content: start;
}
.ag-image-output-stage,
.ag-audio-output-stage { align-items: center; justify-content: center; padding: 20px; }
.ag-audio-output-stage .ag-audio-list-split { flex: 1; width: 100%; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.ag-audio-output-stage .ag-audio-list-split:has(#ag-audio-output-empty) { align-items: center; justify-content: center; }
.ag-audio-list-split { width: 100%; height: 100%; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ag-model-picker-models-single { display: flex; flex-direction: column; min-width: 280px; max-height: 320px; overflow-y: auto; padding: 6px; }
.ag-model-picker-models-single .ag-model-picker-model { width: 100%; }

body.ag-body .ag-content { max-width: 100%; padding-top: 12px; }
body.ag-body .ag-main { background: transparent; }
@media (max-width: 900px) {
    body.ag-body .ag-content { padding-top: 15px; }
}

/* --- Перефразирование текста / орфография (layout как у видео) --- */
.ag-rewrite-split .ag-rewrite-source-field { flex: 1; min-height: 180px; display: flex; flex-direction: column; }
.ag-rewrite-split .ag-rewrite-textarea { flex: 1; min-height: 160px; }
.ag-rewrite-output-stage { position: relative; display: flex; flex-direction: column; min-height: 220px; }
.ag-rewrite-output-stage .ag-rewrite-result {
    flex: 1; min-height: 180px; overflow-y: auto; padding: 14px 14px 30px;
    font-size: 14.5px; line-height: 1.55; color: var(--ag-text);
    white-space: pre-wrap; word-break: break-word; background: var(--ag-surface);
    border: 1px solid var(--ag-border); border-radius: 14px;
}
.ag-rewrite-output-stage .ag-rewrite-counter { position: absolute; right: 20px; bottom: 16px; }
.ag-rewrite-history-bar { display: flex; align-items: center; gap: 8px; padding: 10px 0 6px; flex-wrap: wrap; }
.ag-rewrite-history-list {
    display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow-y: auto;
    border-top: 1px solid var(--ag-border); padding-top: 8px;
}
.ag-rewrite-panel-actions { display: flex; gap: 6px; }
.ag-rewrite-panel-actions .ag-icon-btn { width: 28px; height: 28px; font-size: 14px; }
.ag-video-col-head .ag-rewrite-diff-toggle { margin-left: auto; }
.ag-spellcheck-widget .ag-spellcheck-tabs { padding: 0 0 10px; }
.ag-spellcheck-widget .ag-spellcheck-stats-row { margin: 0 0 12px; }
.ag-spellcheck-widget .ag-spellcheck-summary { margin-top: 10px; }
.ag-spellcheck-widget .ag-spellcheck-copy { flex-shrink: 0; }

.ag-rewrite-main { padding: 16px 16px 14px; gap: 14px; overflow-y: auto; }
.ag-rewrite-panels { flex: 1; min-height: 220px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ag-rewrite-panel { display: flex; flex-direction: column; min-height: 0; background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: 14px; overflow: hidden; }
.ag-rewrite-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--ag-border); }
.ag-rewrite-panel-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ag-text); }
.ag-rewrite-textwrap { position: relative; flex: 1; min-height: 0; }
.ag-rewrite-textarea {
    width: 100%; height: 100%; resize: none; border: none; background: transparent; color: var(--ag-text);
    padding: 14px 14px 30px; font-size: 14.5px; line-height: 1.55; font-family: inherit;
}
.ag-rewrite-textarea:focus { outline: none; }
.ag-rewrite-result {
    height: 100%; overflow-y: auto; padding: 14px 14px 30px; font-size: 14.5px; line-height: 1.55; color: var(--ag-text);
    white-space: pre-wrap; word-break: break-word;
}
.ag-rewrite-result-empty { margin: 0; color: var(--ag-text-muted); }
.ag-rewrite-result mark { background: transparent; color: #16a34a; font-weight: 600; }
:root[data-theme="dark"] .ag-rewrite-result mark { color: #4ade80; }
.ag-rewrite-counter { position: absolute; right: 12px; bottom: 8px; font-size: 11.5px; color: var(--ag-text-muted); pointer-events: none; background: var(--ag-surface); padding: 1px 4px; border-radius: 4px; }

.ag-rewrite-diff-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ag-text-muted); cursor: pointer; user-select: none; }
.ag-rewrite-diff-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ag-rewrite-switch { position: relative; width: 34px; height: 19px; border-radius: 999px; background: var(--ag-border); transition: background .15s ease; flex-shrink: 0; }
.ag-rewrite-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.ag-rewrite-diff-toggle input:checked + .ag-rewrite-switch { background: var(--ag-primary); }
.ag-rewrite-diff-toggle input:checked + .ag-rewrite-switch::after { transform: translateX(15px); }

.ag-rewrite-controls { display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
.ag-rewrite-slider-row { display: flex; flex-direction: column; gap: 8px; }
.ag-rewrite-slider-row label { font-size: 13px; color: var(--ag-text-muted); }
.ag-rewrite-slider-row strong { color: var(--ag-text); }
.ag-rewrite-slider {
    -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 999px;
    background: var(--ag-border); outline: none; cursor: pointer;
}
.ag-rewrite-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%;
    background: var(--ag-primary); cursor: pointer; border: 2px solid var(--ag-surface); box-shadow: 0 0 0 1px var(--ag-primary);
}
.ag-rewrite-slider::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%; background: var(--ag-primary); cursor: pointer;
    border: 2px solid var(--ag-surface); box-shadow: 0 0 0 1px var(--ag-primary);
}
.ag-rewrite-selects-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ag-rewrite-selects-row .ag-chat-select { height: 40px; flex: 1; min-width: 160px; }
.ag-rewrite-submit-row { display: flex; gap: 10px; }
.ag-rewrite-submit { flex: 1; }
.ag-rewrite-submit:disabled { opacity: .6; cursor: not-allowed; }

.ag-rewrite-history-item { display: flex; align-items: center; border-radius: 8px; }
.ag-rewrite-history-open {
    display: block; flex: 1; min-width: 0; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13px;
    color: var(--ag-text-muted); background: transparent; border: none; cursor: pointer; font-family: inherit;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ag-rewrite-history-open:hover { background: var(--ag-bg-soft); color: var(--ag-text); }
.ag-rewrite-history-open.is-active { background: var(--ag-primary-soft); color: var(--ag-primary); font-weight: 600; }
.ag-rewrite-history-empty { padding: 6px 12px; }
.ag-rewrite-clear-history {
    display: flex; align-items: center; gap: 6px; margin-top: 0; padding: 8px 10px; border-radius: 8px; border: none;
    background: transparent; color: var(--ag-text-muted); font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.ag-rewrite-clear-history:hover { background: var(--ag-danger-bg); color: var(--ag-danger); }

@media (max-width: 780px) {
    .ag-rewrite-panels { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
    .ag-rewrite-selects-row .ag-chat-select { min-width: 0; }
    .ag-rewrite-submit-row { flex-direction: column; }
}

/* --- Проверка орфографии --- */
.ag-spellcheck-input-panel { margin: 0; }
.ag-spellcheck-tabs { display: flex; gap: 6px; padding: 10px 10px 0; }
.ag-spellcheck-tab {
    flex: 1; padding: 9px 12px; border-radius: 8px; border: none; background: var(--ag-bg-soft);
    color: var(--ag-text-muted); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.ag-spellcheck-tab.is-active { background: var(--ag-primary); color: #fff; }
.ag-spellcheck-file-tab { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 14px; }
.ag-spellcheck-file-tab[hidden] { display: none; }
.ag-spellcheck-file-drop {
    display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; height: 100%;
    border: 1px dashed var(--ag-border); border-radius: 10px; color: var(--ag-text-muted); font-size: 13px;
    cursor: pointer; justify-content: center; text-align: center; padding: 20px;
}
.ag-spellcheck-file-drop:hover { border-color: var(--ag-primary); color: var(--ag-primary); }
.ag-spellcheck-file-drop iconify-icon { font-size: 28px; }
.ag-spellcheck-stats-row { display: flex; gap: 18px; padding: 10px 14px; border-top: 1px solid var(--ag-border); flex-wrap: wrap; }
.ag-spellcheck-stat { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--ag-text-muted); }
.ag-spellcheck-stat strong { font-size: 14px; color: var(--ag-text); }
.ag-spellcheck-input-panel .ag-rewrite-submit { margin: 0 10px 10px; width: calc(100% - 20px); }
.ag-spellcheck-input-panel .ag-image-status { padding: 0 10px 10px; }

.ag-spellcheck-result mark {
    background: transparent; border: 1px solid rgba(22, 163, 74, .5); border-radius: 6px;
    padding: 0 4px; color: #16a34a; font-weight: 600;
}
.ag-spellcheck-result mark.is-punctuation { border-color: rgba(217, 119, 6, .5); color: #d97706; }
:root[data-theme="dark"] .ag-spellcheck-result mark { border-color: rgba(74, 222, 128, .5); color: #4ade80; }
:root[data-theme="dark"] .ag-spellcheck-result mark.is-punctuation { border-color: rgba(251, 191, 36, .5); color: #fbbf24; }

.ag-spellcheck-summary { margin: 0 14px 12px; padding: 10px 12px; background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: 10px; }
.ag-spellcheck-summary-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ag-text); font-weight: 600; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--ag-border); }
.ag-spellcheck-summary-head strong { color: var(--ag-primary); }
.ag-spellcheck-summary-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--ag-text-muted); padding: 2px 0; }
.ag-spellcheck-summary-row strong { color: var(--ag-text); }
.ag-spellcheck-copy { margin: 0 14px 14px; }

@media (max-width: 780px) {
    .ag-spellcheck-stats-row { gap: 12px; }
}

/* --- Subpages (2nd level) --- */
.ag-subpage { padding-top: 0; }
.ag-subpage-head { margin-bottom: 18px; }
.ag-subpage-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ag-text-muted);
    padding: 6px 0;
}
.ag-subpage-back:hover { color: var(--ag-primary); }
.ag-subpage-back iconify-icon { font-size: 18px; }
.ag-tool-landing-sub .ag-landing-chat { padding-top: 0; }
.ag-models-group { margin-bottom: 28px; }
.ag-models-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
}
.ag-models-group-title iconify-icon { color: var(--ag-primary); font-size: 22px; }
.ag-models-table-wrap { overflow-x: auto; border: 1px solid var(--ag-border); border-radius: var(--ag-radius); background: var(--ag-surface); }
.ag-models-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ag-models-table th,
.ag-models-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--ag-border); }
.ag-models-table th { color: var(--ag-text-muted); font-weight: 600; font-size: 12.5px; background: var(--ag-bg-soft); }
.ag-models-table tr:last-child td { border-bottom: none; }
.ag-models-table td:last-child { white-space: nowrap; font-weight: 600; color: var(--ag-primary); }

/* --- Site footer --- */
.ag-site-footer {
    margin-top: auto;
    padding: 32px 24px 36px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}
.ag-site-footer-ref {
    background: #fff;
    border-top: 1px solid #e5e7eb;
}
.ag-site-footer-inner { max-width: 1120px; margin: 0 auto; }
.ag-site-footer-top { margin-bottom: 20px; }
.ag-site-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}
.ag-site-footer-brand img {
    width: 150px;
}
.ag-site-footer-brand iconify-icon { font-size: 26px; color: #2563eb; }
.ag-site-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin-bottom: 16px;
}
.ag-site-footer-nav a {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.45;
}
.ag-site-footer-nav a:hover { color: #0ea5e9; }
.ag-site-footer-copy {
    margin: 0;
    font-size: 12px;
    color: #9ca3af;
}
@media (max-width: 900px) {
    .ag-site-footer { padding: 24px 14px 28px; }
    .ag-site-footer-nav { flex-direction: column; gap: 10px; }
}

/* Workspace: переключение чат / изображения / видео / аудио без перезагрузки */
.ag-workspace-panels { position: relative; }
.ag-workspace-panel[hidden] { display: none !important; }
.ag-chat-categories button.ag-chat-cat-btn {
    font: inherit;
    cursor: pointer;
    text-align: inherit;
}

/* Страница «Мои файлы» */
.ag-files-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.ag-files-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid transparent;
}
.ag-files-filter-btn.is-active {
    color: #2563eb;
    background: #eff6ff;
    border-color: #bfdbfe;
}
.ag-files-filter-count {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .06);
}
.ag-files-filter-btn.is-active .ag-files-filter-count { background: #dbeafe; }
.ag-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.ag-files-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.ag-files-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f9fafb;
    overflow: hidden;
    position: relative;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
}
.ag-files-thumb img,
.ag-files-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.ag-files-thumb-video { background: #000; }
.ag-files-thumb-video video { object-fit: contain; }
.ag-files-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    background: rgba(0, 0, 0, .18);
    transition: background .15s ease;
}
.ag-files-thumb-play iconify-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, .5);
}
.ag-files-thumb:hover .ag-files-thumb-play { background: rgba(0, 0, 0, .32); }
.ag-files-thumb-audio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
}
.ag-files-thumb-audio iconify-icon { font-size: 32px; color: #2563eb; }
.ag-files-thumb-audio audio { width: 100%; }
.ag-files-card-body { padding: 12px 14px 14px; }
.ag-files-card-title {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.4;
    color: #111827;
}
.ag-files-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin: 0 0 10px;
    font-size: 12px;
    color: #9ca3af;
}
.ag-files-download {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #2563eb;
}
.ag-files-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.ag-files-delete {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 13px;
    color: #9ca3af;
    cursor: pointer;
}
.ag-files-delete:hover { color: #dc2626; }
.ag-files-empty {
    text-align: center;
    padding: 48px 20px;
    color: #6b7280;
}
.ag-files-empty iconify-icon {
    font-size: 40px;
    color: #d1d5db;
    margin-bottom: 12px;
}

/* Полноэкранный слайдер файлов */
.ag-file-lightbox {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ag-file-lightbox.is-open { display: flex; }
.ag-file-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 7, 12, .94);
}
.ag-file-lightbox-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 80px 0;
}
.ag-file-lightbox-stage img,
.ag-file-lightbox-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}
.ag-file-lightbox-close,
.ag-file-lightbox-nav {
    position: absolute;
    z-index: 2;
    border: none;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-radius: 999px;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 20px;
}
.ag-file-lightbox-close:hover,
.ag-file-lightbox-nav:hover { background: rgba(255, 255, 255, .24); }
.ag-file-lightbox-close { top: 18px; right: 18px; width: 42px; height: 42px; }
.ag-file-lightbox-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 24px; }
.ag-file-lightbox-prev { left: 16px; }
.ag-file-lightbox-next { right: 16px; }
.ag-file-lightbox-nav:disabled { opacity: .3; cursor: not-allowed; }
.ag-file-lightbox-footer {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 920px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 24px;
}
.ag-file-lightbox-info { min-width: 0; }
.ag-file-lightbox-title {
    margin: 0;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ag-file-lightbox-meta {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .6);
}
.ag-file-lightbox-download { flex-shrink: 0; }

@media (max-width: 720px) {
    .ag-file-lightbox-stage { padding: 60px 16px 0; }
    .ag-file-lightbox-nav { width: 40px; height: 40px; font-size: 20px; }
    .ag-file-lightbox-prev { left: 6px; }
    .ag-file-lightbox-next { right: 6px; }
    .ag-file-lightbox-footer { flex-direction: column; align-items: stretch; }
    .ag-file-lightbox-download { justify-content: center; }
}

/* Cookie consent */
.ag-cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 10050;
    display: flex;
    justify-content: center;
    pointer-events: none;
}
.ag-cookie-banner[hidden] { display: none !important; }
.ag-cookie-banner-inner {
    pointer-events: auto;
    max-width: 720px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--ag-surface, #fff);
    border: 1px solid var(--ag-border, #e5e7eb);
    box-shadow: 0 10px 40px rgba(15, 23, 42, .14);
}
.ag-cookie-banner-text {
    margin: 0;
    flex: 1;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--ag-text, #111);
}
.ag-cookie-banner-text a { color: var(--ag-primary, #2563eb); }
.ag-cookie-banner-accept { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 640px) {
    .ag-cookie-banner { left: 10px; right: 10px; bottom: 10px; }
    .ag-cookie-banner-inner { flex-direction: column; align-items: stretch; }
    .ag-cookie-banner-accept { width: 100%; }
}

/* Confirm dialog */
.ag-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ag-confirm-modal[hidden] { display: none !important; }
.ag-confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
}
.ag-confirm-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--ag-surface, #fff);
    border: 1px solid var(--ag-border, #e5e7eb);
    border-radius: 16px;
    padding: 22px 22px 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .2);
}
.ag-confirm-modal-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
}
.ag-confirm-modal-card p {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ag-text-muted, #64748b);
}
.ag-confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.ag-confirm-modal-actions .ag-btn-danger {
    background: var(--ag-danger, #dc2626);
    border-color: var(--ag-danger, #dc2626);
    color: #fff;
}
