/* ============================================================================
   YAZME AI PORTAL 2026 | Шторка ИИ
   ----------------------------------------------------------------------------
   Дизайн-язык: редакционный (editorial). Серифная типографика с кириллицей,
   терракотовый акцент, пульсирующая точка вместо аватара ИИ, обтекание текста
   вокруг аватаров, три темы через токены yazme-theme.css (amber/cloud/midnight).
   Единственный слой стилей ИИ-шторки.
   ========================================================================== */

:root {
    --ap-serif: 'Source Serif 4', 'Lora', Georgia, 'Times New Roman', serif;
    --ap-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --ap-maxw: 780px;
    --ap-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ap-spring: cubic-bezier(0.34, 1.45, 0.5, 1);
}

/* ============================================================
   ОВЕРЛЕЙ (шторка)
   ============================================================ */
.ai-overlay-modal {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 2147483640 !important;
    /* Сплошной непрозрачный фон (страхуемся от любых сторонних «стёкол») */
    background: var(--yz-bg, #0F0E0D) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top-left-radius: 26px;
    border-top-right-radius: 26px;
    box-shadow: 0 -14px 50px rgba(0, 0, 0, 0.45);
    font-family: var(--ap-sans);
    color: var(--yz-text, #faf9f5);
    /* ВЫЕЗД ТОЛЬКО ТРАНСФОРМОМ · 20.10.2026
       Было: transition по top. top — свойство раскладки: на каждом кадре
       выезда браузер заново раскладывал всю шторку (замер: 20 сдвигов
       раскладки, CLS 0,67 за одно открытие). transform двигает готовый
       слой на видеочипе — раскладки нет вовсе.
       visibility:hidden на закрытой шторке НЕ ставим: это наследуемое
       свойство, и его смена пересчитывала стили всех узлов шторки в кадре
       открытия (замер: 34 мс против 11). Закрытая шторка просто стоит
       за нижним краем, как и раньше.
       Скругление меняется скачком в конце/начале движения (не анимируется):
       анимация border-radius перерисовывала слой на каждом кадре.
       ОТКАТ: вернуть top:100% / .active{top:0} и transition: top. */
    top: 0;
    transform: translate3d(0, 100%, 0);
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.ai-overlay-modal.active {
    top: 0;
    transform: translate3d(0, 0, 0);
    border-top-left-radius: 0; border-top-right-radius: 0;
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1),
                border-top-left-radius 0s linear 0.5s, border-top-right-radius 0s linear 0.5s;
}

/* Полная заморозка, пока шторка закрыта.
   20.10.2026: ключ — .ap-anim-on, а не .active. Селектор «:not(.active) *»
   задевает КАЖДЫЙ узел шторки, и смена .active пересчитывала стили всей
   шторки ровно в кадре старта выезда. .ap-anim-on floating_nav.js ставит через
   два кадра после открытия и снимает, когда шторка уже уехала вниз. */
#ai-overlay-modal:not(.ap-anim-on) *,
#ai-overlay-modal:not(.ap-anim-on)::before,
#ai-overlay-modal:not(.ap-anim-on)::after { animation-play-state: paused !important; }

/* Коралловое выделение текста — как у Claude */
.ai-overlay-modal ::selection { background: var(--yz-accent, #d97757); color: #fff; }
.ai-overlay-modal ::-moz-selection { background: var(--yz-accent, #d97757); color: #fff; }

/* ============================================================
   ПУЛЬСИРУЮЩАЯ ТОЧКА / АВАТАР ИИ
   ============================================================ */
@keyframes apPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--yz-accent-soft, rgba(217,119,87,0.35)); }
    50% { transform: scale(1.22); box-shadow: 0 0 0 9px rgba(217, 119, 87, 0); }
}
@keyframes apPulseSoft {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.14); opacity: 0.82; }
}
.ap-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--yz-grad, linear-gradient(135deg, #e2885f, #b3552e));
    flex: 0 0 auto;
    animation: apPulse 2.2s var(--ap-ease) infinite;
}

/* Аватар ИИ в сообщении: рождается точкой, вырастает в аватар */
.ap-ai-avatar {
    float: left;
    width: 34px; height: 34px;
    margin: 3px 12px 4px 0;
    shape-outside: circle(50% at 50% 50%);
    border-radius: 50%;
    background: var(--yz-grad, linear-gradient(135deg, #e2885f, #b3552e));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px var(--yz-accent-soft, rgba(217,119,87,0.3));
    transition: transform 0.5s var(--ap-spring), border-radius 0.4s ease;
    position: relative;
}
.ap-ai-avatar svg { width: 17px; height: 17px; display: block; }
.ap-ai-avatar .ap-ai-emoji {
    position: absolute;
    right: -5px; bottom: -5px;
    width: 17px; height: 17px;
    border-radius: 50%;
    background: var(--yz-surface, #22211F);
    border: 1px solid var(--yz-border-strong, rgba(255,255,255,0.17));
    font-size: 10px;
    line-height: 15px;
    text-align: center;
    cursor: pointer;
}
/* Состояние «думает/печатает» — сжат в пульсирующую точку */
.ap-msg.ai.is-thinking .ap-ai-avatar {
    transform: scale(0.38);
    transform-origin: left center;
    animation: apPulseSoft 1.5s ease-in-out infinite;
}
.ap-msg.ai.is-thinking .ap-ai-avatar svg,
.ap-msg.ai.is-thinking .ap-ai-avatar .ap-ai-emoji { opacity: 0; }
.ap-ai-avatar svg, .ap-ai-avatar .ap-ai-emoji { transition: opacity 0.3s ease 0.15s; }

/* ============================================================
   ВЕРХНЯЯ ПАНЕЛЬ
   ============================================================ */
.ap-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(var(--safe-top, 0px) + 10px) 14px 10px 16px;
    /* Сплошной фон — как обычная страница, без «стекла» */
    background: var(--yz-bg, #0F0E0D);
    border-bottom: 1px solid var(--yz-border, rgba(255,255,255,0.08));
    z-index: 60;
}
.ap-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    cursor: default;
}
.ap-brand-name {
    font-family: var(--ap-serif);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--yz-text);
    white-space: nowrap;
}
.ap-session-title {
    font-family: var(--ap-serif);
    font-style: italic;
    font-size: 13.5px;
    color: var(--yz-muted, #8d8878);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    padding-left: 10px;
    border-left: 1px solid var(--yz-border-strong, rgba(255,255,255,0.17));
    transition: opacity 0.4s ease;
}
.ap-session-title:empty { display: none; }

.ap-topbar-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.ap-icon-btn {
    width: 38px; height: 38px;
    border-radius: 13px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--yz-dim, #b9b4a7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.22s var(--ap-spring);
    position: relative;
    flex: 0 0 auto;
}
.ap-icon-btn:hover { background: var(--yz-surface, #22211F); border-color: var(--yz-border, rgba(255,255,255,0.08)); color: var(--yz-text); }
.ap-icon-btn:active { transform: scale(0.88); }
.ap-icon-btn.accent { color: var(--yz-accent-hi, #e88a68); }
.ap-icon-btn .ap-btn-emoji { font-size: 16px; line-height: 1; }
.ap-close-btn:hover { color: var(--yz-danger, #e5484d); }

/* Подсказка-точка на кнопке (тизер) */
.ap-teaser-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--yz-accent, #d97757);
    animation: apPulse 1.8s infinite;
}

/* ============================================================
   ЗОНА ЧАТА
   ============================================================ */
.ap-chat-zone {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    position: relative;
}
.ap-chat-zone::-webkit-scrollbar { width: 5px; }
.ap-chat-zone::-webkit-scrollbar-thumb { background: var(--yz-border-strong); border-radius: 10px; }

.ap-thread {
    max-width: var(--ap-maxw);
    margin: 0 auto;
    padding: 26px 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

/* ============================================================
   ПРИВЕТСТВЕННЫЙ ЭКРАН
   ============================================================ */
.ap-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: calc(100dvh - 300px);
    padding: 30px 18px 10px;
    animation: apFadeUp 0.7s var(--ap-ease) both;
}
@keyframes apFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}
.ap-welcome-dot {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--yz-grad);
    box-shadow: 0 12px 40px var(--yz-accent-soft, rgba(217,119,87,0.35));
    animation: apPulse 2.6s var(--ap-ease) infinite;
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ap-welcome-dot svg { width: 22px; height: 22px; }
.ap-welcome h1 {
    font-family: var(--ap-serif);
    font-weight: 700;
    font-size: clamp(27px, 6.4vw, 38px);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 12px;
    color: var(--yz-text);
}
.ap-welcome h1 em {
    font-style: italic;
    color: var(--yz-accent-hi, #e88a68);
}
.ap-welcome-sub {
    font-family: var(--ap-serif);
    font-size: 16px;
    color: var(--yz-dim, #b9b4a7);
    margin: 0 0 30px;
    max-width: 420px;
    line-height: 1.55;
}
.ap-quick-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 22px;
}
.ap-quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 44px;
    padding: 0 19px;
    border-radius: 999px;
    border: 1px solid var(--yz-border, rgba(255,255,255,0.08));
    background: var(--yz-surface, #22211F);
    color: var(--yz-text);
    font-family: var(--ap-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s var(--ap-spring);
    box-shadow: var(--yz-shadow-sm);
}
.ap-quick-chip i { color: var(--yz-accent-hi, #e88a68); font-size: 14px; }
.ap-quick-chip:hover {
    transform: translateY(-2px);
    border-color: var(--yz-accent-line, rgba(217,119,87,0.42));
    box-shadow: var(--yz-accent-glow, 0 8px 26px rgba(217,119,87,0.35));
}
.ap-quick-chip:active { transform: scale(0.95); }

.ap-invite-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--yz-muted, #8d8878);
    background: transparent;
    border: 1px dashed var(--yz-border-strong, rgba(255,255,255,0.17));
    border-radius: 999px;
    padding: 9px 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--ap-sans);
}
.ap-invite-hint i { color: var(--yz-accent-hi); }
.ap-invite-hint:hover { color: var(--yz-text); border-color: var(--yz-accent-line); background: var(--yz-accent-soft); }

/* ============================================================
   СООБЩЕНИЯ
   ============================================================ */
.ap-msg { animation: apFadeUp 0.4s var(--ap-ease) both; position: relative; }
.ap-msg::after { content: ''; display: block; clear: both; }

/* --- Сообщение пользователя: карточка, аватар с обтеканием --- */
.ap-msg.user .ap-msg-card {
    background: var(--yz-accent-soft, rgba(217,119,87,0.14));
    border: 1px solid var(--yz-border, rgba(255,255,255,0.08));
    border-radius: 20px;
    padding: 14px 18px 14px 15px;
    overflow: hidden;
}
.ap-user-avatar {
    float: left;
    width: 32px; height: 32px;
    margin: 2px 11px 3px 0;
    shape-outside: circle(50% at 50% 50%);
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--yz-border-strong, rgba(255,255,255,0.17));
    background: var(--yz-surface-2);
}
.ap-msg .ap-msg-text {
    font-family: var(--ap-serif);
    font-size: 16.5px;
    line-height: 1.68;
    color: var(--yz-text);
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 24px;
}
.ap-msg.user .ap-msg-text { font-size: 16px; line-height: 1.6; white-space: pre-wrap; }

/* --- Сообщение ИИ: без пузыря, редакционная типографика --- */
.ap-msg.ai { padding: 0 2px; }
.ap-msg.ai .ap-msg-body { overflow: visible; }

/* Милая строка статуса при раздумьях */
.ap-thinking-line {
    font-family: var(--ap-serif);
    font-style: italic;
    font-size: 15px;
    color: var(--yz-muted, #8d8878);
    padding-top: 6px;
    min-height: 24px;
    transition: opacity 0.35s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ap-think-text { transition: opacity 0.3s ease; }
.ap-thinking-line .ap-tdots { display: inline-flex; gap: 4px; }
.ap-thinking-line .ap-tdots span {
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--yz-accent, #d97757);
    animation: apDots 1.2s infinite;
}
.ap-thinking-line .ap-tdots span:nth-child(2) { animation-delay: 0.15s; }
.ap-thinking-line .ap-tdots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes apDots { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* Имя специалиста (бота) */
.ap-bot-label {
    font-family: var(--ap-sans);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--yz-accent-hi, #e88a68);
    margin-bottom: 5px;
}

/* ============================================================
   ТИПОГРАФИКА ОТВЕТОВ (markdown) — «газетный» стиль
   ============================================================ */
.ap-msg-text p { margin: 0 0 0.85em; }
.ap-msg-text p:last-child { margin-bottom: 0; }

.ap-msg-text h1, .ap-msg-text h2, .ap-msg-text h3, .ap-msg-text h4 {
    font-family: var(--ap-serif);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
    color: var(--yz-text);
    margin: 1.25em 0 0.5em;
}
.ap-msg-text h1:first-child, .ap-msg-text h2:first-child, .ap-msg-text h3:first-child { margin-top: 0.2em; }
.ap-msg-text h1 { font-size: 24px; }
.ap-msg-text h2 { font-size: 20.5px; }
.ap-msg-text h3 { font-size: 18px; }
.ap-msg-text h4 { font-size: 16px; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--ap-sans); font-weight: 800; color: var(--yz-dim); }

.ap-msg-text strong { font-weight: 700; color: var(--yz-text); }
.ap-msg-text em { color: var(--yz-dim); }
.ap-msg-text a { color: var(--yz-accent-hi, #e88a68); text-decoration: underline; text-decoration-color: var(--yz-accent-line); text-underline-offset: 3px; transition: 0.2s; }
.ap-msg-text a:hover { text-decoration-color: var(--yz-accent-hi); }

/* Списки: удобные и красивые */
.ap-msg-text ul, .ap-msg-text ol { margin: 0.6em 0 1em; padding-left: 6px; list-style: none; counter-reset: apList; }
.ap-msg-text li { position: relative; padding-left: 26px; margin-bottom: 0.55em; line-height: 1.62; }
.ap-msg-text li:last-child { margin-bottom: 0; }
.ap-msg-text ul > li::before {
    content: '';
    position: absolute;
    left: 6px; top: 0.62em;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--yz-accent, #d97757);
    opacity: 0.85;
}
.ap-msg-text ol > li { counter-increment: apList; }
.ap-msg-text ol > li::before {
    content: counter(apList);
    position: absolute;
    left: 0; top: 0.1em;
    font-family: var(--ap-serif);
    font-weight: 700;
    font-size: 0.92em;
    color: var(--yz-accent-hi, #e88a68);
    min-width: 20px;
}
.ap-msg-text ul ul > li::before { background: transparent; border: 1.5px solid var(--yz-accent); width: 6px; height: 6px; }
.ap-msg-text li p { margin: 0; display: inline; }

/* Цитаты */
.ap-msg-text blockquote {
    margin: 0.9em 0;
    padding: 10px 18px;
    border-left: 3px solid var(--yz-accent, #d97757);
    background: var(--yz-accent-soft, rgba(217,119,87,0.14));
    border-radius: 0 14px 14px 0;
    font-style: italic;
    color: var(--yz-dim);
}
.ap-msg-text blockquote p { margin: 0; }

/* Код */
.ap-msg-text code {
    font-family: 'SF Mono', 'JetBrains Mono', Consolas, monospace;
    font-size: 0.85em;
    background: var(--yz-accent-soft);
    color: var(--yz-accent-hi);
    padding: 2px 7px;
    border-radius: 7px;
}
.ap-msg-text pre {
    position: relative;
    margin: 0.9em 0;
    background: var(--yz-bg-deep, #0A0908);
    border: 1px solid var(--yz-border, rgba(255,255,255,0.08));
    border-radius: 16px;
    overflow: hidden;
}
.ap-msg-text pre code {
    display: block;
    background: transparent;
    color: #e8e6e0;
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    border-radius: 0;
}
.ap-code-copy {
    position: absolute;
    top: 8px; right: 8px;
    width: 30px; height: 30px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #b9b4a7;
    font-size: 12px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
    opacity: 0;
}
.ap-msg-text pre:hover .ap-code-copy { opacity: 1; }
.ap-code-copy:hover { color: #fff; background: rgba(255,255,255,0.14); }

/* Таблицы */
.ap-msg-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.9em 0;
    font-size: 14.5px;
    font-family: var(--ap-sans);
}
.ap-msg-text th, .ap-msg-text td { padding: 9px 12px; border-bottom: 1px solid var(--yz-border); text-align: left; }
.ap-msg-text th { font-family: var(--ap-serif); font-weight: 700; color: var(--yz-text); border-bottom: 2px solid var(--yz-border-strong); }
.ap-msg-text hr { border: none; border-top: 1px solid var(--yz-border-strong); margin: 1.3em 0; }

/* Картинки/арт в сообщениях */
.ap-msg-text img, .ap-art-container img {
    max-width: min(320px, 100%);
    border-radius: 16px;
    display: block;
}
.ap-art-container {
    margin-top: 10px;
    position: relative;
    max-width: 320px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--yz-border);
    box-shadow: var(--yz-shadow-md);
}
.ap-art-container img { cursor: zoom-in; width: 100%; }
.ap-art-actions {
    position: absolute;
    right: 8px; bottom: 8px;
    display: flex; gap: 6px;
    opacity: 0;
    transition: 0.25s;
}
.ap-art-container:hover .ap-art-actions { opacity: 1; }
.ap-art-actions a, .ap-art-actions button {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.5);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 13px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    text-decoration: none;
}

/* Вложение-файл */
.ap-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 9px 14px;
    border-radius: 14px;
    background: var(--yz-surface, #22211F);
    border: 1px solid var(--yz-border);
    font-family: var(--ap-sans);
}
.ap-file-chip i { color: var(--yz-accent-hi); font-size: 17px; }
.ap-file-chip .ap-file-name { font-size: 13px; font-weight: 600; color: var(--yz-text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-file-chip a { font-size: 11px; color: var(--yz-accent-hi); text-decoration: none; }

/* ============================================================
   ПАНЕЛЬ ДЕЙСТВИЙ ПОД СООБЩЕНИЕМ
   ============================================================ */
.ap-action-bar {
    display: flex;
    gap: 4px;
    clear: both;
    margin-top: 9px;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.ap-msg:hover .ap-action-bar, .ap-msg:focus-within .ap-action-bar { opacity: 1; transform: none; }
.ap-msg.user .ap-action-bar { padding-left: 4px; }
.ap-ab-btn {
    height: 30px;
    min-width: 30px;
    padding: 0 8px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--yz-muted, #8d8878);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.18s ease;
    font-family: var(--ap-sans);
}
.ap-ab-btn:hover { background: var(--yz-surface, #22211F); color: var(--yz-text); }
.ap-ab-btn:active { transform: scale(0.88); }
.ap-ab-btn.brain-active { color: var(--yz-accent-hi, #e88a68); }
.ap-ab-btn.brain-active i { filter: drop-shadow(0 0 6px var(--yz-accent-soft)); }
@media (max-width: 800px) {
    .ap-action-bar { opacity: 1; transform: none; }
}

/* ============================================================
   ЗОНА ВВОДА (компактная, как была)
   ============================================================ */
.ap-input-zone {
    flex: 0 0 auto;
    padding: 10px 14px calc(var(--safe-bottom, 0px) + 14px);
    /* Сплошной фон без градиента-прозрачности */
    background: var(--yz-bg, #0F0E0D);
    position: relative;
    z-index: 55;
}
.ap-input-inner { max-width: var(--ap-maxw); margin: 0 auto; }

.ap-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: var(--yz-surface, #22211F);
    border: 1px solid var(--yz-border-strong, rgba(255,255,255,0.17));
    border-radius: 26px;
    padding: 6px;
    box-shadow: var(--yz-shadow-md);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.ap-input-wrapper:focus-within {
    border-color: var(--yz-accent-line, rgba(217,119,87,0.42));
    box-shadow: 0 0 0 3px var(--yz-accent-soft, rgba(217,119,87,0.14)), var(--yz-shadow-md);
}
.ap-input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--yz-text);
    font-family: var(--ap-serif);
    font-size: 16px;
    line-height: 1.45;
    padding: 10px 8px;
    max-height: 132px;
    min-height: 24px;
    caret-color: var(--yz-accent, #d97757);
}
.ap-input-wrapper textarea::placeholder { color: var(--yz-muted, #8d8878); font-style: italic; }

.ap-input-wrapper button {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--ap-spring);
    flex: 0 0 auto;
    font-size: 16px;
    outline: none;
}
#ch-attach-btn { background: transparent; color: var(--yz-muted); }
#ch-attach-btn:hover { background: var(--yz-accent-soft); color: var(--yz-accent-hi); }
#ch-mic-btn { background: transparent; color: var(--yz-muted); }
#ch-mic-btn:hover { background: var(--yz-accent-soft); color: var(--yz-accent-hi); transform: scale(1.05); }
#ch-send-btn {
    background: var(--yz-grad, linear-gradient(135deg, #e2885f, #b3552e));
    color: #fff;
    box-shadow: var(--yz-accent-glow, 0 8px 26px rgba(217,119,87,0.35));
}
#ch-send-btn:hover { transform: translateY(-2px); filter: brightness(1.07); }
#ch-send-btn:active { transform: scale(0.9); }
#ch-stop-btn {
    background: var(--yz-accent-soft);
    color: var(--yz-accent-hi);
    border: 1px solid var(--yz-accent-line) !important;
    animation: apPulseSoft 1.5s infinite;
}

/* Волна записи голоса */
.ch-recording-wave { display: flex; flex: 1; align-items: center; padding: 0 10px; gap: 12px; }
.ch-wave-bars { display: flex; align-items: center; gap: 4px; height: 24px; }
.ch-bar { width: 4px; background: var(--yz-accent, #d97757); border-radius: 2px; animation: apWave 1s ease-in-out infinite; }
.ch-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.ch-bar:nth-child(2) { height: 80%; animation-delay: 0.1s; }
.ch-bar:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.ch-bar:nth-child(4) { height: 80%; animation-delay: 0.3s; }
.ch-bar:nth-child(5) { height: 40%; animation-delay: 0.4s; }
@keyframes apWave { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }
.ch-record-timer { color: var(--yz-accent-hi); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; font-family: var(--ap-sans); }
.ch-record-status { color: var(--yz-muted); font-size: 13px; font-weight: 500; animation: apPulseSoft 1.5s infinite; font-family: var(--ap-sans); }

/* Превью прикрепленного файла */
.ap-file-preview { max-width: var(--ap-maxw); margin: 0 auto 8px; }
.ap-file-preview-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--yz-surface);
    border: 1px solid var(--yz-accent-line);
    border-radius: 16px;
    padding: 8px 10px 8px 14px;
    box-shadow: var(--yz-shadow-sm);
    animation: apFadeUp 0.3s ease;
    font-family: var(--ap-sans);
}
.ap-file-preview-card i.ap-fp-icon { color: var(--yz-accent-hi); font-size: 18px; }
.ap-fp-info { display: flex; flex-direction: column; line-height: 1.3; }
.ap-fp-name { font-size: 13px; font-weight: 600; color: var(--yz-text); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-fp-size { font-size: 11px; color: var(--yz-muted); }
.ap-fp-remove {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--yz-surface-2);
    color: var(--yz-muted);
    cursor: pointer;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.ap-fp-remove:hover { color: var(--yz-danger); background: rgba(229, 72, 77, 0.12); }

/* Дисклеймер под вводом */
.ap-input-note {
    text-align: center;
    font-size: 11px;
    color: var(--yz-muted);
    margin-top: 8px;
    font-family: var(--ap-sans);
    opacity: 0.75;
}

/* ============================================================
   ПАНЕЛЬ ИСТОРИИ (боковая шторка)
   ============================================================ */
.ap-history-backdrop {
    position: absolute;
    inset: 0;
    background: var(--yz-overlay, rgba(10,9,8,0.72));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 70;
}
.ap-history-backdrop.active { opacity: 1; pointer-events: auto; }
.ap-history-panel {
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    width: min(380px, 94vw);
    background: var(--yz-bg, #0F0E0D);
    border-left: 1px solid var(--yz-border-strong);
    z-index: 71;
    transform: translateX(105%);
    transition: transform 0.45s var(--ap-ease);
    display: flex;
    flex-direction: column;
    box-shadow: var(--yz-shadow-lg);
}
.ap-history-panel.active { transform: translateX(0); }
.ap-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--safe-top, 0px) + 20px) 20px 16px;
}
.ap-history-head h3 {
    margin: 0;
    font-family: var(--ap-serif);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ap-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 14px calc(var(--safe-bottom, 0px) + 20px);
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* Премиальная кнопка нового диалога */
.ap-new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 2px 2px 14px;
    height: 50px;
    border-radius: 16px;
    border: none;
    background: var(--yz-grad, linear-gradient(135deg, #e2885f, #b3552e));
    color: #fff;
    font-family: var(--ap-sans);
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: var(--yz-accent-glow, 0 8px 26px rgba(217,119,87,0.35));
    transition: all 0.25s var(--ap-spring);
    flex: 0 0 auto;
}
.ap-new-chat-btn i {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: grid;
    place-items: center;
    font-size: 11px;
}
.ap-new-chat-btn:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 12px 32px rgba(217,119,87,0.45); }
.ap-new-chat-btn:active { transform: scale(0.97); }

/* Карточки диалогов */
.ap-history-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 13px 42px 13px 16px;
    border-radius: 15px;
    cursor: pointer;
    background: var(--yz-surface, #22211F);
    border: 1px solid var(--yz-border, rgba(255,255,255,0.08));
    box-shadow: var(--yz-shadow-sm);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.ap-history-item:hover { border-color: var(--yz-accent-line); transform: translateY(-1px); }
.ap-history-item.active-session { border-color: var(--yz-accent, #d97757); background: var(--yz-accent-soft, rgba(217,119,87,0.14)); }
.ap-history-item.pinned::before {
    content: '';
    position: absolute;
    left: 0; top: 12px; bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--yz-grad);
}
.ap-hi-title {
    font-family: var(--ap-serif);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--yz-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ap-hi-date { font-size: 11px; color: var(--yz-muted); font-family: var(--ap-sans); }
.ap-hi-pin {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    color: var(--yz-muted);
    opacity: 0.45;
    cursor: pointer;
    font-size: 13px;
    border-radius: 9px;
    transition: 0.2s;
}
.ap-history-item:hover .ap-hi-pin { opacity: 1; }
.ap-hi-pin:hover { color: var(--yz-accent-hi); background: var(--yz-accent-soft); }
.ap-hi-pin.pinned-on { color: var(--yz-accent); opacity: 1; transform: translateY(-50%) rotate(45deg); }
.ap-history-empty { text-align: center; color: var(--yz-muted); font-size: 13px; padding: 30px 10px; font-family: var(--ap-sans); }
.ap-load-more {
    margin: 8px 6px 0;
    height: 42px;
    border-radius: 13px;
    border: 1px dashed var(--yz-border-strong);
    background: transparent;
    color: var(--yz-dim);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-family: var(--ap-sans);
}
.ap-load-more:hover { border-color: var(--yz-accent-line); color: var(--yz-accent-hi); }

@media (max-width: 640px) {
    .ap-history-panel {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 78dvh;
        border-left: none;
        border-top: 1px solid var(--yz-border-strong);
        border-radius: 24px 24px 0 0;
        transform: translateY(105%);
    }
    .ap-history-panel.active { transform: translateY(0); }
    .ap-history-head { padding-top: 14px; }
    .ap-history-head::before {
        content: '';
        position: absolute;
        top: 7px; left: 50%;
        transform: translateX(-50%);
        width: 42px; height: 4px;
        border-radius: 4px;
        background: var(--yz-border-strong);
    }
}

/* ============================================================
   МОДАЛКИ ПОРТАЛА (скриншот, приглашение, память, закреп)
   ============================================================ */
.ap-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--yz-overlay, rgba(10,9,8,0.72));
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.ap-modal-overlay.active { opacity: 1; pointer-events: auto; }
.ap-modal-card {
    width: 100%;
    max-width: 420px;
    max-height: 86dvh;
    overflow-y: auto;
    background: var(--yz-surface, #22211F);
    border: 1px solid var(--yz-border-strong);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--yz-shadow-lg);
    transform: translateY(24px) scale(0.96);
    transition: transform 0.4s var(--ap-spring);
    font-family: var(--ap-sans);
}
.ap-modal-overlay.active .ap-modal-card { transform: none; }
.ap-modal-card h3 {
    margin: 0 0 8px;
    font-family: var(--ap-serif);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--yz-text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.ap-modal-card h3 i { color: var(--yz-accent-hi); font-size: 18px; }
.ap-modal-sub { color: var(--yz-dim); font-size: 13.5px; line-height: 1.55; margin: 0 0 18px; }
.ap-modal-btn-row { display: flex; gap: 10px; margin-top: 18px; }
.ap-btn {
    flex: 1;
    height: 48px;
    border-radius: 15px;
    border: none;
    font-family: var(--ap-sans);
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.22s var(--ap-spring);
    text-decoration: none;
}
.ap-btn.primary { background: var(--yz-grad); color: #fff; box-shadow: var(--yz-accent-glow); }
.ap-btn.primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.ap-btn.ghost { background: var(--yz-surface-2, #2E2C29); color: var(--yz-text); border: 1px solid var(--yz-border); }
.ap-btn.ghost:hover { border-color: var(--yz-border-strong); }
.ap-btn:active { transform: scale(0.96); }

.ap-modal-input {
    width: 100%;
    background: var(--yz-bg, #0F0E0D);
    border: 1px solid var(--yz-border-strong);
    color: var(--yz-text);
    padding: 13px 16px;
    border-radius: 14px;
    font-size: 15px;
    font-family: var(--ap-serif);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ap-modal-input:focus { border-color: var(--yz-accent-line); box-shadow: 0 0 0 3px var(--yz-accent-soft); }

/* Скриншот: превью и сетка шеринга */
.ap-shot-preview {
    width: 100%;
    max-height: 38dvh;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid var(--yz-border-strong);
    background: var(--yz-bg-deep);
    margin-bottom: 16px;
    box-shadow: var(--yz-shadow-md);
}
.ap-share-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}
.ap-share-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 13px 6px;
    border-radius: 15px;
    border: 1px solid var(--yz-border);
    background: var(--yz-surface-2, #2E2C29);
    color: var(--yz-text);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s var(--ap-spring);
    text-decoration: none;
}
.ap-share-tile i { font-size: 19px; color: var(--yz-accent-hi); }
.ap-share-tile:hover { transform: translateY(-2px); border-color: var(--yz-accent-line); box-shadow: var(--yz-shadow-sm); }
.ap-share-tile.tg i { color: #2aabee; }
.ap-share-tile.wa i { color: #25d366; }
.ap-share-tile.vk i { color: #0077ff; }

/* Память (ядро) */
.ap-memory-item {
    background: var(--yz-bg, #0F0E0D);
    border: 1px solid var(--yz-border);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.ap-memory-role { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--yz-accent-hi); margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.ap-memory-text { font-family: var(--ap-serif); font-size: 13.5px; color: var(--yz-dim); line-height: 1.5; max-height: 72px; overflow: hidden; }
.ap-memory-remove {
    margin-top: 8px;
    background: transparent;
    border: none;
    color: var(--yz-danger);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Тост */
.ap-toast {
    position: fixed;
    bottom: calc(var(--safe-bottom, 0px) + 96px);
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--yz-surface, #22211F);
    border: 1px solid var(--yz-accent-line);
    color: var(--yz-text);
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--ap-sans);
    z-index: 2147483647;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.35s var(--ap-spring);
    display: flex;
    align-items: center;
    gap: 9px;
    box-shadow: var(--yz-shadow-lg);
    max-width: 88vw;
}
.ap-toast i { color: var(--yz-accent-hi); }
.ap-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Лайтбокс */
#ch-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 9, 8, 0.96);
    z-index: 2147483647;
    justify-content: center;
    align-items: center;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
#ch-lightbox-img { max-width: 95vw; max-height: 92dvh; object-fit: contain; border-radius: 14px; }
.ch-lightbox-close {
    position: absolute;
    top: calc(var(--safe-top, 0px) + 16px);
    right: 16px;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 17px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 2;
}

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 800px) {
    .ap-thread { padding: 20px 16px 24px; gap: 22px; }
    .ap-topbar { padding-left: 12px; padding-right: 10px; gap: 6px; }
    .ap-icon-btn { width: 36px; height: 36px; font-size: 14px; }
    .ap-brand-name { font-size: 16px; }
    .ap-session-title { display: none; }
    .ap-msg .ap-msg-text { font-size: 16px; line-height: 1.65; }
    .ap-msg-text h1 { font-size: 21px; }
    .ap-msg-text h2 { font-size: 18.5px; }
    .ap-msg-text h3 { font-size: 16.5px; }
    .ap-welcome { min-height: calc(100dvh - 340px); }
    .ap-input-wrapper button { width: 40px; height: 40px; }
    .ap-share-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Игровой режим: прячем интерфейс поверх игры */
body.game-fullscreen-active .ap-topbar,
body.game-fullscreen-active .ap-input-zone { pointer-events: none; }

/* ============================================================
   ТОНКАЯ ПОДГОНКА СВЕТЛОЙ ТЕМЫ (Cloud)
   ============================================================ */
html[data-yz-theme="cloud"] .ai-overlay-modal { box-shadow: 0 -14px 50px rgba(60, 50, 35, 0.18); }
html[data-yz-theme="cloud"] .ap-msg-text code { color: var(--yz-accent-deep, #a54c2b); }
html[data-yz-theme="cloud"] .ap-input-wrapper { background: #ffffff; }
html[data-yz-theme="cloud"] .ap-history-item { box-shadow: none; }
html[data-yz-theme="cloud"] .ap-history-item.active-session { background: var(--yz-accent-soft); }
html[data-yz-theme="cloud"] .ap-quick-chip { background: #ffffff; }
/* Кнопки топбара — светлое стекло */
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-topbar .ap-icon-btn {
    background: rgba(255,255,255,0.55);
    border: 1px solid var(--yz-border-strong);
    color: var(--yz-dim);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
}
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-topbar .ap-icon-btn:hover {
    background: rgba(255,255,255,0.88);
    border-color: var(--yz-accent-line);
    color: var(--yz-text);
    box-shadow: 0 4px 14px rgba(60,50,35,0.10);
}
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-topbar .ap-icon-btn:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.95);
}
/* Кнопка закрытия — мягкий danger */
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-topbar .ap-close-btn:hover {
    background: rgba(217,54,62,0.10);
    border-color: rgba(217,54,62,0.35);
    color: #d9363e;
    box-shadow: 0 4px 14px rgba(217,54,62,0.12);
}
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-topbar .ap-close-btn:active {
    background: rgba(217,54,62,0.18);
    color: #c53030;
}

    /* ── МОДАЛКА НАСТРОЕК ПРОФИЛЯ (profile.php) — светлое стекло ── */
    html[data-yz-theme="cloud"] #modal-profile-settings {
        background: var(--yz-overlay, rgba(52,48,40,0.88)) !important;
        backdrop-filter: blur(15px) !important;
        -webkit-backdrop-filter: blur(15px) !important;
    }
    html[data-yz-theme="cloud"] #modal-profile-settings .modal-header h3 {
        color: var(--yz-text, #232019);
        text-shadow: none;
    }
    html[data-yz-theme="cloud"] #modal-profile-settings .btn-close {
        background: rgba(255,255,255,0.55) !important;
        border: 1px solid var(--yz-border-strong, rgba(60,50,35,0.12)) !important;
        color: var(--yz-dim, #6b6058) !important;
        -webkit-backdrop-filter: blur(14px) saturate(1.4);
        backdrop-filter: blur(14px) saturate(1.4);
    }
    html[data-yz-theme="cloud"] #modal-profile-settings .btn-close:hover {
        background: rgba(255,255,255,0.88) !important;
        border-color: var(--yz-accent-line, rgba(107,72,255,0.25)) !important;
        color: var(--yz-text, #232019) !important;
        box-shadow: 0 4px 14px rgba(60,50,35,0.10);
    }
    html[data-yz-theme="cloud"] .settings-menu-item {
        background: rgba(255,255,255,0.92) !important;
        border: 1px solid var(--yz-border-strong, rgba(60,50,35,0.12)) !important;
        -webkit-backdrop-filter: blur(20px) saturate(140%);
        backdrop-filter: blur(20px) saturate(140%);
        box-shadow: 0 8px 24px rgba(60,50,35,0.08) !important;
        color: var(--yz-text, #232019);
    }
    html[data-yz-theme="cloud"] .settings-menu-item:hover {
        background: rgba(255,255,255,0.92) !important;
        border-color: var(--yz-accent-line, rgba(107,72,255,0.25)) !important;
        box-shadow: 0 12px 28px rgba(60,50,35,0.12) !important;
        transform: translateY(-2px);
    }
    html[data-yz-theme="cloud"] .settings-menu-list > div[style*="height: 1px"] {
        background: var(--yz-border-strong, rgba(60,50,35,0.12));
    }

html[data-yz-theme="cloud"] .ap-ab-btn:hover { background: rgba(35, 32, 25, 0.06); }
html[data-yz-theme="cloud"] .ap-modal-card,
html[data-yz-theme="cloud"] .ap-toast { background: #ffffff; }
html[data-yz-theme="cloud"] .ap-msg.user .ap-msg-card { border-color: rgba(201, 101, 67, 0.22); }

/* Спокойный режим */
@media (prefers-reduced-motion: reduce) {
    .ai-overlay-modal *, .ap-dot, .ap-welcome-dot { animation: none !important; transition-duration: 0.01ms !important; }
}

/* ============================================================================
   YAZME AI PORTAL — РЕДИЗАЙН 2026 (оверрайды)
   Прозрачная шапка · факт-карточка «ты знал?» · шторка диалогов слева ·
   мессенджер-раскладка · плавающий стеклянный композер · минимум теней
   ========================================================================== */

/* Лента занимает весь экран; шапка и композер парят над ней (текст уезжает под них) */
.ai-overlay-modal .ap-chat-zone{ position:absolute; inset:0; z-index:1; }
.ai-overlay-modal .ap-thread{ padding:88px 20px 134px; }

/* Прозрачная шапка со стеклянными «вырезанными» кнопками */
.ai-overlay-modal .ap-topbar{
    position:absolute; top:0; left:0; right:0; z-index:60;
    background:transparent; border-bottom:none;
    padding:calc(var(--safe-top,0px) + 12px) 14px 10px; gap:8px;
    pointer-events:none;
}
.ai-overlay-modal .ap-topbar > *{ pointer-events:auto; }
.ap-topbar-spacer{ flex:1; }
.ai-overlay-modal .ap-topbar .ap-icon-btn{
    width:42px; height:42px; border-radius:14px; color:var(--yz-text);
    background:rgba(30,29,28,.5); border:1px solid var(--yz-border-strong);
    -webkit-backdrop-filter:blur(14px) saturate(1.4); backdrop-filter:blur(14px) saturate(1.4);
}
.ai-overlay-modal .ap-topbar .ap-icon-btn:hover{ background:rgba(34,33,31,.72); }
.ai-overlay-modal .ap-topbar .ap-menu-btn{ font-size:17px; }
.ai-overlay-modal .ap-topbar .ap-close-btn:hover{ color:var(--yz-danger,#e5695f); }

/* Плавающий стеклянный композер */
.ai-overlay-modal .ap-input-zone{
    position:absolute; left:0; right:0; bottom:0; z-index:55;
    background:transparent; padding:10px 14px calc(var(--safe-bottom,0px) + 12px);
}
.ai-overlay-modal .ap-input-zone::before{
    content:''; position:absolute; left:0; right:0; bottom:100%; height:46px;
    background:linear-gradient(180deg, transparent, var(--yz-bg,#0F0E0D)); pointer-events:none;
}
.ai-overlay-modal .ap-input-wrapper{
    background:rgba(34,33,31,.60); border:1px solid var(--yz-border-strong);
    box-shadow:0 6px 20px rgba(0,0,0,.16);
    -webkit-backdrop-filter:blur(22px) saturate(1.6); backdrop-filter:blur(22px) saturate(1.6);
}
.ai-overlay-modal .ap-input-wrapper:focus-within{
    border-color:var(--yz-accent-line);
    box-shadow:0 0 0 3px var(--yz-accent-soft), 0 6px 20px rgba(0,0,0,.16);
}
.ai-overlay-modal .ap-input-note{ opacity:.8; }

/* Раздел «ты знал?» — минимализм, без тяжёлых теней */
.ai-overlay-modal .ap-welcome{ min-height:calc(100dvh - 260px); justify-content:center; padding:12px 2px; }
@keyframes apFactIn{ from{opacity:0; transform:translateY(18px);} to{opacity:1; transform:none;} }
.ap-fact-card{
    position:relative; overflow:hidden; cursor:pointer; width:100%;
    border-radius:26px; padding:26px 24px 22px;
    background:linear-gradient(162deg, rgba(217,119,87,.10), var(--yz-surface-2, rgba(56,52,49,.30))); /* [cloud-fix 2026-08-19] тёмный стоп не следовал теме */
    border:1px solid var(--yz-border-strong);
    animation:apFactIn .6s var(--ap-ease) both;
    transition:transform .3s var(--ap-spring), border-color .3s;
}
.ap-fact-card:hover{ border-color:var(--yz-accent-line); }
.ap-fact-card:active{ transform:scale(.985); }
.ap-fact-label{ display:inline-flex; align-items:center; gap:8px; font-family:var(--ap-serif); font-style:italic; font-size:15px; color:var(--yz-accent-hi); margin-bottom:14px; }
.ap-fact-spark{ font-style:normal; }
.ap-fact-text{ font-family:var(--ap-serif); font-weight:600; font-size:23px; line-height:1.34; letter-spacing:-.01em; color:var(--yz-text); margin-bottom:22px; }
.ap-fact-actions{ display:flex; align-items:center; gap:10px; }
.ap-fact-cta{
    display:inline-flex; align-items:center; gap:9px; height:44px; padding:0 20px; border-radius:999px; border:none;
    background:var(--yz-grad); color:#fff; font-family:var(--ap-sans); font-size:14px; font-weight:700; cursor:pointer;
    transition:transform .2s var(--ap-spring);
}
.ap-fact-cta:active{ transform:scale(.94); }
.ap-fact-arw{ transition:transform .3s var(--ap-spring); }
.ap-fact-card:hover .ap-fact-arw{ transform:translateX(4px); }
.ap-fact-refresh{
    width:44px; height:44px; border-radius:50%; border:1px solid var(--yz-border-strong);
    background:transparent; color:var(--yz-dim); cursor:pointer;
    display:flex; align-items:center; justify-content:center; margin-left:auto;
    transition:.25s var(--ap-spring); font-size:14px;
}
.ap-fact-refresh:hover{ color:var(--yz-accent-hi); border-color:var(--yz-accent-line); transform:rotate(90deg); }

/* Сообщения пользователя — как в мессенджере: справа, аватар справа */
.ai-overlay-modal .ap-msg.user .ap-msg-card{
    display:flex; justify-content:flex-end; align-items:flex-end; gap:9px;
    background:transparent; border:none; padding:0; border-radius:0; overflow:visible;
}
.ai-overlay-modal .ap-msg.user .ap-msg-text{
    background:var(--yz-accent-soft); border:1px solid var(--yz-accent-line);
    border-radius:22px 22px 6px 22px; padding:12px 16px; max-width:78%;
}
.ai-overlay-modal .ap-msg.user .ap-user-avatar{
    float:none; margin:0; width:32px; height:32px; shape-outside:none;
}
.ai-overlay-modal .ap-msg.user .ap-action-bar{ justify-content:flex-end; padding-left:0; padding-right:2px; }

/* Шторка диалогов: выезжает СЛЕВА; чипы Стиль/Друг сверху */
.ai-overlay-modal .ap-history-panel{
    left:0 !important; right:auto !important; top:0 !important; bottom:auto !important;
    height:100% !important; width:min(340px,86vw) !important; max-width:340px;
    border-right:1px solid var(--yz-border-strong); border-left:none;
    border-radius:0 !important; transform:translateX(-105%) !important;
}
.ai-overlay-modal .ap-history-panel.active{ transform:translateX(0) !important; }
.ai-overlay-modal .ap-history-head::before{ display:none !important; }
.ap-history-title{ font-family:var(--ap-serif); font-size:20px; font-weight:700; color:var(--yz-text); }
.ap-hist-actions{ display:flex; gap:8px; margin:0 2px 12px; }
.ap-hist-chip{
    flex:1; display:flex; align-items:center; justify-content:center; gap:7px; height:44px;
    border-radius:14px; border:1px solid var(--yz-border); background:var(--yz-surface-2, rgba(255,255,255,.04)); /* [cloud-fix 2026-08-19] */
    color:var(--yz-text); font-family:var(--ap-sans); font-size:13px; font-weight:600; cursor:pointer; transition:.2s;
}
.ap-hist-chip:hover{ background:var(--yz-accent-soft); border-color:var(--yz-accent-line); }
.ap-hist-chip i{ color:var(--yz-accent-hi); }
.ap-hist-emoji{ font-size:15px; line-height:1; }

/* ============================================================
   ПОЗВАТЬ ДРУГА → КООПЕРАТИВНАЯ КОМНАТА
   (модалка ap-invite-modal, выбор сценария и готовая ссылка)
   ============================================================ */
#ap-invite-body { margin-bottom: 4px; }

.ap-invite-loading {
    padding: 22px 0;
    text-align: center;
    font-size: 13.5px;
    opacity: 0.55;
}

.ap-invite-kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    opacity: 0.5;
    margin: 0 0 9px;
}

.ap-coop-mode {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    text-align: left;
    padding: 11px 13px;
    margin-bottom: 7px;
    border-radius: 15px;
    border: 1px solid var(--yz-border, rgba(250, 249, 245, 0.12));
    background: transparent;
    color: inherit;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ap-spring);
}
.ap-coop-mode:hover { background: var(--yz-accent-soft, rgba(255, 255, 255, 0.04)); } /* [cloud-fix 2026-08-19] */
.ap-coop-mode:active { transform: scale(0.985); }
.ap-coop-mode .em { font-size: 21px; line-height: 1.1; flex: 0 0 auto; }
.ap-coop-mode > span:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.ap-coop-mode .t { display: block; font-size: 14.5px; font-weight: 700; margin-bottom: 2px; }
.ap-coop-mode .d { display: block; font-size: 12.5px; line-height: 1.45; opacity: 0.6; }

.ap-coop-link {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--yz-border, rgba(250, 249, 245, 0.12));
    border-radius: 14px;
    padding: 9px 9px 9px 13px;
    margin-bottom: 12px;
}
.ap-coop-link input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-size: 12.5px;
    font-family: ui-monospace, Menlo, monospace;
}
.ap-coop-link button {
    width: 34px; height: 34px;
    flex: 0 0 auto;
    border: none;
    border-radius: 10px;
    background: var(--yz-accent, #d97757);
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s var(--ap-spring);
}
.ap-coop-link button:active { transform: scale(0.9); }

/* ============================================================================
   ТИХИЙ СВЕТ · пустой экран шторки ИИ · патч 2026-08-22
   ----------------------------------------------------------------------------
   Блок идёт последним и намеренно перебивает оверрайды редизайна 2026 выше:
   приветственный экран из центрированной карточки факта превращается в
   тихое обращение по имени, прижатое к низу — туда, где палец.

   Работает в паре с разметкой в includes/floating_nav.php и методом
   welcomeHtml() в assets/js/ai_portal.js. Живую строку крутит window.YzQuiet.

   ОТКАТ: удалить всё до конца файла.
   ========================================================================== */

/* --- пустой экран: не по центру, а внизу и слева --- */
.ai-overlay-modal .ap-welcome.ap-quiet{
    align-items:flex-start;
    justify-content:flex-end;
    text-align:left;
    min-height:calc(100dvh - 230px);
    padding:12px 2px 2px;
}
.ai-overlay-modal .ap-welcome.ap-quiet .ap-q-hi{
    margin:0;
    font-family:var(--ap-serif);
    font-weight:300;
    font-size:clamp(28px, 8.6vw, 38px);
    line-height:1.1;
    letter-spacing:-.02em;
    color:var(--yz-text);
    text-wrap:balance;
}
.ai-overlay-modal .ap-quiet .ap-q-sub{ display:block; color:var(--yz-muted); font-weight:300; }
.ai-overlay-modal .ap-quiet .ap-q-sub em{ font-style:italic; font-weight:400; color:var(--yz-accent-hi); }

/* --- живая строка (.ap-live) убрана 20.10.2026 — ДОМ ЯЗМИ. ОТКАТ: git drawer2 --- */

/* --- строка присутствия: кто сейчас на сайте + плюс --- */
.ai-overlay-modal .ap-presence{
    display:flex; align-items:center; min-width:0; pointer-events:auto;
}
.ap-pav{
    flex:0 0 auto; width:32px; height:32px; margin-left:-9px; padding:0;
    border-radius:50%; border:2px solid var(--yz-bg, #0F0E0D);
    background:var(--yz-surface-2, #2E2C29); overflow:hidden; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    transition:transform .2s var(--ap-spring);
}
.ap-pav:first-child{ margin-left:0; }
.ap-pav img{ width:100%; height:100%; object-fit:cover; display:block; }
.ap-pav:hover{ transform:translateY(-2px); }
.ap-pav:active{ transform:scale(.9); }
.ap-pav-add{
    margin-left:5px; border:1.5px dashed var(--yz-border-strong);
    background:transparent; color:var(--yz-muted); font-size:12px;
}
.ap-pav-add:hover{ border-color:var(--yz-accent-line); color:var(--yz-accent-hi); }
.ap-presence-tx{
    margin-left:9px; white-space:nowrap;
    font-family:var(--ap-sans); font-size:10.5px; font-weight:500; line-height:1.25;
    color:var(--yz-muted);
}

/* --- название диалога: ИИ придумывает его сам, пустое прячем --- */
.ai-overlay-modal .ap-session-title{
    min-width:0; max-width:38%; margin-left:6px;
    font-family:var(--ap-sans); font-size:12px; font-weight:500; color:var(--yz-muted);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.ai-overlay-modal .ap-session-title:empty{ display:none; }

/* --- каретка на время печати ответа --- */
.ap-msg-text.ap-typing::after{
    content:''; display:inline-block; width:2px; height:1em;
    margin-left:2px; vertical-align:-2px; background:var(--yz-accent);
    animation:apCaret .9s steps(2) infinite;
}
@keyframes apCaret{ 50%{ opacity:0; } }

/* --- три подсказки под первым ответом --- */
.ap-after{ display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.ap-after .ap-quick-chip{
    height:36px; padding:0 14px; font-size:12.5px; font-weight:500;
    background:transparent; border-color:var(--yz-border-strong);
    color:var(--yz-dim); box-shadow:none;
}
.ap-after .ap-quick-chip:hover{
    transform:none; box-shadow:none;
    border-color:var(--yz-accent-line); color:var(--yz-text);
}

/* Подстраховка на случай, если приветствие вставят не первым узлом. */
.ai-overlay-modal .ap-thread:has(> #gh-welcome-container){ justify-content:flex-end; }

/* --- светлая тема --- */
html[data-yz-theme="cloud"] .ap-pav{ border-color:var(--yz-bg, #f4f2ec); }
html[data-yz-theme="cloud"] .ap-after .ap-quick-chip{ background:transparent; }

@media (max-width:360px){
    .ap-presence-tx{ display:none; }
    .ap-q-hi{ font-size:27px; }
}


/* ============================================================================
   ПАТЧ 30.08.2026 · ОШИБКИ · СТОП · СКРОЛЛ · СТАРТЫ · ДОСТУПНОСТЬ
   ----------------------------------------------------------------------------
   Всё, что добавлено в этот заход, живёт одним блоком в конце файла — так его
   видно целиком и так его целиком же можно снять.
   ОТКАТ: удалить всё до конца файла + вернуть assets/js/ai_portal.js и
   includes/floating_nav.php из .yz-backup-ai-20260830/.
   ========================================================================== */

/* ─── Только для экранной читалки ─────────────────────────────────────────
   Текст, который надо произнести вслух, но не показывать глазами. Приём
   стандартный: не display:none (его читалки пропускают), а вынос за экран
   с нулевым размером. */
.ap-sr-only{
    position:absolute !important;
    width:1px; height:1px;
    margin:-1px; padding:0; border:0;
    overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%);
    white-space:nowrap;
}

/* ─── Карточка отказа ─────────────────────────────────────────────────────
   Не красная плашка на весь экран: сбой в чате — это не катастрофа, а
   сообщение, у которого просто другой статус. Поэтому та же ширина и тот же
   ритм, что у обычного сообщения, но с рамкой и иконкой. */
.ap-error{
    display:flex; align-items:flex-start; gap:12px;
    padding:14px 16px;
    border:1px solid var(--yz-border-strong, rgba(255,255,255,.17));
    border-left:3px solid var(--yz-danger, #e5484d);
    border-radius:16px;
    background:var(--yz-surface, #22211F);
    font-family:var(--ap-sans);
    animation:apFadeUp .32s var(--ap-ease) both;
}
.ap-error > i{ flex:0 0 auto; margin-top:2px; font-size:15px; color:var(--yz-danger, #e5484d); }
/* Исчерпанный лимит — не поломка. Другой цвет и другая иконка: это
   ожидаемое состояние, у которого есть понятный выход. */
.ap-error.is-quota{ border-left-color:var(--yz-accent, #d97757); }
.ap-error.is-quota > i{ color:var(--yz-accent-hi, #e88a68); }
.ap-error-body{ min-width:0; flex:1; }
.ap-error-tx{
    margin:0; font-size:14.5px; line-height:1.5;
    color:var(--yz-text, #faf9f5); overflow-wrap:anywhere;
}
.ap-error-actions{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.ap-error-btn{
    display:inline-flex; align-items:center; gap:7px;
    height:34px; padding:0 14px;
    border-radius:999px;
    border:1px solid var(--yz-border-strong, rgba(255,255,255,.17));
    background:transparent;
    color:var(--yz-text, #faf9f5);
    font-family:inherit; font-size:13px; font-weight:600;
    text-decoration:none; cursor:pointer;
    transition:border-color .2s ease, background .2s ease, transform .12s ease;
}
.ap-error-btn i{ font-size:12px; opacity:.85; }
.ap-error-btn:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); background:var(--yz-accent-soft, rgba(217,119,87,.14)); }
.ap-error-btn:active{ transform:scale(.96); }
.ap-error-btn.primary{
    background:var(--yz-grad, linear-gradient(135deg,#e2885f,#b3552e));
    border-color:transparent; color:#fff;
}
.ap-error-btn.primary:hover{ filter:brightness(1.07); background:var(--yz-grad, linear-gradient(135deg,#e2885f,#b3552e)); }

/* ─── Пометка «остановлено» ───────────────────────────────────────────── */
.ap-stopped{
    display:flex; align-items:center; flex-wrap:wrap; gap:10px;
    margin-top:12px; padding-top:11px;
    border-top:1px dashed var(--yz-border-strong, rgba(255,255,255,.17));
    font-family:var(--ap-sans); font-size:12.5px; color:var(--yz-muted, #8d8878);
}
.ap-stopped > i{ font-size:12px; }
.ap-stopped-go{
    background:transparent; border:none; padding:0; cursor:pointer;
    font:inherit; font-weight:600; color:var(--yz-accent-hi, #e88a68);
    text-decoration:underline; text-underline-offset:3px;
}
.ap-stopped-go:hover{ text-decoration-thickness:2px; }

/* ─── Кнопка «стоп» в поле ввода ──────────────────────────────────────────
   Занимает место кнопки отправки, пока идёт ответ. Квадрат внутри круга —
   единственный символ остановки, который читается без подписи. */
#ap-halt-btn{
    width:42px; height:42px; border-radius:50%; border:none;
    display:none; align-items:center; justify-content:center;
    flex:0 0 auto; font-size:14px; cursor:pointer; outline:none;
    background:var(--yz-surface-2, #2E2C29);
    color:var(--yz-text, #faf9f5);
    border:1px solid var(--yz-border-strong, rgba(255,255,255,.17)) !important;
    transition:all .25s var(--ap-spring);
}
#ap-halt-btn:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)) !important; color:var(--yz-accent-hi, #e88a68); }
#ap-halt-btn:active{ transform:scale(.9); }

/* ─── Кнопка «вниз» ───────────────────────────────────────────────────────
   Появляется, только когда человек ушёл от нижнего края больше чем на
   320 пикселей: иначе она мозолит глаза в коротком диалоге, где и так всё
   видно. Живёт над зоной ввода, по центру. */
.ap-jump{
    position:absolute;
    left:50%;
    bottom:calc(var(--safe-bottom, 0px) + 92px);
    transform:translate(-50%, 14px) scale(.9);
    width:38px; height:38px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    border:1px solid var(--yz-border-strong, rgba(255,255,255,.17));
    background:var(--yz-surface, #22211F);
    color:var(--yz-text, #faf9f5);
    font-size:13px; cursor:pointer;
    box-shadow:var(--yz-shadow-md, 0 8px 26px rgba(0,0,0,.4));
    opacity:0; pointer-events:none;
    transition:opacity .22s ease, transform .22s var(--ap-spring);
    z-index:56;
}
.ap-jump.show{ opacity:1; pointer-events:auto; transform:translate(-50%, 0) scale(1); }
.ap-jump:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); color:var(--yz-accent-hi, #e88a68); }
.ap-jump:active{ transform:translate(-50%, 0) scale(.9); }

/* ─── Стартовые подсказки на пустом экране ────────────────────────────────
   Две колонки на телефоне, четыре в ряд — на широком экране. Слева, под
   приветствием: экран читается сверху вниз одним движением. */
.ap-starters{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:8px;
    width:100%;
    margin-top:22px;
}
.ap-starter{
    display:flex; align-items:center; gap:10px;
    min-height:52px; padding:10px 14px;
    border-radius:16px;
    border:1px solid var(--yz-border, rgba(255,255,255,.08));
    background:var(--yz-surface, #22211F);
    color:var(--yz-text, #faf9f5);
    font-family:var(--ap-sans); font-size:13px; font-weight:500;
    line-height:1.3; text-align:left; cursor:pointer;
    transition:border-color .2s ease, transform .16s var(--ap-spring), background .2s ease;
}
.ap-starter i{ flex:0 0 auto; font-size:14px; color:var(--yz-accent-hi, #e88a68); }
.ap-starter span{ min-width:0; }
.ap-starter:hover{
    transform:translateY(-2px);
    border-color:var(--yz-accent-line, rgba(217,119,87,.42));
    background:var(--yz-surface-2, #2E2C29);
}
.ap-starter:active{ transform:scale(.97); }
@media (min-width:620px){
    .ap-starters{ grid-template-columns:repeat(4, minmax(0, 1fr)); }
}
@media (max-width:340px){
    .ap-starters{ grid-template-columns:1fr; }
}

/* Битая картинка вместо арта — вместо пустой рамки */
.ap-art-broken{
    display:block; padding:18px; text-align:center;
    font-family:var(--ap-sans); font-size:13px; color:var(--yz-muted, #8d8878);
}

/* ─── Видимый фокус ───────────────────────────────────────────────────────
   Обходить шторку с клавиатуры было нельзя: на кнопках стоял outline:none, и
   куда попал фокус, видно не было вовсе. Возвращаем рамку — но только для
   :focus-visible, то есть для клавиатуры, а не для мыши. */
.ai-overlay-modal :focus-visible,
.ap-modal-overlay :focus-visible{
    outline:2px solid var(--yz-accent-hi, #e88a68) !important;
    outline-offset:2px;
    border-radius:8px;
}

/* ─── Уважение к «поменьше движения» ──────────────────────────────────────
   Система просит убрать анимации — убираем. Раньше пульсация точки,
   бегущий блик и волна записи работали всегда. */
@media (prefers-reduced-motion: reduce){
    .ai-overlay-modal *,
    .ap-modal-overlay *{
        animation-duration:.01ms !important;
        animation-iteration-count:1 !important;
        transition-duration:.01ms !important;
    }
    .ap-jump{ transition:opacity .01ms !important; }
}

/* ─── Светлая тема ───────────────────────────────────────────────────────── */
html[data-yz-theme="cloud"] .ap-error{ background:var(--yz-surface, #fff); }
html[data-yz-theme="cloud"] .ap-starter{ background:var(--yz-surface, #fff); }
html[data-yz-theme="cloud"] .ap-jump{ background:var(--yz-surface, #fff); }
html[data-yz-theme="cloud"] #ap-halt-btn{ background:var(--yz-surface-2, #f0ede6); }


/* Пометка «показаны последние 200 сообщений» — над началом длинного диалога. */
.ap-trunc-note{
    text-align:center; font-family:var(--ap-sans); font-size:12px;
    color:var(--yz-muted, #8d8878); padding:6px 12px; margin-bottom:4px;
    border-bottom:1px dashed var(--yz-border, rgba(255,255,255,.08));
}


/* ============================================================================
   РАБОТА С ПЕРСОНАЖЕМ · 12.10.2026
   ----------------------------------------------------------------------------
   Разметка — includes/floating_nav.php (ветки if ($fn_work)) и методы work* в
   assets/js/ai_portal.js. Классы только новые: ни одно прежнее правило выше не
   переопределено, поэтому без window.YZ_WORK шторка выглядит как раньше.
   Цвета — только токены темы (--yz-*), запасные значения — янтарная тема.
   ОТКАТ: удалить всё до конца файла.
   ========================================================================== */

/* ── Кто работает (шапка) ── */
.ap-who{
    display:flex; align-items:center; gap:9px; min-width:0; max-width:min(62vw, 280px);
    height:42px; padding:3px 12px 3px 3px; border-radius:999px; cursor:pointer;
    background:rgba(30,29,28,.5); border:1px solid var(--yz-border-strong, rgba(250,249,245,.17));
    -webkit-backdrop-filter:blur(14px) saturate(1.4); backdrop-filter:blur(14px) saturate(1.4);
    color:var(--yz-text, #faf9f5); font-family:var(--ap-sans); text-align:left;
    transition:transform .2s var(--ap-spring);
}
.ap-who:active{ transform:scale(.96); }
.ap-who:focus-visible{ outline:2px solid var(--yz-info, #4c8dff); outline-offset:2px; }
.ap-who-av, .ap-work-av, .ap-hi-av, .ap-work-prow-av{
    flex:0 0 auto; border-radius:50%; overflow:hidden; display:grid; place-items:center;
    background:var(--yz-grad, linear-gradient(135deg,#e2885f,#d97757 45%,#b3552e));
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.14);
}
.ap-who-av{ width:34px; height:34px; }
.ap-who-av img, .ap-work-av img, .ap-hi-av img, .ap-work-prow-av img{ width:100%; height:100%; object-fit:cover; display:block; }
.ap-who-av svg{ width:52%; height:52%; fill:#fff; }
.ap-who-tx{ display:flex; flex-direction:column; min-width:0; line-height:1.15; }
.ap-who-n{ font-family:var(--ap-serif); font-weight:700; font-size:14.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-who-r{ font-size:10.5px; color:var(--yz-muted, #8d8878); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-who-chev{ font-size:10px; color:var(--yz-muted, #8d8878); margin-left:2px; }
/* Название задачи уже стоит в подписи под именем — в шапке его не дублируем. */
.ai-overlay-modal .ap-topbar .ap-who ~ .ap-session-title{ display:none; }

.ap-mem-dot{
    position:absolute; top:7px; right:7px; width:8px; height:8px; border-radius:50%;
    background:var(--yz-accent, #d97757); box-shadow:0 0 0 2px var(--yz-bg, #0F0E0D);
    opacity:0; transform:scale(0); transition:.35s var(--ap-spring);
}
.ap-mem-dot.on{ opacity:1; transform:none; }

/* ── Тихий экран Работы ── */
.ap-work-hero{ display:flex; flex-direction:column; align-items:flex-start; gap:18px; }
.ap-work-av{ width:52px; height:52px; box-shadow:0 10px 30px -8px rgba(217,119,87,.55), inset 0 0 0 1px rgba(255,255,255,.14); animation:apWorkIn .7s var(--ap-ease) both; }
.ap-work-av svg{ width:50%; height:50%; fill:#fff; }
.ai-overlay-modal .ap-welcome.ap-quiet .ap-work-hi{ animation:apWorkIn .8s var(--ap-ease) .08s both; }
@keyframes apWorkIn{ from{ opacity:0; transform:translateY(10px); filter:blur(3px); } to{ opacity:1; transform:none; filter:none; } }
.ap-work-hero{ position:relative; isolation:isolate; }
.ai-overlay-modal .ap-welcome.ap-quiet .ap-work-hero::before{
    content:""; position:absolute; left:-20%; right:-20%; bottom:-120px; height:360px; z-index:-1; pointer-events:none;
    background:radial-gradient(45% 45% at 25% 70%, rgba(217,119,87,.20), transparent 70%),
               radial-gradient(40% 40% at 75% 85%, rgba(226,177,60,.08), transparent 70%);
    filter:blur(8px); animation:apWorkAura 14s ease-in-out infinite alternate;
}
@keyframes apWorkAura{ from{ transform:translate3d(-3%,0,0); } to{ transform:translate3d(3%,-5%,0) scale(1.06); } }

.ap-memline{
    margin-top:14px; display:inline-flex; align-items:center; gap:9px; max-width:100%;
    height:34px; padding:0 14px 0 6px; border-radius:999px; cursor:pointer;
    border:1px solid var(--yz-border-strong, rgba(250,249,245,.17));
    background:var(--yz-surface, #22211F); color:var(--yz-dim, #b9b4a7);
    font-family:var(--ap-sans); font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.ap-memline > i{ width:24px; height:24px; border-radius:50%; display:grid; place-items:center; font-size:11px;
    background:var(--yz-accent-soft, rgba(217,119,87,.14)); color:var(--yz-accent-hi, #e88a68); }
.ap-memline b{ color:var(--yz-text, #faf9f5); font-weight:600; }
.ap-memline.off > i{ background:var(--yz-surface-2, #2E2C29); color:var(--yz-muted, #8d8878); }

/* ── Ответ персонажа: лицо вместо логотипа ── */
.ap-ai-avatar.ap-ai-avatar-img{ overflow:hidden; background:var(--yz-surface-2, #2E2C29); }
.ap-ai-avatar.ap-ai-avatar-img img{ width:100%; height:100%; object-fit:cover; display:block; }

/* ── Короче / Подробнее под ответом ── */
.ap-work-chips{ display:inline-flex; gap:6px; margin-left:auto; padding-left:6px; }
.ap-work-chip{
    height:30px; padding:0 12px; border-radius:999px; cursor:pointer;
    border:1px solid var(--yz-border-strong, rgba(250,249,245,.17)); background:transparent;
    color:var(--yz-dim, #b9b4a7); font-family:var(--ap-sans); font-size:12.5px; font-weight:600;
}
.ap-work-chip:hover{ color:var(--yz-text, #faf9f5); border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.ap-action-bar:has(.ap-work-chips){ flex-wrap:wrap; }

/* ── «Запомнил: …» ── */
.ap-remember{
    clear:both; margin-top:12px; display:flex; align-items:center; gap:10px;
    padding:9px 10px 9px 9px; border-radius:14px; font-family:var(--ap-sans); font-size:12.5px;
    color:var(--yz-dim, #b9b4a7); border:1px solid var(--yz-accent-line, rgba(217,119,87,.42));
    background:linear-gradient(90deg, var(--yz-accent-soft, rgba(217,119,87,.14)), transparent 85%);
    animation:apWorkIn .6s var(--ap-spring) both;
}
.ap-remember-ic{ width:26px; height:26px; border-radius:50%; flex:0 0 auto; display:grid; place-items:center;
    background:var(--yz-accent, #d97757); color:#fff; font-size:11px; }
.ap-remember-tx{ flex:1; min-width:0; line-height:1.35; }
.ap-remember b{ color:var(--yz-text, #faf9f5); font-weight:600; }
.ap-remember button{ border:0; background:none; cursor:pointer; color:var(--yz-muted, #8d8878);
    font:600 12px var(--ap-sans); padding:5px 8px; border-radius:8px; }
.ap-remember button:hover{ color:var(--yz-text, #faf9f5); background:var(--yz-surface, #22211F); }

/* ── Окна Работы (кто работает, память, стиль) ── */
.ap-work-card{ padding:20px 20px 22px; }
.ap-work-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:4px; }
.ap-work-head h3{ margin:0; font-size:23px; }
.ap-work-x{ width:36px; height:36px; flex:0 0 auto; border-radius:50%; border:0; cursor:pointer;
    background:var(--yz-surface-2, #2E2C29); color:var(--yz-dim, #b9b4a7); }
.ap-work-body .ap-modal-sub{ margin:6px 0 12px; }
.ap-work-prow{
    width:100%; display:flex; align-items:center; gap:12px; padding:10px; margin-bottom:4px;
    border-radius:16px; border:1px solid transparent; background:none; cursor:pointer; text-align:left;
    color:var(--yz-text, #faf9f5); font-family:var(--ap-sans);
}
.ap-work-prow:hover{ background:var(--yz-surface-2, #2E2C29); }
.ap-work-prow.on{ background:var(--yz-accent-soft, rgba(217,119,87,.14)); border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.ap-work-prow > i{ color:var(--yz-accent, #d97757); }
.ap-work-prow-av{ width:46px; height:46px; }
.ap-work-prow-av svg{ width:48%; height:48%; fill:#fff; }
.ap-work-prow-tx{ flex:1; min-width:0; display:flex; flex-direction:column; }
.ap-work-prow-tx b{ font-family:var(--ap-serif); font-size:15.5px; font-weight:700; }
.ap-work-prow-tx small{ font-size:12px; color:var(--yz-muted, #8d8878); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-work-more{ display:flex; align-items:center; justify-content:center; gap:8px; height:46px; margin-top:10px;
    border-radius:14px; border:1px solid var(--yz-border-strong, rgba(250,249,245,.17));
    color:var(--yz-text, #faf9f5); text-decoration:none; font:600 13.5px var(--ap-sans); }

.ap-work-memhead{ display:flex; align-items:center; gap:12px; padding:12px; margin-top:8px; border-radius:16px;
    background:var(--yz-surface-2, #2E2C29); border:1px solid var(--yz-border, rgba(250,249,245,.08)); }
.ap-work-memic{ width:38px; height:38px; border-radius:50%; display:grid; place-items:center; flex:0 0 auto;
    background:var(--yz-accent, #d97757); color:#fff; }
.ap-work-memic.off{ background:var(--yz-surface, #22211F); color:var(--yz-muted, #8d8878); }
.ap-work-memtx{ flex:1; min-width:0; display:flex; flex-direction:column; }
.ap-work-memtx b{ font-size:14.5px; color:var(--yz-text, #faf9f5); }
.ap-work-memtx small{ font-size:12px; color:var(--yz-muted, #8d8878); }
.ap-work-sw{ width:48px; height:29px; flex:0 0 auto; border-radius:999px; border:0; cursor:pointer; position:relative;
    background:var(--yz-border-strong, rgba(250,249,245,.17)); transition:background .25s; }
.ap-work-sw::after{ content:""; position:absolute; top:3px; left:3px; width:23px; height:23px; border-radius:50%;
    background:#fff; box-shadow:0 2px 6px rgba(0,0,0,.35); transition:transform .3s var(--ap-spring); }
.ap-work-sw[aria-checked="true"]{ background:var(--yz-accent, #d97757); }
.ap-work-sw[aria-checked="true"]::after{ transform:translateX(19px); }
.ap-work-sec{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin:18px 4px 8px;
    font:700 10.5px/1 var(--ap-sans); letter-spacing:.13em; text-transform:uppercase; color:var(--yz-muted, #8d8878); }
.ap-work-sec span{ letter-spacing:0; text-transform:none; font-weight:500; }
.ap-work-sec .ap-work-sw{ transform:scale(.85); transform-origin:right center; }
.ap-work-rule{ display:flex; gap:10px; align-items:flex-start; padding:12px; margin-bottom:6px; border-radius:14px;
    background:var(--yz-surface-2, #2E2C29); border:1px solid var(--yz-accent-line, rgba(217,119,87,.42)); }
.ap-work-rule-tx{ flex:1; min-width:0; font:400 14px/1.45 var(--ap-serif); color:var(--yz-text, #faf9f5); }
.ap-work-who2{ display:block; font:700 9.5px/1 var(--ap-sans); letter-spacing:.12em; text-transform:uppercase;
    color:var(--yz-accent-hi, #e88a68); margin-bottom:5px; }
.ap-work-rule button{ flex:0 0 auto; height:32px; padding:0 10px; border-radius:9px; cursor:pointer;
    border:1px solid var(--yz-border-strong, rgba(250,249,245,.17)); background:none;
    color:var(--yz-dim, #b9b4a7); font:600 12px var(--ap-sans); }
.ap-work-bond{ padding:12px; border-radius:14px; background:var(--yz-surface-2, #2E2C29);
    border:1px solid var(--yz-border, rgba(250,249,245,.08)); font:400 14px/1.5 var(--ap-serif); color:var(--yz-dim, #b9b4a7); }
.ap-work-bond b{ color:var(--yz-text, #faf9f5); }
.ap-work-fact{ display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px solid var(--yz-border, rgba(250,249,245,.08)); }
.ap-work-fact-tx{ flex:1; min-width:0; display:flex; flex-direction:column; }
.ap-work-fact-tx b{ font:400 15px/1.35 var(--ap-serif); color:var(--yz-text, #faf9f5); }
.ap-work-fact-tx small{ font-size:11px; color:var(--yz-muted, #8d8878); margin-top:2px; }
.ap-work-fact button{ width:34px; height:34px; border-radius:10px; border:0; background:none; cursor:pointer; color:var(--yz-muted, #8d8878); }
.ap-work-fact button:hover{ background:var(--yz-surface-2, #2E2C29); color:var(--yz-danger, #e5484d); }
/* 18.10.2026: «Забыть» — словом, как «Убрать» у закреплённых: иконку корзины не замечали */
.ap-work-fact button.ap-work-forget{ width:auto; height:32px; padding:0 10px; border-radius:9px;
    border:1px solid var(--yz-border-strong, rgba(250,249,245,.17)); color:var(--yz-dim, #b9b4a7); font:600 12px var(--ap-sans); }
.ap-work-rule button:hover, .ap-work-fact button.ap-work-forget:hover{ color:var(--yz-danger, #e5484d); border-color:var(--yz-danger, #e5484d); background:none; }
.ap-work-rule button:disabled{ opacity:.5; cursor:default; }
.ap-work-rgroup{ margin:12px 4px 6px; font:600 12px/1.3 var(--ap-sans); color:var(--yz-muted, #8d8878); }
.ap-work-rgroup b{ color:var(--yz-accent-hi, #e88a68); font-weight:600; }
html[data-yz-theme="cloud"] .ap-work-fact button.ap-work-forget{ border-color:rgba(35,32,25,.18); }
.ap-work-memlist.dim .ap-work-fact, .ap-work-memlist.dim .ap-work-bond, .ap-work-bond.dim{ opacity:.4; }
.ap-work-hint{ margin:4px 4px 8px; font-size:12.5px; color:var(--yz-muted, #8d8878); line-height:1.5; }
.ap-work-hint i{ color:var(--yz-accent-hi, #e88a68); margin-right:4px; }
.ap-work-privacy{ margin:16px 2px 0; font-size:12px; color:var(--yz-muted, #8d8878); line-height:1.5; }
.ap-work-opt{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:4px; padding:4px; border-radius:16px;
    background:var(--yz-surface-2, #2E2C29); border:1px solid var(--yz-border, rgba(250,249,245,.08)); }
.ap-work-opt button{ height:40px; border:0; border-radius:12px; background:none; cursor:pointer;
    color:var(--yz-muted, #8d8878); font:600 13px var(--ap-sans); }
.ap-work-opt button[aria-pressed="true"]{ background:var(--yz-surface, #22211F); color:var(--yz-text, #faf9f5); box-shadow:0 2px 8px rgba(0,0,0,.3); }
.ap-work-preview{ margin:16px 0 0; padding:14px 16px; border-radius:16px; border:1px dashed var(--yz-border-strong, rgba(250,249,245,.17));
    font:italic 400 15.5px/1.45 var(--ap-serif); color:var(--yz-dim, #b9b4a7); }

/* ── Список задач: лицо, «⋯», переименовать, удалить ── */
.ap-history-item.has-av{ padding-left:52px; position:relative; }
.ap-history-item.has-work{ padding-right:78px; }
.ap-hi-av{ position:absolute; left:12px; top:50%; transform:translateY(-50%); width:30px; height:30px; }
.ap-hi-av svg{ width:50%; height:50%; fill:#fff; }
.ap-hi-work{ position:absolute; right:44px; top:50%; transform:translateY(-50%); width:32px; height:32px;
    border:0; border-radius:10px; background:none; cursor:pointer; color:var(--yz-muted, #8d8878); }
.ap-hi-work:hover{ background:var(--yz-surface-2, #2E2C29); color:var(--yz-text, #faf9f5); }
.ap-hi-menu{ display:flex; gap:6px; flex-wrap:wrap; padding:2px 6px 10px 52px; animation:apWorkIn .25s var(--ap-ease) both; }
.ap-hi-menu button{ height:32px; padding:0 11px; border-radius:10px; cursor:pointer; display:inline-flex; align-items:center; gap:6px;
    border:1px solid var(--yz-border-strong, rgba(250,249,245,.17)); background:var(--yz-surface, #22211F);
    color:var(--yz-text, #faf9f5); font:600 12px var(--ap-sans); }
.ap-hi-menu button.del{ color:var(--yz-danger, #e5484d); }
.ap-hi-rename{ width:100%; padding:4px 8px; border-radius:8px; outline:none;
    border:1px solid var(--yz-accent-line, rgba(217,119,87,.42)); background:var(--yz-surface, #22211F);
    color:var(--yz-text, #faf9f5); font:600 14px var(--ap-sans); }

.ap-work-undo{
    position:fixed; left:50%; bottom:calc(var(--safe-bottom, 0px) + 96px); z-index:2147483647;
    transform:translateX(-50%) translateY(16px); opacity:0; pointer-events:none;
    display:flex; align-items:center; gap:14px; padding:11px 12px 11px 18px; border-radius:16px;
    background:var(--yz-text, #faf9f5); color:var(--yz-bg, #0F0E0D); font:500 13.5px var(--ap-sans);
    box-shadow:0 18px 40px -12px rgba(0,0,0,.6); transition:.3s var(--ap-spring);
}
.ap-work-undo.show{ opacity:1; transform:translateX(-50%); pointer-events:auto; }
.ap-work-undo button{ border:0; background:none; cursor:pointer; color:var(--yz-accent-deep, #b05730); font:800 13.5px var(--ap-sans); padding:4px 6px; }

@media (max-width:420px){
    .ap-who{ max-width:56vw; }
    .ap-work-chips{ margin-left:0; padding-left:0; width:100%; }
}
@media (prefers-reduced-motion: reduce){
    .ap-work-av, .ap-remember, .ap-hi-menu, .ap-work-hi{ animation:none !important; }
    .ai-overlay-modal .ap-welcome.ap-quiet .ap-work-hero::before{ animation:none !important; }
}
html[data-yz-theme="cloud"] .ap-who{ background:rgba(255,255,255,.75); }
html[data-yz-theme="cloud"] .ap-work-undo{ background:#1b1917; color:#faf9f5; }

/* ============================================================
   ВЛОЖЕНИЯ В СООБЩЕНИИ ЧЕЛОВЕКА · 18.10.2026
   Карточка файла / фото — отдельно, НАД пузырём текста.
   ============================================================ */
.ai-overlay-modal .ap-msg.user .ap-msg-text.has-attach{
    background:none; border:0; padding:0; border-radius:0; white-space:normal;
    display:flex; flex-direction:column; align-items:flex-end; gap:6px; max-width:78%;
}
.ap-u-attach{ display:flex; flex-direction:column; align-items:flex-end; gap:6px; max-width:100%; }
.ai-overlay-modal .ap-msg.user .ap-u-txt{
    background:var(--yz-accent-soft); border:1px solid var(--yz-accent-line);
    border-radius:22px 22px 6px 22px; padding:12px 16px; white-space:pre-wrap; max-width:100%;
}
.ap-u-media{
    max-width:260px; border-radius:18px; overflow:hidden; line-height:0; cursor:zoom-in;
    border:1px solid var(--yz-border, rgba(255,255,255,.08)); background:var(--yz-surface, #22211F);
}
.ap-msg-text .ap-u-media img{ display:block; width:100%; max-width:none; height:auto; max-height:340px; object-fit:cover; border-radius:0; }
.ap-u-file{
    display:flex; align-items:center; gap:12px; width:264px; max-width:100%;
    padding:10px 14px 10px 10px; border-radius:16px; text-align:left;
    background:var(--yz-surface, #22211F); border:1px solid var(--yz-border-strong, rgba(255,255,255,.17));
    color:var(--yz-text) !important; text-decoration:none !important; font-family:var(--ap-sans);
    transition:border-color .2s ease;
}
a.ap-u-file:hover{ border-color:var(--yz-accent-line); }
.ap-u-ext, .ap-fp-thumb{
    flex:0 0 40px; width:40px; height:40px; border-radius:10px; overflow:hidden;
    display:flex; align-items:center; justify-content:center;
    font:800 10.5px/1 var(--ap-sans); letter-spacing:.05em; color:#fff; background:#7d786c;
}
.ap-u-ext[data-k="PDF"], .ap-fp-thumb[data-k="PDF"]{ background:#c4473a; }
.ap-u-ext[data-k="DOC"], .ap-fp-thumb[data-k="DOC"]{ background:#3b6fc9; }
.ap-u-ext[data-k="XLS"], .ap-fp-thumb[data-k="XLS"],
.ap-u-ext[data-k="CSV"], .ap-fp-thumb[data-k="CSV"]{ background:#2f8a57; }
.ap-u-ext[data-k="PPT"], .ap-fp-thumb[data-k="PPT"]{ background:#d0703a; }
.ap-fp-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.ap-u-meta{ display:flex; flex-direction:column; gap:3px; min-width:0; }
.ap-u-meta b{ font-size:14px; font-weight:600; line-height:1.25; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-u-meta small{ font-size:12px; color:var(--yz-muted, #8d8878); }

/* Прикреплённый файл — первой строкой ВНУТРИ поля ввода */
.ap-input-wrapper{ flex-wrap:wrap; }
.ap-input-wrapper > .ap-file-preview{ flex:0 0 100%; max-width:none; margin:2px 2px 0; }
.ap-input-wrapper .ap-file-preview-card{
    display:flex; width:auto; max-width:320px; gap:10px; padding:6px 6px 6px 6px;
    background:var(--yz-surface-2, #2E2C29); border:1px solid var(--yz-border, rgba(255,255,255,.08));
    border-radius:14px; box-shadow:none;
}
.ap-input-wrapper .ap-file-preview-card .ap-fp-thumb{ flex-basis:36px; width:36px; height:36px; border-radius:9px; }
.ap-input-wrapper .ap-fp-info{ flex:1; min-width:0; }
.ap-input-wrapper .ap-fp-name{ max-width:200px; }
.ap-input-wrapper button.ap-fp-remove{
    width:26px; height:26px; flex:0 0 26px; font-size:11px; border-radius:50%;
    background:transparent; color:var(--yz-muted); box-shadow:none;
}
.ap-input-wrapper button.ap-fp-remove:hover{ background:rgba(229,72,77,.12); color:var(--yz-danger); transform:none; }

html[data-yz-theme="cloud"] .ap-u-file, html[data-yz-theme="cloud"] .ap-u-media{ background:#fff; }
html[data-yz-theme="cloud"] .ap-input-wrapper .ap-file-preview-card{ background:#f4f1ea; }

/* ============================================================
   ПОЛИРОВКА ШТОРКИ · 18.10.2026
   Поле ввода — спокойная капсула: без оранжевой обводки и свечения
   при наборе. В ответах цвет сайта получает одну роль — выделения
   (жирный текст); остальное тише: цитаты, код, заголовки, таблицы.
   ============================================================ */
.ai-overlay-modal .ap-input-wrapper{
    align-items:center; gap:4px; padding:6px 6px 6px 6px; border-radius:24px;
    background:var(--yz-surface, #22211F);
    border:1px solid rgba(250,249,245,.10);
    border-color:color-mix(in srgb, var(--yz-text, #faf9f5) 11%, transparent);
    box-shadow:0 12px 32px rgba(0,0,0,.22);
    -webkit-backdrop-filter:none; backdrop-filter:none;
    transition:border-color .2s ease;
}
.ai-overlay-modal .ap-input-wrapper:focus-within{
    border-color:rgba(250,249,245,.22);
    border-color:color-mix(in srgb, var(--yz-text, #faf9f5) 22%, transparent);
    box-shadow:0 12px 32px rgba(0,0,0,.22);
}
.ai-overlay-modal .ap-input-wrapper textarea{
    font-family:var(--ap-sans); font-size:15.5px; line-height:1.45; padding:9px 6px;
    caret-color:var(--yz-accent, #d97757);
}
.ai-overlay-modal .ap-input-wrapper textarea::placeholder{ font-style:normal; color:var(--yz-muted, #8d8878); }
.ai-overlay-modal .ap-input-wrapper > button{ width:38px; height:38px; font-size:15px; }
.ai-overlay-modal #ch-attach-btn, .ai-overlay-modal #ch-mic-btn{ color:var(--yz-muted, #8d8878); background:transparent; }
.ai-overlay-modal #ch-attach-btn:hover, .ai-overlay-modal #ch-mic-btn:hover{
    color:var(--yz-text); background:rgba(250,249,245,.06);
    background:color-mix(in srgb, var(--yz-text, #faf9f5) 7%, transparent); transform:none;
}
.ai-overlay-modal #ch-send-btn{
    background:var(--yz-accent, #d97757); color:#fff; box-shadow:none;
}
.ai-overlay-modal #ch-send-btn:hover{ transform:none; filter:brightness(1.08); }
.ai-overlay-modal #ch-send-btn:active{ transform:scale(.94); }
.ai-overlay-modal .ap-input-note{ font-size:11px; margin-top:7px; opacity:.7; }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-input-wrapper{ background:#fff; box-shadow:0 8px 24px rgba(35,32,25,.08); }

/* Сообщение человека — мягче: без обводки */
.ai-overlay-modal .ap-msg.user .ap-msg-text:not(.has-attach),
.ai-overlay-modal .ap-msg.user .ap-u-txt{ border-color:transparent; }

/* --- Ответ ИИ --- */
.ap-msg.ai .ap-msg-text strong{ font-weight:650; color:var(--yz-accent-hi, #e88a68); }
.ap-msg.ai .ap-msg-text h1 strong, .ap-msg.ai .ap-msg-text h2 strong,
.ap-msg.ai .ap-msg-text h3 strong, .ap-msg.ai .ap-msg-text h4 strong{ color:inherit; font-weight:inherit; }
.ap-msg.ai .ap-msg-text h2{ font-size:20px; margin:1.3em 0 .45em; }
.ap-msg.ai .ap-msg-text h3{ font-size:17.5px; margin:1.2em 0 .4em; }
.ap-msg.ai .ap-msg-text h4{
    font-family:var(--ap-sans); font-size:15px; font-weight:650; letter-spacing:0;
    text-transform:none; color:var(--yz-text); margin:1.1em 0 .35em;
}
.ap-msg.ai .ap-msg-text ul > li::before{ width:6px; height:6px; top:.66em; left:7px; opacity:.9; }
.ap-msg.ai .ap-msg-text blockquote{
    background:none; font-style:normal; color:var(--yz-dim);
    border-left:2px solid var(--yz-accent-line, rgba(217,119,87,.42)); border-radius:0; padding:2px 0 2px 16px;
}
.ap-msg.ai .ap-msg-text :not(pre) > code{
    background:rgba(250,249,245,.07); background:color-mix(in srgb, var(--yz-text, #faf9f5) 8%, transparent);
    color:var(--yz-text); padding:1px 6px; border-radius:6px; font-size:.84em;
}
.ap-msg.ai .ap-msg-text table{
    border-collapse:separate; border-spacing:0; overflow:hidden; border-radius:12px;
    border:1px solid var(--yz-border, rgba(250,249,245,.08));
}
.ap-msg.ai .ap-msg-text th{
    font-family:var(--ap-sans); font-size:13px; font-weight:650; color:var(--yz-dim);
    background:var(--yz-surface, #22211F); border-bottom:1px solid var(--yz-border, rgba(250,249,245,.08));
}
.ap-msg.ai .ap-msg-text td, .ap-msg.ai .ap-msg-text th{ padding:9px 12px; }
.ap-msg.ai .ap-msg-text tr:last-child td{ border-bottom:0; }
.ap-msg.ai .ap-msg-text hr{ border-top-color:var(--yz-border, rgba(250,249,245,.08)); margin:1.4em 0; }
html[data-yz-theme="cloud"] .ap-msg.ai .ap-msg-text strong{ color:var(--yz-accent, #c96543); }
/* Поле набора: без рамки фокуса — у текстового поля :focus-visible срабатывает
   и от мыши, и это та самая «подсветка при вводе». Фокус видно по капсуле. */
.ai-overlay-modal .ap-input-wrapper textarea:focus,
.ai-overlay-modal .ap-input-wrapper textarea:focus-visible{ outline:none !important; box-shadow:none !important; }


/* ============================================================================
   НАРОДНЫЙ ИИ · 19.10.2026
   ----------------------------------------------------------------------------
   Ряд быстрых агентов над полем ввода, карточки ответа (персонажи, погода,
   курс, напоминания, подписки), окно «Мои агенты», кнопка «Неверно».
   Только токены yazme-theme.css — темы amber/cloud/midnight работают сами.
   Разметку строит assets/js/ai_portal.js (блок «НАРОДНЫЙ ИИ · ШТОРКА»).
   ОТКАТ: удалить всё до конца файла.
   ========================================================================== */

/* ─── Ряд быстрых агентов ─────────────────────────────────────────────── */
.ap-agents-row{
    display:flex; gap:6px; overflow-x:auto; overflow-y:hidden;
    padding:2px 2px 9px; margin:0 0 0;
    scrollbar-width:none; -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain; scroll-snap-type:x proximity;
    -webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 28px), transparent);
            mask-image:linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.ap-agents-row::-webkit-scrollbar{ display:none; }
/* Хвост под затухание: в конце прокрутки последний чип виден целиком */
.ap-agents-row::after{ content:''; flex:0 0 24px; }
.ap-agent-chip{
    flex:0 0 auto; scroll-snap-align:start;
    display:inline-flex; align-items:center; gap:6px;
    height:34px; padding:0 13px 0 10px; border-radius:999px;
    border:1px solid var(--yz-border-strong, rgba(255,255,255,.17));
    background:var(--yz-surface, #22211F);
    color:var(--yz-text, #faf9f5);
    font-family:var(--ap-sans); font-size:13px; font-weight:500; line-height:1;
    white-space:nowrap; cursor:pointer;
    transition:border-color .18s ease, background .18s ease, transform .16s var(--ap-spring);
    -webkit-tap-highlight-color:transparent;
}
.ap-agent-chip:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); background:var(--yz-surface-2, #2E2C29); }
.ap-agent-chip:active{ transform:scale(.95); }
.ap-agent-emo{ font-size:15px; line-height:1; }

/* Место под ряд: лента, приветствие, кнопка «вниз», тост */
.ai-overlay-modal.ap-has-agents .ap-thread{ padding-bottom:178px; }
.ai-overlay-modal.ap-has-agents .ap-welcome.ap-quiet{ min-height:calc(100dvh - 274px); }
.ai-overlay-modal.ap-has-agents .ap-jump{ bottom:calc(var(--safe-bottom, 0px) + 136px); }
body.ap-agents-on.ai-overlay-active .ap-toast{ bottom:calc(var(--safe-bottom, 0px) + 142px); }

/* Телефон с открытой клавиатурой: ряд ужимается, подпись под полем прячется */
@media (max-width:800px){
    /* .ap-field-focus ставит ai_portal.js по focus/blur самого поля (не :focus-within —
       фокус на чипе при тапе менял раскладку, и первый тап на Android терялся) */
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agent-chip{ height:30px; font-size:12.5px; padding:0 11px 0 9px; }
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agents-row{ padding-bottom:7px; }
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-input-note{ display:none; }
}
@media (max-width:360px){
    .ap-agent-chip{ height:32px; padding:0 11px 0 9px; font-size:12.5px; }
}

/* ─── Карточки ответа: общее ──────────────────────────────────────────── */
.yzc-wrap{ clear:both; display:flex; flex-direction:column; gap:10px; margin:14px 0 4px; font-family:var(--ap-sans); }
.yzc{
    position:relative; border-radius:18px; padding:14px;
    background:var(--yz-surface, #22211F);
    border:1px solid var(--yz-border, rgba(255,255,255,.08));
    color:var(--yz-text, #faf9f5);
    animation:yzcIn .45s var(--ap-ease) both;
    min-width:0;
}
@keyframes yzcIn{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
.yzc a{ text-decoration:none !important; }
.yzc-head{ display:flex; align-items:baseline; gap:8px; margin:0 2px 10px; min-width:0; }
.yzc-ico{ font-size:15px; line-height:1; align-self:center; }
.yzc-title{ font-size:14.5px; font-weight:650; color:var(--yz-text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.yzc-sub{ font-size:12.5px; color:var(--yz-muted, #8d8878); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }

.yzc-btn{
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    height:34px; padding:0 14px; border-radius:11px; border:1px solid transparent;
    font-family:var(--ap-sans); font-size:13px; font-weight:600; line-height:1;
    cursor:pointer; white-space:nowrap; text-decoration:none !important;
    transition:filter .18s ease, border-color .18s ease, background .18s ease, transform .14s var(--ap-spring);
}
.yzc-btn:active{ transform:scale(.96); }
.yzc-btn.primary{ background:var(--yz-accent, #d97757); color:#fff !important; }
.yzc-btn.primary:hover{ filter:brightness(1.08); }
.yzc-btn.ghost{ background:transparent; color:var(--yz-text) !important; border-color:var(--yz-border-strong, rgba(255,255,255,.17)); }
.yzc-btn.ghost:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.yzc-btn.link{ background:transparent; color:var(--yz-dim, #a8a397) !important; padding:0 8px; height:30px; font-weight:500; }
.yzc-btn.link:hover{ color:var(--yz-text) !important; }
.yzc-btn[disabled]{ opacity:.6; cursor:default; transform:none; }

.yzc-foot{ display:flex; flex-wrap:wrap; align-items:center; gap:4px 16px; margin:10px 2px 0; }
.yzc-link{ display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--yz-accent-hi, #e88a68) !important; }
.yzc-link i{ font-size:11px; transition:transform .2s var(--ap-spring); }
.yzc-link:hover i{ transform:translateX(3px); }
.yzc-link.dim{ color:var(--yz-dim, #a8a397) !important; font-weight:500; }
.yzc-src{ margin:10px 2px 0; font-size:11.5px; color:var(--yz-muted, #8d8878); }
.yzc-src a{ color:var(--yz-dim, #a8a397) !important; border-bottom:1px solid var(--yz-border-strong, rgba(255,255,255,.17)); }
.yzc-src a:hover{ color:var(--yz-text) !important; }

/* ─── Персонажи ───────────────────────────────────────────────────────── */
.yzc-persona{ padding:14px 0 14px; }
.yzc-persona .yzc-head, .yzc-persona .yzc-foot{ margin-left:14px; margin-right:14px; }
.yzc-prow{
    display:grid; grid-auto-flow:column; grid-auto-columns:minmax(148px, 164px); gap:10px;
    overflow-x:auto; padding:0 14px 2px; scroll-padding:0 14px;
    scroll-snap-type:x mandatory; scrollbar-width:none; -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
}
.yzc-prow::-webkit-scrollbar{ display:none; }
.yzc-pc{
    scroll-snap-align:start; display:flex; flex-direction:column; min-width:0;
    border-radius:15px; overflow:hidden;
    background:var(--yz-surface-2, #2E2C29);
    border:1px solid var(--yz-border, rgba(255,255,255,.08));
    transition:border-color .2s ease, transform .2s var(--ap-spring);
}
.yzc-pc:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.yzc-pc-top{ display:flex; flex-direction:column; color:inherit !important; flex:1 1 auto; min-width:0; }
.yzc-pc-ph{
    display:block; position:relative; aspect-ratio:1 / 1; width:100%;
    background:var(--yz-surface, #22211F); overflow:hidden;
}
.yzc-pc-ph img{ width:100%; height:100%; object-fit:cover; display:block; transition:transform .5s var(--ap-ease); }
.yzc-pc:hover .yzc-pc-ph img{ transform:scale(1.04); }
.yzc-pc-ph.is-mono, .ap-ag-ico.is-mono{
    display:flex; align-items:center; justify-content:center;
    background:linear-gradient(145deg, hsl(var(--yzc-h, 18) 45% 42%), hsl(calc(var(--yzc-h, 18) + 40) 40% 26%));
}
.yzc-pc-ph.is-mono b{ font-family:var(--ap-serif); font-size:44px; font-weight:600; color:rgba(255,255,255,.92); }
.yzc-pc-bd{ display:flex; flex-direction:column; gap:3px; padding:10px 11px 4px; min-width:0; }
.yzc-pc-nm{ font-size:14px; font-weight:650; line-height:1.25; color:var(--yz-text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.yzc-pc-or{ font-size:11.5px; color:var(--yz-muted, #8d8878); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.yzc-pc-tg{
    font-size:12.5px; line-height:1.35; color:var(--yz-dim, #a8a397);
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.yzc-pc-pp{ font-size:11px; color:var(--yz-muted, #8d8878); margin-top:2px; }
.yzc-pc-acts{ display:flex; flex-wrap:wrap; gap:6px; padding:8px 10px 10px; }
/* 20.10.2026: на 360px «Написать» не влезала в половину карточки и
   резалась — кнопки теперь по ширине текста и переносятся на 2-ю строку. */
.yzc-pc-acts .yzc-btn{ flex:1 1 auto; height:32px; padding:0 6px; font-size:12.5px; border-radius:10px; }

/* «Такого персонажа пока нет» */
.yzc-create{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.yzc-create-ico{
    flex:0 0 44px; width:44px; height:44px; border-radius:14px; font-size:22px;
    display:flex; align-items:center; justify-content:center;
    background:var(--yz-accent-soft, rgba(217,119,87,.14));
}
.yzc-create-tx{ flex:1 1 160px; display:flex; flex-direction:column; gap:2px; min-width:0; }
.yzc-create-tx b{ font-size:14.5px; font-weight:650; }
.yzc-create-tx span{ font-size:12.5px; color:var(--yz-dim, #a8a397); }
.yzc-create .yzc-btn{ max-width:100%; overflow:hidden; text-overflow:ellipsis; }

/* ─── Погода ──────────────────────────────────────────────────────────── */
.yzc-wx{
    background:
        radial-gradient(120% 90% at 100% 0%, var(--yz-accent-soft, rgba(217,119,87,.14)), transparent 60%),
        var(--yz-surface, #22211F);
}
.yzc-wx-now{ display:flex; align-items:center; gap:12px; margin:2px 2px 12px; }
.yzc-wx-emo{ font-size:38px; line-height:1; }
.yzc-wx-t{ font-family:var(--ap-serif); font-size:40px; font-weight:400; line-height:1; letter-spacing:-.02em; color:var(--yz-text); }
.yzc-wx-d{ display:flex; flex-direction:column; gap:3px; min-width:0; }
.yzc-wx-d b{ font-size:14px; font-weight:600; }
.yzc-wx-d span{ font-size:12.5px; color:var(--yz-dim, #a8a397); }
.yzc-wx-days{ display:flex; flex-direction:column; border-top:1px solid var(--yz-border, rgba(255,255,255,.08)); }
.yzc-wx-day{
    display:grid; grid-template-columns:minmax(0, 1fr) 28px 54px auto; align-items:center; gap:8px;
    padding:9px 2px; border-bottom:1px solid var(--yz-border, rgba(255,255,255,.08));
    font-size:13.5px;
}
.yzc-wx-day:last-child{ border-bottom:0; padding-bottom:0; }
.yzc-wx-dl{ color:var(--yz-text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.yzc-wx-de{ font-size:18px; text-align:center; line-height:1; }
.yzc-wx-dp{ font-size:12px; color:var(--yz-info, #5b8def); text-align:right; white-space:nowrap; }
.yzc-wx-dt{ display:inline-flex; gap:8px; justify-content:flex-end; min-width:76px; font-variant-numeric:tabular-nums; }
.yzc-wx-dt b{ font-weight:650; color:var(--yz-text); }
.yzc-wx-dt span{ color:var(--yz-muted, #8d8878); }

/* ─── Курс ────────────────────────────────────────────────────────────── */
.yzc-rt-list{ display:flex; flex-direction:column; }
.yzc-rt{
    display:flex; align-items:center; gap:12px; padding:9px 2px;
    border-top:1px solid var(--yz-border, rgba(255,255,255,.08));
}
.yzc-rt:first-child{ border-top:0; padding-top:2px; }
.yzc-rt-sym{
    flex:0 0 34px; width:34px; height:34px; border-radius:11px;
    display:flex; align-items:center; justify-content:center;
    background:var(--yz-surface-2, #2E2C29); color:var(--yz-accent-hi, #e88a68);
    font-size:15px; font-weight:700;
}
.yzc-rt-nm{ flex:1 1 auto; display:flex; flex-direction:column; gap:2px; min-width:0; }
.yzc-rt-nm b{ font-size:14px; font-weight:650; letter-spacing:.02em; }
.yzc-rt-nm span{ font-size:12px; color:var(--yz-muted, #8d8878); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.yzc-rt-v{ display:flex; flex-direction:column; align-items:flex-end; gap:2px; font-variant-numeric:tabular-nums; }
.yzc-rt-v b{ font-family:var(--ap-serif); font-size:18px; font-weight:600; white-space:nowrap; }
.yzc-rt-ch{ font-size:11.5px; color:var(--yz-muted, #8d8878); white-space:nowrap; }
.yzc-rt-ch.up{ color:var(--yz-success, #58a76b); }
.yzc-rt-ch.down{ color:var(--yz-danger, #e5484d); }

/* ─── Напоминание / подписка ─────────────────────────────────────────── */
.yzc-agent{ display:flex; align-items:flex-start; gap:12px; flex-wrap:wrap; transition:opacity .25s ease; }
.yzc-ag-ico{
    flex:0 0 42px; width:42px; height:42px; border-radius:13px; font-size:20px;
    display:flex; align-items:center; justify-content:center;
    background:var(--yz-accent-soft, rgba(217,119,87,.14));
}
.yzc-ag-tx{ flex:1 1 170px; display:flex; flex-direction:column; gap:2px; min-width:0; padding-top:1px; }
.yzc-ag-k{ font-size:11px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--yz-muted, #8d8878); }
.yzc-ag-tx b{ font-size:15px; font-weight:650; line-height:1.3; overflow-wrap:anywhere; }
.yzc-ag-m{ font-size:12.5px; color:var(--yz-dim, #a8a397); }
.yzc-ag-acts{ display:flex; align-items:center; gap:6px; flex:1 0 100%; padding-left:54px; }
.yzc-agent.is-off{ opacity:.55; }
.yzc-agent.is-off .yzc-ag-tx b{ text-decoration:line-through; text-decoration-color:var(--yz-muted, #8d8878); }

/* ─── Окно «Мои агенты» ──────────────────────────────────────────────── */
.ap-agents-card{ max-width:440px; }
.ap-ag-city{ display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:-6px 0 14px; font-size:13px; color:var(--yz-dim, #a8a397); }
.ap-ag-city:empty{ display:none; }
.ap-ag-cv{ flex:1 1 auto; min-width:0; }
.ap-ag-city .ap-ag-cin{ flex:1 1 160px; height:40px; margin:0; font-size:15px; }
.ap-ag-list{ display:flex; flex-direction:column; gap:8px; }
.ap-ag-item{
    display:flex; align-items:center; gap:12px; padding:10px 8px 10px 10px; border-radius:15px;
    background:var(--yz-surface-2, #2E2C29); border:1px solid var(--yz-border, rgba(255,255,255,.08));
    transition:opacity .25s ease, transform .25s ease;
}
.ap-ag-item.is-gone{ opacity:0; transform:translateX(16px); }
.ap-ag-ico{
    flex:0 0 38px; width:38px; height:38px; border-radius:12px; font-size:18px;
    display:flex; align-items:center; justify-content:center; background:var(--yz-accent-soft, rgba(217,119,87,.14));
}
.ap-ag-tx{ flex:1 1 auto; display:flex; flex-direction:column; gap:2px; min-width:0; }
.ap-ag-tx b{ font-size:14px; font-weight:600; color:var(--yz-text); overflow-wrap:anywhere; }
.ap-ag-tx span{ font-size:12px; color:var(--yz-muted, #8d8878); }
.ap-ag-x{
    flex:0 0 36px; width:36px; height:36px; border-radius:11px; border:none; cursor:pointer;
    background:transparent; color:var(--yz-muted, #8d8878); font-size:15px;
    display:flex; align-items:center; justify-content:center; transition:color .15s, background .15s;
}
.ap-ag-x:hover{ color:var(--yz-danger, #e5484d); background:rgba(229,72,77,.1); }
.ap-ag-x[disabled]{ opacity:.5; cursor:default; }
.ap-ag-empty{
    display:flex; flex-direction:column; gap:4px; padding:16px; border-radius:15px; text-align:left;
    border:1px dashed var(--yz-border-strong, rgba(255,255,255,.17));
    font-size:13px; line-height:1.5; color:var(--yz-dim, #a8a397);
}
.ap-ag-empty b{ font-size:14px; color:var(--yz-text); }
.ap-ag-quick{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:16px; }
.ap-ag-quick:empty{ display:none; }
.ap-ag-ql{ flex:0 0 100%; font-size:11.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--yz-muted, #8d8878); margin-bottom:2px; }
.ap-ag-offer{
    display:inline-flex; align-items:center; gap:6px; height:34px; padding:0 13px 0 10px; border-radius:999px;
    border:1px solid var(--yz-border-strong, rgba(255,255,255,.17)); background:transparent; color:var(--yz-text);
    font-family:var(--ap-sans); font-size:13px; cursor:pointer; transition:border-color .18s;
}
.ap-ag-offer:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.ap-ag-offer[disabled]{ opacity:.55; cursor:default; }

/* ─── «Неверно» в панели под ответом ─────────────────────────────────── */
.ap-ab-btn.ap-ab-wrong{ margin-left:auto; padding:0 10px 0 8px; font-size:12px; }
.ap-ab-wrong .ap-ab-emo{ font-size:13px; filter:grayscale(1); opacity:.85; transition:filter .18s, opacity .18s; }
.ap-ab-wrong:hover .ap-ab-emo{ filter:none; opacity:1; }
.ap-ab-wrong.is-done{ color:var(--yz-accent-hi, #e88a68); cursor:default; }
.ap-ab-wrong.is-done .ap-ab-emo{ filter:none; opacity:1; }
.ap-ab-wrong[disabled]{ cursor:default; }
@media (max-width:360px){
    .ap-ab-wrong .ap-ab-lbl{ display:none; }
}

/* ─── Светлая тема ───────────────────────────────────────────────────── */
html[data-yz-theme="cloud"] .ap-agent-chip{ background:#fff; border-color:rgba(35,32,25,.12); }
html[data-yz-theme="cloud"] .ap-agent-chip:hover{ background:#fff; border-color:var(--yz-accent-line); }
html[data-yz-theme="cloud"] .yzc{ background:#fff; border-color:rgba(35,32,25,.09); box-shadow:0 6px 20px -12px rgba(60,50,35,.18); }
html[data-yz-theme="cloud"] .yzc-wx{
    background:radial-gradient(120% 90% at 100% 0%, var(--yz-accent-soft), transparent 60%), #fff;
}
html[data-yz-theme="cloud"] .yzc-pc{ background:var(--yz-bg, #f4f2ec); }
html[data-yz-theme="cloud"] .yzc-rt-sym{ background:var(--yz-bg, #f4f2ec); }
html[data-yz-theme="cloud"] .ap-ag-item{ background:var(--yz-bg, #f4f2ec); }

/* ─── Узкие экраны ───────────────────────────────────────────────────── */
@media (max-width:360px){
    .yzc{ padding:12px; border-radius:16px; }
    .yzc-persona{ padding:12px 0; }
    .yzc-persona .yzc-head, .yzc-persona .yzc-foot{ margin-left:12px; margin-right:12px; }
    .yzc-prow{ padding:0 12px 2px; grid-auto-columns:minmax(136px, 148px); }
    .yzc-wx-t{ font-size:34px; }
    .yzc-wx-emo{ font-size:32px; }
    .yzc-wx-day{ grid-template-columns:minmax(0, 1fr) 24px 46px auto; gap:6px; font-size:13px; }
    .yzc-wx-dt{ min-width:66px; gap:6px; }
    .yzc-ag-acts{ padding-left:0; }
}
@media (prefers-reduced-motion: reduce){
    .yzc{ animation:none !important; }
    .yzc-pc-ph img{ transition:none !important; }
}

/* ============================================================================
   «НОВОСТИ» · ЛИЧНАЯ ПОДБОРКА · 21.10.2026
   Карточки news / news_setup / news_suggest и окно «Настроить» (ai_portal.js,
   блок «НОВОСТИ»). Только токены темы — amber/cloud/midnight сами.
   ОТКАТ: удалить блок до «СТАБИЛЬНАЯ ЗОНА ВВОДА».
   ========================================================================== */
.yzc-news{ padding:14px 14px 8px; }
.yzc-news .yzc-head{ margin-bottom:4px; }
.yzc-news .yzc-title{ flex:0 0 auto; max-width:70%; }
.yzc-news .yzc-sub{ flex:1 1 auto; }
.yzc-nw-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.yzc-nw{
    position:relative; padding:11px 2px 12px; border-top:1px solid var(--yz-border, rgba(255,255,255,.08));
    transition:opacity .22s ease;
}
.yzc-nw:first-child{ border-top:0; }
.yzc-nw.is-busy{ opacity:.55; pointer-events:none; }
.yzc-nw.is-fading{ opacity:0; }
.yzc-nw.is-gone{ display:none; }
.yzc-nw.is-muted .yzc-nw-in{ display:none; }
.yzc-nw.is-muted{ padding:8px 2px; }
.yzc-nw-meta{ display:flex; align-items:center; gap:0; min-width:0; min-height:24px; font-size:12px; color:var(--yz-muted, #8d8878); }
.yzc-nw-src{ font-weight:600; color:var(--yz-dim, #a8a397); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; max-width:55%; }
.yzc-nw-time, .yzc-nw-tp{ white-space:nowrap; flex:0 0 auto; }
.yzc-nw-src + .yzc-nw-time::before, .yzc-nw-meta > * + .yzc-nw-tp::before{ content:"·"; margin:0 6px; opacity:.8; }
.yzc-nw-tp{ overflow:hidden; text-overflow:ellipsis; max-width:34%; flex:0 1 auto; }
.yzc-nw-more{
    margin-left:auto; flex:0 0 32px; width:32px; height:28px; margin-right:-6px; border:0; border-radius:9px;
    background:transparent; color:var(--yz-muted, #8d8878); cursor:pointer; font-size:14px;
    display:inline-flex; align-items:center; justify-content:center; transition:background .15s, color .15s;
}
.yzc-nw-more:hover, .yzc-nw.menu-open .yzc-nw-more{ background:var(--yz-surface-2, #2E2C29); color:var(--yz-text); }
.yzc-nw-tx{ margin:3px 0 0; font-size:14.5px; line-height:1.45; color:var(--yz-text); overflow-wrap:anywhere; }
.yzc-nw-acts{ display:flex; align-items:center; flex-wrap:wrap; gap:4px 12px; margin-top:6px; }
.yzc-nw-go{
    display:inline-flex; align-items:center; gap:6px; min-height:28px; font-size:13px; font-weight:600;
    color:var(--yz-accent-hi, #e88a68) !important;
}
.yzc-nw-go i{ font-size:10.5px; opacity:.85; }
.yzc-nw-go:hover{ text-decoration:underline !important; text-underline-offset:3px; }
.yzc-nw-also{ font-size:12px; color:var(--yz-muted, #8d8878); min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.yzc-nw-menu{
    position:absolute; z-index:5; right:0; top:38px; min-width:200px; max-width:min(300px, 86vw); padding:6px;
    border-radius:14px; background:var(--yz-surface, #22211F); border:1px solid var(--yz-border-strong, rgba(255,255,255,.17));
    box-shadow:var(--yz-shadow-md, 0 10px 30px -12px rgba(0,0,0,.55)); animation:yzcIn .18s var(--ap-ease) both;
}
.yzc-nw-mi{
    display:flex; align-items:center; gap:10px; width:100%; min-height:40px; padding:0 12px; border:0; border-radius:10px;
    background:transparent; color:var(--yz-text); font-family:var(--ap-sans); font-size:13.5px; text-align:left; cursor:pointer;
}
.yzc-nw-mi span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.yzc-nw-mi i{ color:var(--yz-muted, #8d8878); font-size:13px; flex:0 0 16px; }
.yzc-nw-mi:hover, .yzc-nw-mi:focus-visible{ background:var(--yz-surface-2, #2E2C29); }
.yzc-nw-undo{ display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12.5px; color:var(--yz-muted, #8d8878); animation:yzcIn .25s var(--ap-ease) both; }
.yzc-nw-undo span{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.yzc-nw-undo .yzc-btn{ flex:0 0 auto; gap:6px; }
.yzc-nw-empty{ display:flex; flex-direction:column; gap:3px; padding:8px 2px 10px; font-size:13px; line-height:1.5; color:var(--yz-dim, #a8a397); }
.yzc-nw-empty b{ font-size:14.5px; color:var(--yz-text); font-weight:650; }
.yzc-nw-note{ font-size:12px; color:var(--yz-muted, #8d8878); }
.yzc-nw-foot{ margin:2px 0 4px; padding-top:8px; border-top:1px solid var(--yz-border, rgba(255,255,255,.08)); gap:6px 10px; }
.yzc-nw-foot .yzc-btn.link{ padding:0 6px 0 2px; gap:7px; }
.yzc-nw-follow{ height:32px; padding:0 12px; font-size:12.5px; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.yzc-nw-follow.is-done{ color:var(--yz-success, #58a76b) !important; border-color:transparent; }

/* форма настроек */
.yzc-ns-lead{ margin:0 2px 12px; font-size:13.5px; line-height:1.5; color:var(--yz-dim, #a8a397); }
.yzc-nset.is-compact{ display:flex; flex-wrap:wrap; align-items:center; gap:4px 12px; }
.yzc-nset.is-compact .yzc-head{ flex:1 0 100%; margin-bottom:0; }
.yzc-nset.is-compact .yzc-ns-lead{ flex:1 1 180px; margin:0 2px; }
.yzc-ns{ display:flex; flex-direction:column; }
.yzc-ns-l{
    display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin:14px 2px 8px;
    font-size:11.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--yz-muted, #8d8878);
}
.yzc-ns > .yzc-ns-l:first-child{ margin-top:0; }
.yzc-ns-cnt{ letter-spacing:0; text-transform:none; font-weight:500; font-variant-numeric:tabular-nums; }
.yzc-ns-chips{ display:flex; flex-wrap:wrap; gap:7px; }
.yzc-ns-chip{
    display:inline-flex; align-items:center; gap:6px; height:36px; padding:0 13px; border-radius:999px;
    border:1px solid var(--yz-border-strong, rgba(255,255,255,.17)); background:transparent; color:var(--yz-text);
    font-family:var(--ap-sans); font-size:13.5px; cursor:pointer;
    transition:background .16s ease, border-color .16s ease, color .16s ease, transform .14s var(--ap-spring);
}
.yzc-ns-chip i{ display:none; font-size:11px; }
.yzc-ns-chip:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.yzc-ns-chip:active{ transform:scale(.96); }
.yzc-ns-chip[aria-pressed="true"]{ background:var(--yz-accent-soft, rgba(217,119,87,.14)); border-color:var(--yz-accent-line, rgba(217,119,87,.42)); color:var(--yz-accent-hi, #e88a68); font-weight:600; }
.yzc-ns-chip[aria-pressed="true"] i{ display:inline-block; }
.yzc-ns-badge{ font-size:10px; font-weight:600; letter-spacing:.04em; padding:2px 6px; border-radius:6px; background:var(--yz-surface-2, #2E2C29); color:var(--yz-muted, #8d8878); }
.yzc-ns-pills{ display:flex; flex-wrap:wrap; gap:6px; }
.yzc-ns-pills:not(:empty){ margin-bottom:8px; }
.yzc-ns-pill{
    display:inline-flex; align-items:center; gap:2px; max-width:100%; height:34px; padding:0 2px 0 12px; border-radius:999px;
    background:var(--yz-surface-2, #2E2C29); border:1px solid var(--yz-border, rgba(255,255,255,.08)); font-size:13.5px; color:var(--yz-text);
}
.yzc-ns-pt{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.yzc-ns-px{
    flex:0 0 30px; width:30px; height:30px; border:0; border-radius:50%; background:transparent; cursor:pointer;
    color:var(--yz-muted, #8d8878); font-size:13px; display:inline-flex; align-items:center; justify-content:center;
}
.yzc-ns-px:hover{ color:var(--yz-danger, #e5484d); }
.yzc-ns-px[disabled]{ opacity:.5; cursor:default; }
.yzc-ns-pill.is-mute .yzc-ns-pt{ color:var(--yz-dim, #a8a397); }
.yzc-ns-add{ display:flex; gap:8px; }
.yzc-ns-in, .yzc-ns-ti{
    flex:1 1 auto; min-width:0; height:42px; padding:0 14px; border-radius:13px; box-sizing:border-box;
    background:var(--yz-bg, #0F0E0D); border:1px solid var(--yz-border-strong, rgba(255,255,255,.17)); color:var(--yz-text);
    font-family:var(--ap-sans); font-size:16px; outline:none; transition:border-color .2s, box-shadow .2s;
}
.yzc-ns-in::placeholder{ color:var(--yz-muted, #8d8878); }
.yzc-ns-in:focus, .yzc-ns-ti:focus{ border-color:var(--yz-accent-line); box-shadow:0 0 0 3px var(--yz-accent-soft); }
.yzc-ns-in[disabled]{ opacity:.6; }
.yzc-ns-addb{ flex:0 0 auto; height:42px; border-radius:13px; }
.yzc-ns-hint{ margin:7px 2px 0; font-size:12px; line-height:1.45; color:var(--yz-muted, #8d8878); }
.yzc-ns-hint:empty{ display:none; }
.yzc-ns-push{
    display:flex; align-items:center; gap:12px; margin-top:16px; padding:12px 12px 12px 14px; border-radius:15px;
    background:var(--yz-surface-2, #2E2C29); border:1px solid var(--yz-border, rgba(255,255,255,.08));
}
.yzc-ns-ptx{ flex:1 1 auto; display:flex; flex-direction:column; gap:2px; min-width:0; }
.yzc-ns-ptx b{ font-size:14px; font-weight:600; color:var(--yz-text); }
.yzc-ns-ptx span{ font-size:12px; color:var(--yz-muted, #8d8878); }
.yzc-sw{
    position:relative; flex:0 0 48px; width:48px; height:28px; border-radius:999px; border:0; cursor:pointer; padding:0;
    background:var(--yz-border-strong, rgba(255,255,255,.17)); transition:background .2s ease;
}
.yzc-sw-k{
    position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:#fff;
    box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .22s var(--ap-spring);
}
.yzc-sw[aria-checked="true"]{ background:var(--yz-accent, #d97757); }
.yzc-sw[aria-checked="true"] .yzc-sw-k{ transform:translateX(20px); }
.yzc-ns-time{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin:8px 2px 0; font-size:13.5px; color:var(--yz-dim, #a8a397); }
.yzc-ns-time[hidden]{ display:none; }
.yzc-ns-ti{ flex:0 0 auto; width:auto; min-width:118px; max-width:150px; padding:0 10px 0 12px; font-variant-numeric:tabular-nums; }
html[data-yz-theme="amber"] .yzc-ns-ti, html[data-yz-theme="midnight"] .yzc-ns-ti, html:not([data-yz-theme]) .yzc-ns-ti{ color-scheme:dark; }
.yzc-ns-err{ margin:10px 2px 0; font-size:13px; color:var(--yz-danger, #e5484d); }
.yzc-ns-err:empty{ display:none; }
.yzc-ns-go{ display:flex; margin-top:14px; }
.yzc-ns-save{ flex:1 1 auto; height:44px; border-radius:13px; font-size:14.5px; }
@media (min-width:641px){ .yzc-ns-save{ flex:0 0 auto; padding:0 26px; } }
.yzc-ns-done{ display:flex; align-items:center; gap:12px; animation:yzcIn .3s var(--ap-ease) both; }
.yzc-ns-ok{
    flex:0 0 36px; width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center;
    background:var(--yz-accent-soft, rgba(217,119,87,.14)); color:var(--yz-accent-hi, #e88a68); font-size:14px;
}
.yzc-ns-dtx{ flex:1 1 auto; display:flex; flex-direction:column; gap:2px; min-width:0; }
.yzc-ns-dtx b{ font-size:14px; font-weight:650; }
.yzc-ns-dtx span{ font-size:12.5px; color:var(--yz-dim, #a8a397); overflow-wrap:anywhere; }

/* «Похоже, вам интересно…» */
.yzc-nsug{ display:flex; align-items:center; flex-wrap:wrap; gap:10px 12px; padding:12px 14px; }
.yzc-nsug-ico{ flex:0 0 auto; font-size:18px; line-height:1; }
.yzc-nsug-tx{ flex:1 1 180px; min-width:0; font-size:14px; line-height:1.45; }
.yzc-nsug-acts{ display:flex; gap:6px; margin-left:auto; }
.yzc-nsug-acts .yzc-btn{ min-width:56px; }
.yzc-nsug.is-answered .yzc-nsug-tx{ color:var(--yz-dim, #a8a397); }
.yzc-nsug.in-modal{ margin-bottom:14px; background:var(--yz-surface-2, #2E2C29); animation:none; }

/* окно «Новости» и раздел в «Мои агенты» */
.ap-news-card{ max-width:460px; }
.ap-news-card .ap-modal-btn-row{ position:sticky; bottom:-24px; margin:18px -24px -24px; padding:14px 24px 24px; background:var(--yz-surface, #22211F); border-top:1px solid var(--yz-border, rgba(255,255,255,.08)); }
.ap-news-card .ap-btn[hidden]{ display:none; }
.ap-ag-news{ margin:0 0 14px; }
.ap-ag-news:empty{ display:none; }
.ap-ag-nset{ flex:0 0 auto; height:34px; padding:0 12px; gap:7px; }

html[data-yz-theme="cloud"] .yzc-nw-menu{ background:#fff; box-shadow:0 14px 34px -14px rgba(60,50,35,.3); }
html[data-yz-theme="cloud"] .yzc-nw-mi:hover, html[data-yz-theme="cloud"] .yzc-nw-mi:focus-visible,
html[data-yz-theme="cloud"] .yzc-nw-more:hover, html[data-yz-theme="cloud"] .yzc-nw.menu-open .yzc-nw-more{ background:var(--yz-bg, #f4f2ec); }
html[data-yz-theme="cloud"] .yzc-ns-pill, html[data-yz-theme="cloud"] .yzc-ns-push,
html[data-yz-theme="cloud"] .yzc-nsug.in-modal, html[data-yz-theme="cloud"] .yzc-ns-badge{ background:var(--yz-bg, #f4f2ec); }
html[data-yz-theme="cloud"] .yzc-ns-in, html[data-yz-theme="cloud"] .yzc-ns-ti{ background:#fff; }
html[data-yz-theme="cloud"] .yzc-sw{ background:rgba(35,32,25,.18); }
html[data-yz-theme="cloud"] .yzc-sw[aria-checked="true"]{ background:var(--yz-accent); }
html[data-yz-theme="midnight"] .yzc-sw[aria-checked="true"] .yzc-sw-k{ background:#101319; }

/* ── Новость: заголовок / одна строка сути / мета · «Разобрать» · 21.10.2026 ──────────
   ОТКАТ: удалить блок до «конец блока новостей 21.10.2026» и вернуть
   .yzc-nw-tx/.yzc-nw-meta из /tmp/claude-0/news2/fe_bak/ai_portal.css. */
.yzc-nw-top{ display:flex; align-items:flex-start; gap:6px; min-width:0; }
.yzc-nw-h{
    flex:1 1 auto; min-width:0; margin:0; font-size:15px; line-height:1.36; font-weight:650; color:var(--yz-text);
    letter-spacing:-.005em; overflow-wrap:anywhere;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.yzc-nw-top .yzc-nw-more{ margin:-4px -6px 0 0; }
.yzc-nw-tx{
    margin:4px 0 0; font-size:13.5px; line-height:1.45; color:var(--yz-dim, #a8a397);
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.yzc-nw-meta{ margin-top:5px; min-height:18px; font-size:12px; line-height:1.3; }
.yzc-nw-src{ font-weight:600; color:var(--yz-dim, #a8a397); flex:0 0 auto; max-width:48%; }
.yzc-nw-meta > * + *::before{ content:"·"; margin:0 6px; opacity:.8; }
.yzc-nw-seen{ flex:0 0 auto; white-space:nowrap; }
.yzc-nw-also{ flex:0 1 auto; }
.yzc-nw-acts{ gap:6px 14px; margin-top:8px; }
.yzc-nw-ex{
    display:inline-flex; align-items:center; gap:7px; height:32px; padding:0 13px; border-radius:10px;
    border:1px solid var(--yz-accent-line, rgba(217,119,87,.42)); background:var(--yz-accent-soft, rgba(217,119,87,.14));
    color:var(--yz-accent-hi, #e88a68); font-family:var(--ap-sans); font-size:13px; font-weight:650; line-height:1; cursor:pointer;
    transition:background .16s ease, border-color .16s ease, transform .14s var(--ap-spring);
}
.yzc-nw-ex i{ font-size:12px; }
.yzc-nw-ex:hover{ background:var(--yz-accent, #d97757); border-color:var(--yz-accent, #d97757); color:#fff; }
.yzc-nw-ex:active{ transform:scale(.96); }
.yzc-nw-ex:focus-visible, .yzc-nw-go:focus-visible, .yzc-nsrc:focus-visible{ outline:2px solid var(--yz-accent, #d97757); outline-offset:2px; }
.yzc-nw-ex.is-asked{ opacity:.7; }
.yzc-nw-go{ min-height:32px; font-size:12.5px; font-weight:500; gap:4px; color:var(--yz-muted, #8d8878) !important; }
.yzc-nw-go:hover{ color:var(--yz-text) !important; }
.yzc-nw-arr{ font-size:12px; }
/* «видели» — главное за день, когда нового нет */
.yzc-nw.is-seen .yzc-nw-h{ font-weight:600; color:var(--yz-dim, #a8a397); }
.yzc-nw-nonew{
    display:flex; align-items:flex-start; gap:10px; margin:6px 0 4px; padding:10px 12px; border-radius:12px;
    background:var(--yz-surface-2, #2E2C29); font-size:12.5px; line-height:1.45; color:var(--yz-dim, #a8a397);
}
.yzc-nw-nonew > i{ color:var(--yz-success, #58a76b); font-size:15px; margin-top:1px; flex:0 0 auto; }
.yzc-nw-nonew-tx{ display:flex; flex-direction:column; gap:1px; min-width:0; }
.yzc-nw-nonew-tx b{ font-size:14px; font-weight:650; color:var(--yz-text); }
/* карточка оригинала под разбором */
.yzc-nsrc{ display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:14px; color:var(--yz-text) !important; transition:border-color .16s ease, background .16s ease; }
a.yzc-nsrc{ text-decoration:none !important; }
a.yzc-nsrc:hover{ border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.yzc-nsrc-ic{ flex:0 0 36px; width:36px; height:36px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center; background:var(--yz-surface-2, #2E2C29); color:var(--yz-accent-hi, #e88a68); font-size:15px; }
.yzc-nsrc-bd{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:2px; }
.yzc-nsrc-meta{ display:flex; align-items:center; min-width:0; font-size:11.5px; color:var(--yz-muted, #8d8878); white-space:nowrap; overflow:hidden; }
.yzc-nsrc-meta > * + *::before{ content:"·"; margin:0 5px; opacity:.8; }
.yzc-nsrc-k{ text-transform:uppercase; letter-spacing:.04em; font-weight:650; font-size:10.5px; }
.yzc-nsrc-src{ font-weight:600; color:var(--yz-dim, #a8a397); overflow:hidden; text-overflow:ellipsis; min-width:0; }
.yzc-nsrc-t{ font-size:13.5px; line-height:1.38; font-weight:600; overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.yzc-nsrc-go{ flex:0 0 auto; font-size:15px; color:var(--yz-muted, #8d8878); }
html[data-yz-theme="cloud"] .yzc-nw-nonew, html[data-yz-theme="cloud"] .yzc-nsrc-ic{ background:var(--yz-bg, #f4f2ec); }
html[data-yz-theme="cloud"] .yzc-nw-ex{ background:rgba(217,119,87,.10); }
html[data-yz-theme="cloud"] .yzc-nw-ex:hover{ background:var(--yz-accent, #d97757); }
@media (max-width:360px){
    .yzc-nw-h{ font-size:14.5px; }
    .yzc-nw-tx{ font-size:13px; }
}
@media (prefers-reduced-motion: reduce){
    .yzc-nw-ex, .yzc-nsrc{ transition:none !important; }
}
/* конец блока новостей 21.10.2026 */

@media (max-width:440px){
    .yzc-nw-tp{ display:none; }   /* тема видна в шапке; на телефоне в строке источника — лишний шум */
}
@media (max-width:360px){
    .yzc-news{ padding:12px 12px 6px; }
    .yzc-nw-tx{ font-size:14px; }
    .yzc-ns-chip{ height:34px; padding:0 11px; font-size:13px; }
    .yzc-ns-addb span{ display:none; }
    .yzc-ns-addb{ width:42px; padding:0; }
}
@media (prefers-reduced-motion: reduce){
    .yzc-nw, .yzc-nw-menu, .yzc-nw-undo, .yzc-ns-done, .yzc-sw, .yzc-sw-k, .yzc-ns-chip{ transition:none !important; animation:none !important; }
}

/* ============================================================================
   СТАБИЛЬНАЯ ЗОНА ВВОДА · 20.10.2026
   ----------------------------------------------------------------------------
   Жалобы с телефона: «какая-то тень над полем», «дёргается при прокрутке»,
   «кнопка отправить дёргается и отправляет со второго раза».
   1) Поле росло на 18 px с первой буквы: textarea была content-box, а JS
      ставит height = scrollHeight (в нём уже есть padding). Теперь border-box.
   2) Кнопки у поля — одна фиксированная коробка 38×38 (стоп был 42×42),
      без пружинного transition:all — замена микрофон/отправить/стоп не
      сдвигает поле.
   3) Ряд агентов не ужимается при фокусе (раньше менял высоту под пальцем).
   4) Вместо полосы-градиента 46 px над прозрачной зоной (сквозь которую
      под полем просвечивал текст) — сама зона непрозрачна, мягкий переход
      24 px только у верхнего края. Тени у капсулы почти нет.
   5) Сверху — такой же тонкий переход под шапкой; на сенсорных экранах без
      backdrop-filter поверх бегущего текста (это и давало рывки на скролле).
   6) Пока шторка открыта, страница под ней не прокручивается и не тянет
      адресную строку (из-за неё менялась 100dvh и прыгала вся шторка).
   Всё, что меняется во время прокрутки, — только opacity/transform.
   ОТКАТ: удалить блок до конца файла.
   ========================================================================== */
.ap-agents-row[hidden]{ display:none !important; }

/* Класс ставит floating_nav.js при открытии (20.10.2026). Было
   html:has(body.ai-overlay-active) — :has() на корне заставлял браузер
   пересчитывать стили всего документа при смене класса body в кадре открытия. */
html.ap-ov-lock{ overflow:hidden; overscroll-behavior:none; }
body.ai-overlay-active{ overscroll-behavior:none; }

.ai-overlay-modal .ap-input-wrapper textarea{ box-sizing:border-box; }

.ai-overlay-modal .ap-input-wrapper > button,
.ai-overlay-modal #ap-halt-btn{
    width:38px; height:38px; flex:0 0 38px; box-sizing:border-box;
    transition:background-color .16s ease, color .16s ease, filter .16s ease, transform .12s ease;
}
.ai-overlay-modal #ap-halt-btn{ font-size:13px; }
.ai-overlay-modal #ch-send-btn:active,
.ai-overlay-modal #ap-halt-btn:active{ transform:scale(.94); }
.ai-overlay-modal .ap-input-wrapper button{ -webkit-tap-highlight-color:transparent; touch-action:manipulation; }

/* Капсула: без тёмного ореола, только тонкая рамка */
.ai-overlay-modal .ap-input-wrapper,
.ai-overlay-modal .ap-input-wrapper:focus-within{ box-shadow:0 1px 2px rgba(0,0,0,.10); }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-input-wrapper{ box-shadow:0 2px 10px -4px rgba(35,32,25,.14); }

/* Зона ввода: непрозрачная, мягкий край 24 px сверху */
.ai-overlay-modal .ap-input-zone{
    background:linear-gradient(180deg, transparent 0, var(--yz-bg, #0F0E0D) 24px);
    padding-top:22px;
}
.ai-overlay-modal .ap-input-zone::before{ content:none; display:none; }
.ai-overlay-modal .ap-thread{ padding-bottom:146px; }
.ai-overlay-modal.ap-has-agents .ap-thread{ padding-bottom:190px; }
.ai-overlay-modal .ap-jump{ bottom:calc(var(--safe-bottom, 0px) + 112px); }
.ai-overlay-modal.ap-has-agents .ap-jump{ bottom:calc(var(--safe-bottom, 0px) + 158px); }
body.ap-agents-on.ai-overlay-active .ap-toast{ bottom:calc(var(--safe-bottom, 0px) + 204px); }

/* Ряд агентов одной высоты в любом состоянии поля */
@media (max-width:800px){
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agent-chip{ height:34px; font-size:13px; padding:0 13px 0 10px; }
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agents-row{ padding-bottom:9px; }
}
@media (max-width:360px){
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agent-chip{ height:32px; font-size:12.5px; padding:0 11px 0 9px; }
}

/* Шапка: тонкий переход, чтобы текст не лез под кнопки */
.ai-overlay-modal .ap-topbar::before{
    content:''; position:absolute; left:0; right:0; top:0; bottom:-16px; z-index:-1; pointer-events:none;
    background:linear-gradient(180deg, var(--yz-bg, #0F0E0D) 0, var(--yz-bg, #0F0E0D) 55%, transparent);
}
@media (hover:none), (max-width:800px){
    .ai-overlay-modal .ap-topbar .ap-icon-btn,
    .ai-overlay-modal .ap-who{
        -webkit-backdrop-filter:none; backdrop-filter:none;
        background:var(--yz-surface, #22211F);
    }
}
.ai-overlay-modal.ap-has-agents .ap-welcome.ap-quiet{ min-height:calc(100dvh - 282px); }


/* ============================================================================
   СПОКОЙНЫЙ ПРЕМИУМ · редизайн шторки · 20.10.2026
   ----------------------------------------------------------------------------
   Просьба: «шторку — более приятной и крутой, по датам разбивка».
   • Диалоги: группы по датам (разметку строит AiPortal.loadHistoryPanel →
     .ap-hist-group), компактные строки «название · время», лёгкие «Стиль» и
     «Позвать друга», «Новый диалог» — ровная кнопка без градиента и свечения.
   • Лента: ответ ИИ без коробок, аватар маленький над текстом; сообщение
     человека — мягкий пузырь без аватара; панель действий тише; подписи дней
     (.ap-day-sep) при открытии старого диалога.
   • Док: ряд агентов и поле ввода — одна карточка; подпись под ней вынесена
     из потока (не двигает поле ни при фокусе, ни при блюре).
   • Карточки ответа и стартовые плитки — общий радиус 20/14/12.
   Все прежние id/классы на месте. Цвета — только токены темы.
   ОТКАТ: удалить блок до конца файла (+ JS-методы histDateInfo/histTidyGroups/
   dayKeyOf/dayLabelLong/appendDaySep/daySepLive и порядок кнопок в
   includes/floating_nav.php).
   ========================================================================== */
.ai-overlay-modal{
    --ap-r-lg:20px; --ap-r-md:14px; --ap-r-sm:10px;
    --ap-line:rgba(250,249,245,.10);
    --ap-line:color-mix(in srgb, var(--yz-text, #faf9f5) 10%, transparent);
    --ap-hover:rgba(250,249,245,.05);
    --ap-hover:color-mix(in srgb, var(--yz-text, #faf9f5) 6%, transparent);
    --ap-press:color-mix(in srgb, var(--yz-text, #faf9f5) 10%, transparent);
    --ap-dock:var(--yz-surface, #22211F);
    --ap-chip:color-mix(in srgb, var(--yz-text, #faf9f5) 6%, var(--yz-surface, #22211F));
    --ap-card:var(--yz-surface, #22211F);
    --ap-panel:color-mix(in srgb, var(--yz-surface, #22211F) 50%, var(--yz-bg, #0F0E0D));
    --ap-bubble:color-mix(in srgb, var(--yz-accent, #d97757) 13%, var(--yz-surface, #22211F));
    --ap-on-accent:#fff;
    --ap-dock-shadow:0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -18px rgba(0,0,0,.7);
}
html[data-yz-theme="cloud"] .ai-overlay-modal{
    --ap-dock:#fff; --ap-card:#fff;
    --ap-chip:var(--yz-bg, #f4f2ec);
    --ap-panel:var(--yz-surface-2, #faf9f4);
    --ap-bubble:color-mix(in srgb, var(--yz-accent, #c96543) 11%, #fff);
    --ap-line:rgba(35,32,25,.11);
    --ap-dock-shadow:0 10px 28px -16px rgba(60,50,35,.28);
}
html[data-yz-theme="midnight"] .ai-overlay-modal{ --ap-on-accent:#1b1607; }

/* ─── Лента ─────────────────────────────────────────────────────────── */
.ai-overlay-modal .ap-thread{ gap:22px; padding-left:18px; padding-right:18px; }

/* Ответ ИИ: аватар 28 px над текстом (раньше обтекание — заголовок ответа
   вставал рядом с аватаром, а первая строка уезжала вправо). */
.ai-overlay-modal .ap-msg.ai{ padding:0; }
.ai-overlay-modal .ap-msg.ai .ap-msg-body{
    display:flex; flex-wrap:wrap; align-items:center; column-gap:10px;
}
.ai-overlay-modal .ap-msg.ai .ap-msg-body > *{ flex:1 1 100%; min-width:0; }
.ai-overlay-modal .ap-msg.ai .ap-msg-body > .ap-ai-avatar{
    flex:0 0 auto; float:none; shape-outside:none;
    width:28px; height:28px; margin:0 0 8px; box-shadow:none;
}
.ai-overlay-modal .ap-msg.ai .ap-ai-avatar svg{ width:14px; height:14px; }
.ai-overlay-modal .ap-msg.ai .ap-ai-avatar .ap-ai-emoji{ right:-4px; bottom:-4px; width:15px; height:15px; font-size:9px; line-height:13px; }
.ai-overlay-modal .ap-msg.ai .ap-msg-body > .ap-bot-label{ flex:0 1 auto; margin:0 0 8px; }
.ai-overlay-modal .ap-msg.ai.is-thinking .ap-msg-body > .ap-thinking-line{ flex:1 1 0; padding-top:0; margin-bottom:8px; min-height:28px; }
.ai-overlay-modal .ap-msg.ai .ap-msg-text{ font-size:16.5px; line-height:1.66; }
@media (max-width:800px){
    .ai-overlay-modal .ap-msg.ai .ap-msg-text{ font-size:16px; line-height:1.64; }
}

/* Сообщение человека: мягкий пузырь, без аватара — справа и так понятно, кто это */
.ai-overlay-modal .ap-msg.user .ap-user-avatar{ display:none; }
.ai-overlay-modal .ap-msg.user .ap-msg-card{ gap:0; }
.ai-overlay-modal .ap-msg.user .ap-msg-text:not(.has-attach),
.ai-overlay-modal .ap-msg.user .ap-u-txt{
    background:var(--ap-bubble); border:1px solid transparent;
    border-radius:20px 20px 6px 20px; padding:10px 15px;
    font-family:var(--ap-sans); font-size:15.5px; line-height:1.5; color:var(--yz-text);
}
.ai-overlay-modal .ap-msg.user .ap-msg-text:not(.has-attach){ max-width:min(84%, 560px); }
.ai-overlay-modal .ap-msg.user .ap-msg-text.has-attach{ max-width:min(84%, 560px); }

/* Панель действий: тише и мельче */
.ai-overlay-modal .ap-action-bar{ gap:2px; margin-top:6px; }
.ai-overlay-modal .ap-ab-btn{
    height:30px; min-width:30px; padding:0 7px; border-radius:9px;
    font-size:12.5px; color:var(--yz-muted, #8d8878);
    transition:background-color .15s ease, color .15s ease, opacity .15s ease;
}
.ai-overlay-modal .ap-ab-btn:hover{ background:var(--ap-hover); color:var(--yz-text); }
.ai-overlay-modal .ap-ab-btn:active{ transform:none; background:var(--ap-press); }
@media (max-width:800px){
    .ai-overlay-modal .ap-msg.ai .ap-action-bar{ opacity:.8; }
    .ai-overlay-modal .ap-msg.user .ap-action-bar{ opacity:.55; margin-top:4px; }
}

/* Подпись дня между сообщениями */
.ap-day-sep{
    display:flex; align-items:center; gap:12px; margin:2px 0 -4px;
    font:600 11.5px/1.2 var(--ap-sans); letter-spacing:.02em; color:var(--yz-muted, #8d8878);
    animation:apFadeUp .4s var(--ap-ease) both;
}
.ap-day-sep::before, .ap-day-sep::after{ content:''; flex:1 1 auto; height:1px; background:var(--yz-border, rgba(250,249,245,.08)); }
.ap-day-sep span{ display:inline-block; white-space:nowrap; }
.ap-day-sep span::first-letter{ text-transform:uppercase; }

/* ─── Пустой экран ──────────────────────────────────────────────────── */
.ai-overlay-modal .ap-welcome.ap-quiet .ap-q-hi{ font-size:clamp(30px, 8.8vw, 40px); line-height:1.08; }
.ai-overlay-modal .ap-quiet .ap-q-sub{ margin-top:2px; }
.ai-overlay-modal .ap-starters{ gap:10px; margin-top:24px; }
.ai-overlay-modal .ap-starter{
    --tile:var(--yz-accent, #d97757);
    flex-direction:column; align-items:flex-start; justify-content:space-between; gap:14px;
    min-height:98px; padding:14px 14px 13px; border-radius:var(--ap-r-lg);
    background:var(--ap-card); border:1px solid var(--yz-border, rgba(250,249,245,.08));
    font-size:14px; font-weight:550; line-height:1.28; letter-spacing:-.005em;
    -webkit-tap-highlight-color:transparent;
    transition:border-color .2s ease, background-color .2s ease, transform .18s var(--ap-ease);
}
.ai-overlay-modal .ap-starter:nth-child(1){ --tile:#e2b13c; }
.ai-overlay-modal .ap-starter:nth-child(2){ --tile:#e5695f; }
.ai-overlay-modal .ap-starter:nth-child(3){ --tile:var(--yz-accent, #d97757); }
.ai-overlay-modal .ap-starter:nth-child(4){ --tile:#9a86f0; }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-starter:nth-child(1){ --tile:#c08a12; }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-starter:nth-child(2){ --tile:#d0473d; }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-starter:nth-child(4){ --tile:#6f5bd6; }
.ai-overlay-modal .ap-starter i{
    width:36px; height:36px; border-radius:12px; display:grid; place-items:center;
    font-size:15px; color:var(--tile);
    background:rgba(217,119,87,.14);
    background:color-mix(in srgb, var(--tile) 15%, transparent);
}
.ai-overlay-modal .ap-starter:hover{
    transform:translateY(-2px); background:var(--ap-card);
    border-color:color-mix(in srgb, var(--tile) 45%, transparent);
}
.ai-overlay-modal .ap-starter:active{ transform:scale(.97); background:var(--ap-chip); }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-starter{ background:#fff; box-shadow:0 1px 2px rgba(60,50,35,.05); }
@media (hover:none){ .ai-overlay-modal .ap-starter:hover{ transform:none; } }
.ai-overlay-modal .ap-memline{ background:transparent; border-color:var(--ap-line); }

/* ─── Док: ряд агентов + поле — одна карточка ───────────────────────── */
.ai-overlay-modal .ap-input-zone{ padding:22px 12px calc(var(--safe-bottom, 0px) + 28px); }
.ai-overlay-modal .ap-input-inner{
    position:relative;
    background:var(--ap-dock);
    border:1px solid var(--ap-line);
    border-radius:26px; padding:6px;
    box-shadow:var(--ap-dock-shadow);
    transition:border-color .2s ease;
}
.ai-overlay-modal .ap-input-inner:focus-within{
    border-color:rgba(250,249,245,.2);
    border-color:color-mix(in srgb, var(--yz-text, #faf9f5) 20%, transparent);
}
.ai-overlay-modal .ap-input-wrapper,
.ai-overlay-modal .ap-input-wrapper:focus-within,
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-input-wrapper{
    background:transparent; border:0; box-shadow:none; padding:0; border-radius:20px;
}
.ai-overlay-modal .ap-input-wrapper textarea{ padding:9px 6px 9px 4px; }
.ai-overlay-modal .ap-agents-row{ padding:0 0 6px; }
.ai-overlay-modal .ap-agent-chip,
.ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agent-chip{
    height:32px; padding:0 12px 0 9px; font-size:13px; font-weight:500;
    background:var(--ap-chip); border:1px solid transparent; color:var(--yz-text);
}
.ai-overlay-modal .ap-agent-chip:hover{ background:var(--ap-chip); border-color:var(--yz-accent-line, rgba(217,119,87,.42)); }
.ai-overlay-modal .ap-agent-chip:active{ background:var(--ap-press); }
.ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agents-row{ padding-bottom:6px; }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-agent-chip{ background:var(--ap-chip); border-color:transparent; }
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-agent-chip:hover{ background:var(--ap-chip); border-color:var(--yz-accent-line); }
.ai-overlay-modal #ch-send-btn{ color:var(--ap-on-accent); }
/* Подпись — под карточкой, вне потока: фокус/блюр больше не двигают поле */
.ai-overlay-modal .ap-input-note{
    position:absolute; left:0; right:0; top:100%; margin:7px 0 0;
    font-size:11px; line-height:14px; opacity:.65; pointer-events:none;
    transition:opacity .2s ease;
}
@media (max-width:800px){
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-input-note{ display:block; opacity:0; }
}
@media (max-width:360px){
    .ai-overlay-modal .ap-agent-chip,
    .ai-overlay-modal .ap-input-zone.ap-field-focus .ap-agent-chip{ height:30px; padding:0 10px 0 8px; font-size:12.5px; }
}
/* Место под док (замерено: поле 38 + ряд 38 + рамка/отступы) */
.ai-overlay-modal .ap-thread{ padding-bottom:132px; }
.ai-overlay-modal.ap-has-agents .ap-thread{ padding-bottom:170px; }
.ai-overlay-modal .ap-jump{ bottom:calc(var(--safe-bottom, 0px) + 110px); }
.ai-overlay-modal.ap-has-agents .ap-jump{ bottom:calc(var(--safe-bottom, 0px) + 148px); }
body.ap-agents-on.ai-overlay-active .ap-toast{ bottom:calc(var(--safe-bottom, 0px) + 166px); }
.ai-overlay-modal .ap-jump{ background:var(--ap-dock); border-color:var(--ap-line); }

/* ─── Шапка ─────────────────────────────────────────────────────────── */
.ai-overlay-modal .ap-topbar .ap-icon-btn,
.ai-overlay-modal .ap-who{ border-color:var(--ap-line); }
@media (hover:none), (max-width:800px){
    .ai-overlay-modal .ap-topbar .ap-icon-btn,
    .ai-overlay-modal .ap-who{ background:var(--ap-dock); }
}

/* ─── Диалоги ───────────────────────────────────────────────────────── */
.ai-overlay-modal .ap-history-panel{
    width:min(360px, 88vw) !important; max-width:360px;
    background:var(--ap-panel); border-right:1px solid var(--ap-line);
    box-shadow:24px 0 60px -30px rgba(0,0,0,.6);
}
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-history-panel{ box-shadow:24px 0 60px -30px rgba(60,50,35,.35); }
.ai-overlay-modal .ap-history-head{ padding:calc(var(--safe-top, 0px) + 16px) 12px 12px 20px; }
.ai-overlay-modal .ap-history-title{ font-size:21px; letter-spacing:-.01em; }
.ai-overlay-modal .ap-hist-x{
    width:36px; height:36px; border-radius:12px; border:0; background:transparent; color:var(--yz-dim);
}
.ai-overlay-modal .ap-hist-x:hover{ background:var(--ap-hover); border-color:transparent; color:var(--yz-text); }
.ai-overlay-modal .ap-history-list{ gap:0; padding:0 10px calc(var(--safe-bottom, 0px) + 24px); overscroll-behavior:contain; }

.ai-overlay-modal .ap-new-chat-btn{
    margin:0 4px 10px; height:44px; border-radius:var(--ap-r-md);
    background:var(--yz-accent, #d97757); color:var(--ap-on-accent);
    font-size:14px; font-weight:600; letter-spacing:0;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.16), 0 1px 2px rgba(0,0,0,.18);
    transition:filter .16s ease, transform .12s ease;
}
.ai-overlay-modal .ap-new-chat-btn i{ width:auto; height:auto; background:none; font-size:13px; }
.ai-overlay-modal .ap-new-chat-btn:hover{ filter:brightness(1.06); transform:none; box-shadow:inset 0 1px 0 rgba(255,255,255,.16), 0 1px 2px rgba(0,0,0,.18); }
.ai-overlay-modal .ap-new-chat-btn:active{ transform:scale(.98); }

.ai-overlay-modal .ap-hist-actions{ gap:6px; margin:0 4px 6px; }
.ai-overlay-modal .ap-hist-chip{
    height:36px; border-radius:var(--ap-r-sm); gap:6px;
    background:transparent; border:1px solid var(--ap-line);
    color:var(--yz-dim); font-size:12.5px; font-weight:500;
    transition:background-color .15s ease, color .15s ease;
}
.ai-overlay-modal .ap-hist-chip:hover{ background:var(--ap-hover); border-color:var(--ap-line); color:var(--yz-text); }
.ai-overlay-modal .ap-hist-chip i{ color:var(--yz-muted); font-size:12px; }
.ai-overlay-modal .ap-hist-emoji{ font-size:13px; }

.ai-overlay-modal .ap-hist-items{ gap:1px; }
.ap-hist-group{
    position:sticky; top:0; z-index:2;
    margin:0 -2px; padding:16px 12px 6px;
    background:var(--ap-panel, var(--yz-bg));
    font:600 12px/1.2 var(--ap-sans); letter-spacing:.01em; color:var(--yz-muted, #8d8878);
}
.ap-hist-group[hidden]{ display:none; }
.ap-hist-group.is-pin{ color:var(--yz-accent-hi, #e88a68); }

.ai-overlay-modal .ap-history-item,
.ai-overlay-modal .ap-history-item.has-av,
.ai-overlay-modal .ap-history-item.has-work{
    flex-direction:row; align-items:center; gap:8px;
    box-sizing:border-box; min-height:46px; padding:7px 6px 7px 12px; border-radius:12px;
    background:transparent; border:0; box-shadow:none; line-height:1.3;
    -webkit-tap-highlight-color:transparent;
    transition:background-color .15s ease;
}
.ai-overlay-modal .ap-history-item:hover{ background:var(--ap-hover); transform:none; border-color:transparent; }
.ai-overlay-modal .ap-history-item:active{ background:var(--ap-press); }
.ai-overlay-modal .ap-history-item.pinned::before{ content:none; }
.ai-overlay-modal .ap-history-item.active-session,
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-history-item.active-session{
    background:var(--yz-accent-soft, rgba(217,119,87,.14)); border-color:transparent;
}
.ai-overlay-modal .ap-history-item.active-session::before{
    content:''; position:absolute; left:0; top:11px; bottom:11px; width:3px;
    border-radius:0 3px 3px 0; background:var(--yz-accent, #d97757);
}
.ai-overlay-modal .ap-hi-title{
    order:1; flex:1 1 auto; min-width:0;
    font-family:var(--ap-sans); font-size:14.5px; font-weight:500; letter-spacing:-.005em;
    color:var(--yz-text);
}
.ai-overlay-modal .ap-history-item.active-session .ap-hi-title{ font-weight:600; }
.ai-overlay-modal .ap-hi-date{
    order:2; flex:0 0 auto; padding-right:4px;
    font-size:12px; color:var(--yz-muted); font-variant-numeric:tabular-nums; white-space:nowrap;
}
.ai-overlay-modal .ap-hi-av{ order:0; position:static; transform:none; width:26px; height:26px; flex:0 0 26px; margin-left:-2px; }
.ai-overlay-modal .ap-hi-work,
.ai-overlay-modal .ap-hi-pin{
    position:static; transform:none; flex:0 0 30px; width:30px; height:30px;
    display:grid; place-items:center; border-radius:9px; font-size:12px;
}
.ai-overlay-modal .ap-hi-work{ order:3; }
.ai-overlay-modal .ap-hi-pin{ order:4; opacity:.5; }
.ai-overlay-modal .ap-hi-pin.pinned-on{ transform:rotate(45deg); opacity:1; color:var(--yz-accent, #d97757); }
.ai-overlay-modal .ap-hi-work:hover, .ai-overlay-modal .ap-hi-pin:hover{ background:var(--ap-press); color:var(--yz-text); }
/* Мышь: время справа, при наведении на его месте — действия */
@media (hover:hover){
    .ai-overlay-modal .ap-history-item .ap-hi-work,
    .ai-overlay-modal .ap-history-item .ap-hi-pin:not(.pinned-on){ display:none; }
    .ai-overlay-modal .ap-history-item:hover .ap-hi-work,
    .ai-overlay-modal .ap-history-item:hover .ap-hi-pin{ display:grid; opacity:1; }
    .ai-overlay-modal .ap-history-item:hover .ap-hi-date{ display:none; }
}
/* Палец: время + «⋯»; булавка — в меню «⋯» (в обычном режиме — у строки) */
@media (hover:none){
    .ai-overlay-modal .ap-history-item.has-work .ap-hi-pin:not(.pinned-on){ display:none; }
    .ai-overlay-modal .ap-history-item.pinned .ap-hi-date{ display:none; }
    .ai-overlay-modal .ap-hi-work{ color:var(--yz-muted); opacity:.8; }
}
.ai-overlay-modal .ap-hi-menu{ padding:4px 6px 10px 12px; gap:6px; }
.ai-overlay-modal .ap-hi-menu button{
    height:34px; border-radius:var(--ap-r-sm); border:0; background:var(--ap-hover);
    font-weight:500;
}
.ai-overlay-modal .ap-hi-menu button:hover{ background:var(--ap-press); }
.ai-overlay-modal .ap-hi-menu button i{ font-size:11px; opacity:.8; }
.ai-overlay-modal .ap-load-more{
    margin:8px 4px 0; height:40px; border:0; border-radius:var(--ap-r-sm);
    background:transparent; color:var(--yz-muted); font-weight:500;
}
.ai-overlay-modal .ap-load-more:hover{ background:var(--ap-hover); color:var(--yz-text); }
.ai-overlay-modal .ap-load-more[disabled]{ cursor:default; opacity:.7; }
.ai-overlay-modal .ap-history-empty{ padding:36px 12px; }

/* ─── Карточки ответа: общий радиус и отступы ───────────────────────── */
.ai-overlay-modal .yzc-wrap{ margin:12px 0 2px; gap:10px; }
.ai-overlay-modal .yzc,
html[data-yz-theme="cloud"] .ai-overlay-modal .yzc{
    border-radius:var(--ap-r-lg); padding:16px; background-color:var(--ap-card);
    border:1px solid var(--yz-border, rgba(250,249,245,.08));
}
html[data-yz-theme="cloud"] .ai-overlay-modal .yzc{ box-shadow:0 1px 2px rgba(60,50,35,.05), 0 8px 24px -18px rgba(60,50,35,.25); }
.ai-overlay-modal .yzc-wx,
html[data-yz-theme="cloud"] .ai-overlay-modal .yzc-wx{
    background:radial-gradient(120% 90% at 100% 0%, var(--yz-accent-soft, rgba(217,119,87,.14)), transparent 60%), var(--ap-card);
}
.ai-overlay-modal .yzc-persona{ padding:16px 0; }
.ai-overlay-modal .yzc-persona .yzc-head, .ai-overlay-modal .yzc-persona .yzc-foot{ margin-left:16px; margin-right:16px; }
.ai-overlay-modal .yzc-prow{ padding:0 16px 2px; scroll-padding:0 16px; }
.ai-overlay-modal .yzc-pc{ border-radius:16px; }
.ai-overlay-modal .yzc-btn{ border-radius:12px; }
.ai-overlay-modal .yzc-pc-acts .yzc-btn{ border-radius:10px; }
.ai-overlay-modal .yzc-btn.primary{ color:var(--ap-on-accent) !important; }
.ai-overlay-modal .yzc-ag-ico, .ai-overlay-modal .yzc-create-ico{ border-radius:var(--ap-r-md); }
.ai-overlay-modal .yzc-rt-sym{ border-radius:12px; }
.ai-overlay-modal .yzc-head{ margin-bottom:12px; }
@media (max-width:360px){
    .ai-overlay-modal .yzc{ padding:14px; border-radius:18px; }
    .ai-overlay-modal .yzc-persona{ padding:14px 0; }
    .ai-overlay-modal .yzc-persona .yzc-head, .ai-overlay-modal .yzc-persona .yzc-foot{ margin-left:14px; margin-right:14px; }
    .ai-overlay-modal .yzc-prow{ padding:0 14px 2px; }
}
.ai-overlay-modal .ap-remember{ border-radius:var(--ap-r-md); }

@media (prefers-reduced-motion: reduce){
    .ap-day-sep{ animation:none !important; }
    .ai-overlay-modal .ap-starter:hover{ transform:none; }
}
/* Поле в несколько строк: скрепка и «отправить» — у нижнего края, как в мессенджерах */
.ai-overlay-modal .ap-input-wrapper{ align-items:flex-end; }
/* «Думает»: ровная пульсирующая точка на месте аватара (раньше пульсация
   перебивала scale(.38), и вместо точки висел пустой оранжевый круг) */
@keyframes apThinkDot{ 0%,100%{ transform:scale(.36); opacity:1; } 50%{ transform:scale(.46); opacity:.7; } }
.ai-overlay-modal .ap-msg.ai.is-thinking .ap-msg-body > .ap-ai-avatar{
    transform-origin:center; animation:apThinkDot 1.4s ease-in-out infinite; margin-right:-12px; margin-left:-9px;
}
@media (prefers-reduced-motion: reduce){
    .ai-overlay-modal .ap-msg.ai.is-thinking .ap-msg-body > .ap-ai-avatar{ animation:none !important; transform:scale(.4); }
}
.ai-overlay-modal .ap-msg.ai .ap-msg-text > :first-child{ margin-top:0; }

/* ==========================================================================
   ПЛАВНОСТЬ ШТОРКИ · 20.10.2026
   Жалобы с телефона: «мини-фризы при открытии», «пока печатается ответ —
   дёргается всё», «кнопка отправить дёргается/моргает при наборе и
   стирании». Выезд шторки — в начале файла (transform вместо top).
   ОТКАТ: удалить блок до конца файла (и .ap-act-slot в ai_portal.js →
   injectRuntimeUi / updateInputUI).
   ========================================================================== */

/* 1. Микрофон / отправить / стоп — одна ячейка 38×38, смена перекрёстным
      переходом прозрачности и масштаба. Ширина ряда не меняется никогда. */
.ai-overlay-modal .ap-act-slot{
    position:relative; display:block; flex:0 0 38px; width:38px; height:38px;
    align-self:flex-end;
}
.ai-overlay-modal .ap-act-slot > #ch-mic-btn,
.ai-overlay-modal .ap-act-slot > #ch-send-btn,
.ai-overlay-modal .ap-act-slot > #ap-halt-btn,
.ai-overlay-modal .ap-act-slot > #ch-stop-btn{
    position:absolute; left:0; top:0; margin:0;
    width:38px; height:38px; box-sizing:border-box;
    display:flex !important;             /* старые style.display больше ничего не решают */
    font-size:15px;
    opacity:0; visibility:hidden; pointer-events:none;
    transform:scale(.55);
    animation:none;
    transition:opacity .14s ease, transform .2s cubic-bezier(.2,.8,.2,1), visibility 0s linear .2s,
               background-color .16s ease, color .16s ease, filter .16s ease;
}
.ai-overlay-modal .ap-act-slot > #ap-halt-btn{ font-size:13px; }
.ai-overlay-modal .ap-act-slot[data-act="mic"]  > #ch-mic-btn,
.ai-overlay-modal .ap-act-slot[data-act="send"] > #ch-send-btn,
.ai-overlay-modal .ap-act-slot[data-act="halt"] > #ap-halt-btn,
.ai-overlay-modal .ap-act-slot[data-act="rec"]  > #ch-stop-btn{
    opacity:1; visibility:visible; pointer-events:auto; transform:none;
    transition:opacity .14s ease, transform .2s cubic-bezier(.2,.8,.2,1), visibility 0s,
               background-color .16s ease, color .16s ease, filter .16s ease;
}
.ai-overlay-modal .ap-act-slot[data-act="send"] > #ch-send-btn:active,
.ai-overlay-modal .ap-act-slot[data-act="halt"] > #ap-halt-btn:active{ transform:scale(.94); }
@media (prefers-reduced-motion: reduce){
    .ai-overlay-modal .ap-act-slot > button{ transition:none !important; }
}

/* 2. Каретка печати — в конце последней строки, а не отдельной строкой
      под абзацем: раньше ::after у контейнера вставал после блока <p>,
      добавлял строку высотой 1em и снимал её в конце ответа (скачок). */
@supports selector(:has(*)){
    .ai-overlay-modal .ap-msg-text.ap-typing:has(> *)::after{ content:none; display:none; }
    .ai-overlay-modal .ap-msg-text.ap-typing > :is(p,h1,h2,h3,h4,h5,h6,blockquote):last-child::after,
    .ai-overlay-modal .ap-msg-text.ap-typing > :is(ul,ol):last-child > li:last-child::after{
        content:''; display:inline-block; width:2px; height:1em;
        margin-left:2px; vertical-align:-2px; background:var(--yz-accent);
        animation:apCaret .9s steps(2) infinite;
    }
}
/* 3. Растущий хвост ответа не годится в якорь прокрутки: он
      перерисовывается, и браузер прыгал, выбирая якорь заново. */
.ai-overlay-modal .ap-msg-text.ap-typing > :last-child{ overflow-anchor:none; }


/* ============================================================================
   ДОМ ЯЗМИ · 20.10.2026
   ----------------------------------------------------------------------------
   Пустой экран Язми = тихий экран персонажа (лицо + одна мысль) + быстрые
   агенты прямо под фразой. Ряд над полем ввода убран: чипы нужны только на
   новом диалоге и уходят вместе с экраном (hideIntro) — поле не двигается.
   Появление — только opacity/transform (без blur): на слабом телефоне это
   идёт на композиторе и не спорит с выездом шторки.
   ОТКАТ: удалить блок до конца файла (и вернуть JS/PHP из git drawer2).
   ========================================================================== */
.ai-overlay-modal .ap-home-chips{
    display:flex; flex-direction:column; gap:8px;
    margin-top:26px; max-width:100%;
}
.ai-overlay-modal .ap-home-row{ display:flex; gap:8px; width:max-content; }
/* Телефон: ряды листаются вбок до края экрана, справа — мягкое затухание */
@media (max-width:800px){
    .ai-overlay-modal .ap-home-chips{
        align-self:stretch; max-width:none;
        margin:24px -20px 0; padding:2px 20px 4px;
        overflow-x:auto; overflow-y:hidden;
        scrollbar-width:none; -webkit-overflow-scrolling:touch;
        overscroll-behavior-x:contain; scroll-padding-inline:20px;
        -webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 36px), transparent);
                mask-image:linear-gradient(90deg, #000 calc(100% - 36px), transparent);
    }
    .ai-overlay-modal .ap-home-chips::-webkit-scrollbar{ display:none; }
}
.ai-overlay-modal .ap-home-chips .ap-agent-chip{
    height:36px; padding:0 14px 0 11px; gap:7px;
    font-size:13.5px; font-weight:500; letter-spacing:-.005em;
    color:var(--yz-text);
    background:var(--ap-chip);
    border:1px solid var(--ap-line);
    animation:apHomeChip .5s var(--ap-ease) both;
    animation-delay:calc(.18s + var(--d, 0) * 30ms);
}
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(2){ --d:1; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(3){ --d:2; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(4){ --d:3; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(5){ --d:4; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(6){ --d:5; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(7){ --d:6; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(8){ --d:7; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(9){ --d:8; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:nth-child(n+10){ --d:9; }
.ai-overlay-modal .ap-home-chips .ap-agent-emo{ font-size:15px; }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:hover{
    background:var(--ap-chip); border-color:var(--yz-accent-line, rgba(217,119,87,.42));
}
.ai-overlay-modal .ap-home-chips .ap-agent-chip:active{ transform:scale(.95); background:var(--ap-press, var(--ap-chip)); }
.ai-overlay-modal .ap-home-chips .ap-agent-chip:focus-visible{ outline:2px solid var(--yz-info, #4c8dff); outline-offset:2px; }
/* «Мои агенты» — не вопрос, а своё место: тише остальных */
.ai-overlay-modal .ap-home-chips .ap-agent-chip-own{
    background:transparent; color:var(--yz-dim, #b9b4a7);
}
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-home-chips .ap-agent-chip{
    background:#fff; border-color:rgba(35,32,25,.10);
    box-shadow:0 1px 2px rgba(60,50,35,.05);
}
html[data-yz-theme="cloud"] .ai-overlay-modal .ap-home-chips .ap-agent-chip-own{ background:transparent; box-shadow:none; }
@keyframes apHomeChip{ from{ opacity:0; transform:translate3d(0,8px,0); } to{ opacity:1; transform:none; } }
.ai-overlay-modal .ap-home .ap-memline{ margin-top:16px; }
/* 20.10.2026: чипы и у персонажа в Работе (без .ap-home) — тот же отступ до строки памяти.
   ОТКАТ: удалить строку. */
.ai-overlay-modal .ap-home-chips + .ap-memline{ margin-top:16px; }
@media (max-width:360px){
    .ai-overlay-modal .ap-home-chips{ gap:6px; margin-top:22px; }
    .ai-overlay-modal .ap-home-row{ gap:6px; }
    .ai-overlay-modal .ap-home-chips .ap-agent-chip{ height:34px; padding:0 12px 0 9px; font-size:13px; }
}
@media (hover:none){ .ai-overlay-modal .ap-home-chips .ap-agent-chip:hover{ border-color:var(--ap-line); } }
@media (prefers-reduced-motion: reduce){
    .ai-overlay-modal .ap-home-chips .ap-agent-chip{ animation:none !important; }
}
/* Список диалогов: третье действие «Мои агенты» — переносим строкой ниже
   на всю ширину, а не сжимаем три кнопки до подписей в две строки. */
.ai-overlay-modal .ap-hist-actions{ flex-wrap:wrap; }
.ai-overlay-modal .ap-hist-actions .ap-hist-chip{ flex:1 1 40%; min-width:0; white-space:nowrap; }

/* 20.10.2026 · Без backdrop-filter и на компьютере. Под кнопками шапки,
   «кто работает» и капсулой поля уже лежит непрозрачный фон (градиент шапки,
   непрозрачная зона ввода), так что размывать там нечего — картинка та же.
   А вот цена была заметной: на ноутбуке без мощной видеокарты каждый кадр
   открытия и печати ответа перерисовывал размытие (до 80–100 мс на кадр при
   замедленном процессоре; без размытия — ровные 16 мс). На телефонах это
   уже было выключено (@media (hover:none), (max-width:800px)).
   ОТКАТ: удалить этот блок. */
.ai-overlay-modal .ap-topbar .ap-icon-btn,
.ai-overlay-modal .ap-who,
.ai-overlay-modal .ap-input-wrapper{
    -webkit-backdrop-filter:none; backdrop-filter:none;
}

/* 20.10.2026 · Спрятанные модалки портала (скриншот, приглашение, память,
   закреп, «Кто работает», тон…) лежали поверх шторки во весь экран с
   opacity:0, но видимыми — и с backdrop-filter:blur(14px). Браузер честно
   размывал под ними экран в каждом кадре: на компьютере это и давало
   рывки при открытии шторки и печати ответа. Теперь закрытая модалка
   скрыта по visibility (после того как дотает), открывается мгновенно.
   ОТКАТ: удалить этот блок. */
.ap-modal-overlay{ visibility:hidden; transition:opacity .3s ease, visibility 0s linear .3s; }
.ap-modal-overlay.active{ visibility:visible; transition:opacity .3s ease, visibility 0s; }

/* 20.10.2026 · Телефон: в капсуле «Язми · работает на тебя» подпись
   обрезалась до «работает на …» — не хватало 9 px (шапка заполнена ровно
   по ширине 390). Чуть плотнее отступы и подпись на полпикселя мельче.
   ОТКАТ: удалить этот блок. */
@media (max-width:420px){
    .ai-overlay-modal .ap-who{ gap:7px; padding-right:9px; }
    .ai-overlay-modal .ap-who-r{ font-size:10px; }
    .ai-overlay-modal .ap-who-chev{ margin-left:0; }
}

/* 20.10.2026 · Светлая тема (cloud): приглушённый текст шторки был слишком
   бледным — #9a9384 даёт 2,5–3:1 (подписи карточек, «Источники», даты,
   заголовки групп в «Диалогах»). Внутри шторки и её окон — #716b5e
   (4,7:1 на #f4f2ec, 5,3:1 на белом). Строка «… может ошибаться» была
   ещё и полупрозрачной (2–2,7:1 во всех темах) — теперь без прозрачности.
   Глобальную палитру (yazme-theme.css) не трогаем.
   ОТКАТ: удалить этот блок. */
html[data-yz-theme="cloud"] .ai-overlay-modal,
html[data-yz-theme="cloud"] #ai-overlay-modal,
html[data-yz-theme="cloud"] .ap-modal-overlay,
html[data-yz-theme="cloud"] #ap-history-panel{ --yz-muted:#716b5e; }
.ai-overlay-modal .ap-input-note,
#ai-overlay-modal .ap-input-note{ opacity:1; }
