/**
 * BLOCKS v5.0 — Premium Cards & Layout
 */

/* ─── КАРТОЧКИ ─────────────────────────────────────── */
.block-card {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

/* Плоский блок — без рамки, тени, полоски */
.block-flat {
    background: transparent;
    padding: 8px 24px;
    margin-bottom: 0;
    position: relative;
}

/* Sidebar отступ: контент не лезет под fixed sidebar */
@media (min-width: 768px) {
    #app-root {
        padding-left: 240px;
    }
}

/* ─── ЗАГОЛОВКИ БЛОКОВ ─────────────────────────────── */
.block-header {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

/* ─── СКРОЛЛБАР ЧАТА ───────────────────────────────── */
.feed-container::-webkit-scrollbar {
    width: 3px;
}

.feed-container::-webkit-scrollbar-track {
    background: transparent;
}

.feed-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* ─── ДЕТАЛИ (summary/details) ─────────────────────── */
details>summary {
    list-style: none;
}

details>summary::-webkit-details-marker {
    display: none;
}

/* ─── ЦВЕТНЫЕ ПОЛОСКИ СЛЕВА (АКЦЕНТ КАРТОЧКИ) - УСТАРЕЛО ──────── */
.block-card.legacy-border>div:first-child[class*="bg-"] {
    border-radius: var(--radius-card) 0 0 var(--radius-card);
}

/* ─── НОВЫЕ ПРЕМИУМ-КАРТОЧКИ И СЕТКА ────────────────── */
.card-premium {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flex-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── НАВИГАЦИЯ: ПИЛЮЛИ (ПЕРЕКЛЮЧАТЕЛЬ КОНТЕКСТА) ───── */
.context-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 16px;
    /* Скрываем скроллбар для эстетики */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.context-pills::-webkit-scrollbar {
    display: none;
}

.pill {
    padding: 6px 12px;
    border-radius: 20px;
    background: white;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--card-border);
    transition: all 0.2s ease;
}

.pill.active {
    background: var(--pia-navy);
    color: white;
    border-color: var(--pia-navy);
    box-shadow: 0 2px 4px rgba(29, 42, 69, 0.2);
}

/* ─── ЧАТ И STICKY FOOTER ───────────────────────────── */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    /* Примерная высота с учетом шапки */
    position: relative;
}

.chat-panel {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 24px;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 13px;
    line-height: 1.4;
    position: relative;
}

.chat-bubble-bot {
    background: white;
    border: 1px solid var(--card-border);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.chat-bubble-client {
    background: var(--pia-gold-soft);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-bubble-manager {
    background: #eef6f3;
    border: 1px solid #d5ece4;
    color: #1a3a30;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-timestamp {
    font-size: 10px;
    color: var(--text-secondary);
    /* Улучшенный контраст */
    margin-top: 4px;
    text-align: right;
}

.chat-input-sticky {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 12px 16px;
    border-top: 1px solid var(--card-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.03);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 -16px;
    /* Компенсация паддингов родителя если надо */
}

.chat-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-button);
    padding: 12px;
    font-family: inherit;
    font-size: 13px;
    resize: none;
    min-height: 60px;
    transition: border-color 0.2s;
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--pia-navy);
}

/* Плавный аккордеон */
details summary {
    cursor: pointer;
    transition: margin 0.2s ease;
}

details[open] summary {
    margin-bottom: 10px;
}

details summary svg {
    transition: transform 0.2s ease;
}

details[open] summary svg {
    transform: rotate(180deg);
}

/* ─── V2: LAYOUT-SPLIT (Detail-панель) ─────────────── */

/* Высота приложения с учётом Telegram */
:root {
    --tg-viewport-stable-height: 100vh;
}

/* Split layout: контейнер становится flex-row на десктопе */
#shell.layout-split {
    display: flex;
    flex-direction: column;
}

/* Detail-панель: по умолчанию скрыта за правым краем на мобилке */
.app-detail-panel {
    display: none;
    /* Не показываем пока нет контента */
}

.app-detail-panel:not(:empty) {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ── Мобилка: шторка поверх экрана ───────────────────── */
@media (max-width: 1023px) {
    .app-detail-panel:not(:empty) {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 60;
        height: var(--tg-viewport-stable-height, 100vh);
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }

    .app-detail-panel.active {
        transform: translateX(0);
    }
}

/* ── Десктоп: правая колонка рядом с основным контентом ── */
@media (min-width: 1024px) {
    #shell.layout-split {
        flex-direction: row;
        max-width: 1100px;
        /* Шире для split-layout */
    }

    #shell.layout-split>#app-root,
    #shell.layout-split>main {
        flex: 1;
        min-width: 0;
    }

    .app-detail-panel:not(:empty) {
        position: relative;
        width: 400px;
        flex-shrink: 0;
        border-left: 1px solid var(--card-border);
        height: calc(var(--tg-viewport-stable-height, 100vh) - 60px);
        /* Минус шапка */
    }
}

/* ─── V2: ШАПКА (header atoms) ──────────────────────── */

/* Контейнер шапки — fixed: не уезжает при скролле */
.v2-header {
    height: 60px;
    padding: 0 16px;
    background: var(--pia-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -2px rgba(0, 0, 0, 0.1);
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
    text-rendering: geometricPrecision;
}

/* Отступ сверху чтобы контент не залезал под fixed-шапку */
#shell {
    padding-top: 60px;
}

/* Мобильная шапка — компактнее, без лишних отступов */
@media (max-width: 640px) {
    .v2-header {
        height: 48px;
        padding: 0 12px;
    }

    #shell {
        padding-top: 48px;
    }
}

/* Левый / правый слоты */
.v2-header__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.v2-header__right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ─── Логотип PiaLink ─── */
.v2-header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.v2-header-logo__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    opacity: 0.9;
    position: relative;
    top: 1px;
}

.v2-header-logo__dot {
    width: 5px;
    height: 5px;
    border-radius: 0.5px;
    background: var(--pia-gold);
}

.v2-header-logo__text {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.95);
}

/* ─── Текстовые стили шапки (используются атомом value через styleMap) ─── */
.v2-header-profile__name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.v2-header-profile__company {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pia-gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.v2-header-user-position {
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── V2: НАВИГАЦИЯ (sidebar + bottom tab-bar) ──────── */

/* Sidebar: десктоп (≥768px), фиксирован слева */
.v2-nav-sidebar {
    display: none;
    flex-direction: column;
    width: 240px;
    flex-shrink: 0;
    padding-top: 24px;
    padding-right: 16px;
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    z-index: 30;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
}

@media (min-width: 768px) {
    .v2-nav-sidebar {
        display: flex;
    }
}

.v2-nav-sidebar__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 12px;
}

.v2-nav-sidebar__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.v2-nav-sidebar__item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--pia-navy);
}

.v2-nav-sidebar__item--active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--pia-navy);
    font-weight: 700;
    border-left: 3px solid var(--pia-gold);
    box-shadow: 0 1px 3px rgba(212, 175, 55, 0.15);
}

.v2-nav-sidebar__item--locked {
    opacity: 0.4;
    color: #9ca3af;
    cursor: not-allowed;
    position: relative;
}

.v2-nav-sidebar__lock {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.5;
}

.v2-nav-sidebar__tooltip {
    position: absolute;
    left: 100%;
    margin-left: 8px;
    padding: 6px 12px;
    background: var(--pia-navy);
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.v2-nav-sidebar__item--locked:hover .v2-nav-sidebar__tooltip {
    opacity: 1;
}

/* Bottom tab-bar: мобильный (<768px), фиксирован внизу */
.v2-nav-bottom {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 8px 16px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -4px 20px rgba(29, 42, 69, 0.05);
}

@media (min-width: 768px) {
    .v2-nav-bottom {
        display: none;
    }
}

.v2-nav-bottom__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 8px 0;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
}

.v2-nav-bottom__item:active {
    transform: scale(0.95);
}

.v2-nav-bottom__item--active {
    color: var(--pia-navy);
}

.v2-nav-bottom__item--locked {
    opacity: 0.35;
    cursor: not-allowed;
}

.v2-nav-bottom__icon {
    font-size: 20px;
    transition: transform 0.15s;
}

.v2-nav-bottom__icon--active {
    transform: translateY(-2px);
}

.v2-nav-bottom__label {
    font-size: 10px;
    font-weight: 600;
}

.v2-nav-bottom__label--active {
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
   V2: КИРПИЧИКИ АТОМОВ
   Каждый класс = визуал одного типа атома.
   Атом в MATRIX ставит style → Engine лепит class → CSS рисует.
   ═══════════════════════════════════════════════════════════ */

/* ─── LABEL (метка, заголовок секции) ──────────────────── */
.v2-label {
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    text-transform: none;
}

/* ─── VALUE (текстовое значение) ─────────────────────── */
.v2-value {
    font-size: var(--text-base);
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-secondary);
}

.v2-value--bold {
    font-weight: 700;
    color: var(--text-primary);
}

.v2-value__key {
    font-weight: 700;
    color: var(--text-primary);
}

/* ─── BUTTON (все варианты кнопок) ────────────────────── */
/* Базовые .btn-base, .btn-primary, .btn-secondary уже в theme.css */

.v2-button {
    /* Наследует .btn-base из theme.css */
}

.v2-button--navigate {
    /* Кнопка перехода: стрелка вправо, спокойный фон */
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
}

.v2-button--action {
    /* Кнопка действия: акцент, заливка */
    width: 100%;
}

.v2-button--action-gold {
    /* Золотая кнопка действия — выпуклая, gradient */
    width: fit-content;
    background: linear-gradient(180deg, #f0c14b 0%, #d4a327 100%);
    color: var(--pia-navy);
    font-weight: 700;
    font-size: 13px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.v2-button--action-gold:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.v2-button--action-gold:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ── Gold-кнопка: обёртка для popup ────────────────── */
.v2-gold-wrap {
    display: contents;
    /* на десктопе — прозрачная обёртка */
}

.v2-gold-overlay,
.v2-gold-bubble {
    display: none;
    /* скрыты на десктопе */
}

/* ── Мобилка: gold-кнопка → круглая FAB + popup ───── */
@media (max-width: 767px) {
    .v2-gold-wrap {
        display: block;
    }

    .v2-button--action-gold {
        position: fixed;
        bottom: 96px;
        right: 20px;
        z-index: 50;
        width: 52px;
        height: 52px;
        border-radius: 16px;
        padding: 0;
        font-size: 0;
        box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .v2-button--action-gold .v2-button__icon {
        font-size: 18px;
        margin: 0;
    }

    /* split_row__right не занимает место — кнопка ушла в fixed */
    .v2-split-row__right:has(.v2-button--action-gold) {
        width: 0;
        overflow: visible;
    }

    /* ── Overlay: затемнение при открытом popup ── */
    .v2-gold-wrap.open .v2-gold-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(2px);
        z-index: 40;
    }

    /* ── Bubble: пузырёк-подтверждение ── */
    .v2-gold-wrap.open .v2-gold-bubble {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        bottom: 156px;
        right: 20px;
        z-index: 51;
        padding: 10px 20px 10px 16px;
        border-radius: 999px;
        background: var(--pia-navy);
        color: white;
        font-size: 13px;
        font-weight: 700;
        border: none;
        cursor: pointer;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
        animation: goldBubbleIn 0.25s ease-out;
        white-space: nowrap;
    }

    .v2-gold-bubble .v2-button__icon {
        font-size: 13px;
        opacity: 0.7;
        color: white;
    }

    /* ── Крестик на кнопке при открытом popup ── */
    .v2-gold-wrap.open .v2-button--action-gold .v2-button__icon {
        transform: rotate(45deg);
        transition: transform 0.3s ease;
    }

    @keyframes goldBubbleIn {
        from {
            opacity: 0;
            transform: translateY(20px) scale(0.8);
        }

        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}

.v2-button--compact {
    /* Маленькая кнопка */
    width: fit-content;
}

.v2-button__icon {
    font-size: var(--text-lg);
    color: var(--pia-navy);
}

.v2-button__icon--muted {
    opacity: 0.6;
}

.v2-button__chevron {
    font-size: var(--text-sm);
    color: var(--pia-navy);
    opacity: 0.5;
}

/* ─── CONTACT ROW (кнопки контактов: TG, WA, Max, Tel) ── */
.v2-contact-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.v2-contact-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    transition: transform 0.15s;
    text-decoration: none;
}

.v2-contact-btn:hover {
    transform: scale(1.05);
}

.v2-contact-btn:active {
    transform: scale(0.95);
}

.v2-contact-btn--tg {
    background: #eff6ff;
    color: #3b82f6;
}

.v2-contact-btn--wa {
    background: #f0fdf4;
    color: #16a34a;
}

.v2-contact-btn--max {
    background: linear-gradient(135deg, #0ea5e9 0%, #4f46e5 50%, #9333ea 100%);
    color: #fff;
}

.v2-contact-btn--tel {
    background: #f8fafc;
    color: #64748b;
}

/* ─── FEED CARD (карточка в ленте) ───────────────────── */
.v2-feed-card {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.15s;
}

.v2-feed-card:hover {
    background: rgba(0, 0, 0, 0.02);
}

.v2-feed-card:last-child {
    border-bottom: none;
}

/* ─── SPLIT ROW (два элемента рядом) ─────────────────── */
.v2-split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.v2-split-row__left {
    flex: 1;
    min-width: 0;
}

.v2-split-row__right {
    flex-shrink: 0;
}

/* ─── SEARCH FIELD (поле поиска с иконкой) ──────────── */
.v2-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.v2-search-field__icon {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: #94a3b8;
    pointer-events: none;
}

.v2-search-field__input {
    width: 100%;
    padding: 10px 16px 10px 38px;
    font-size: 13px;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    outline: none;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.v2-search-field__input:focus {
    border-color: var(--pia-gold);
    box-shadow: 0 0 0 2px rgba(240, 193, 75, 0.15);
}

.v2-search-field__input::placeholder {
    color: #94a3b8;
    font-size: 13px;
}

/* ─── DIVIDER (разделитель) ──────────────────────────── */
.v2-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 8px 0;
}

/* ─── CHAT BUBBLE (пузырь сообщения) ─────────────────── */
.v2-bubble {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: 16px;
    font-size: var(--text-base);
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.v2-bubble--incoming {
    background: var(--card-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.v2-bubble--outgoing {
    background: var(--pia-navy);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.v2-bubble__time {
    font-size: var(--text-xs);
    margin-top: var(--spacing-xs);
    opacity: 0.5;
}

/* ========================================================
   HEADER ATOMS v6.0 — Кирпичики шапки
   ======================================================== */

/* ── avatar: кружок (фото / инициалы) ── */
.v2-avatar {
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: var(--pia-navy);
    transition: transform 0.2s;
}

.v2-avatar--header {
    width: 36px;
    height: 36px;
}

.v2-avatar--chat {
    width: 32px;
    height: 32px;
}

.v2-avatar--card {
    width: 48px;
    height: 48px;
}

.v2-avatar--default {
    width: 40px;
    height: 40px;
}

.v2-avatar:hover {
    transform: scale(1.05);
}

.v2-avatar__initials {
    font-size: 13px;
    font-weight: 700;
    color: var(--pia-navy);
}

.v2-avatar__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ── badge: кружочек с числом / точкой ── */
.v2-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    color: #fff;
}

.v2-badge--red {
    background: #ef4444;
}

.v2-badge--gold {
    background: var(--pia-gold);
    color: var(--pia-navy);
}

.v2-badge--green {
    background: #22c55e;
}

.v2-badge--dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    background: #ef4444;
}

/* ── notification: иконка в кружке + badge ── */
.v2-notification {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.v2-notification--header {
    width: 32px;
    height: 32px;
    font-size: 15px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.v2-notification--header:hover {
    background: rgba(255, 255, 255, 0.2);
}

.v2-notification__badge {
    position: absolute;
    top: -2px;
    right: -2px;
}

/* ── hidden-mobile: скрыть на < 640px ── */
@media (max-width: 640px) {
    .hidden-mobile {
        display: none !important;
    }
}

/* ── text_stack: вертикальная группировка ── */
.v2-text-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.v2-text-stack--end {
    align-items: flex-end;
    text-align: right;
}

.v2-text-stack--start {
    align-items: flex-start;
    text-align: left;
}

.v2-text-stack--center {
    align-items: center;
    text-align: center;
}

/* ── profile-dropdown: выпадающий список ── */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 100;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s, transform 0.2s;
}

.profile-dropdown.hidden {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.profile-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--pia-navy);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.profile-dropdown__item:hover {
    background: rgba(29, 42, 69, 0.05);
}

.profile-dropdown__item--danger {
    color: #ef4444;
}

.profile-dropdown__item--danger:hover {
    background: rgba(239, 68, 68, 0.05);
}

/* ─── HOVER: параметр реакции (v6.1) ──────────────────── */
/* Добавляется через Engine: hover: "scale" → class="v2-hover--scale" */

/* cursor: pointer для всех hover-элементов */
[class*="v2-hover--"] {
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

/* ── scale: элемент увеличивается ── */
@media (hover: hover) {
    .v2-hover--scale:hover {
        transform: scale(1.07);
    }
}

.v2-hover--scale:active {
    transform: scale(0.95);
}

/* ── highlight: фон подсвечивается ── */
@media (hover: hover) {
    .v2-hover--highlight:hover {
        background: rgba(255, 255, 255, 0.06);
        border-radius: 10px;
    }

    /* child-target: кнопка/стрелочка внутри */
    .v2-hover--highlight:hover .v2-button {
        color: var(--pia-gold);
    }
}

.v2-hover--highlight:active {
    background: rgba(255, 255, 255, 0.1);
}

/* ── pill: овальчик-обёртка (как профиль в шапке) ── */
@media (hover: hover) {
    .v2-hover--pill:hover {
        background: rgba(255, 255, 255, 0.06);
        border-radius: 9999px;
    }

    .v2-hover--pill:hover .v2-avatar {
        transform: scale(1.07);
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
    }
}

/* ── glow: мягкое свечение ── */
@media (hover: hover) {
    .v2-hover--glow:hover {
        box-shadow: 0 0 12px rgba(209, 173, 99, 0.3);
    }
}

/* ── Карточки feed: hover подсвечивает стрелочку ── */
@media (hover: hover) {
    .feed-item.v2-hover--highlight:hover {
        background: rgba(29, 42, 69, 0.03);
        border-radius: 8px;
        margin: -4px -8px;
        padding: 4px 8px;
    }
}

/* ═══════════════════════════════════════════════════════
   КНОПКИ-ТАБЫ (segmented control / pill-переключатель)
   ═══════════════════════════════════════════════════════ */
.v2-tab-group {
    display: flex;
    gap: 0;
    background: #f5f6f8;
    border-radius: 14px;
    padding: 6px;
}

.v2-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.v2-tab--active {
    background: #fff;
    color: var(--pia-navy);
    box-shadow: 0 4px 12px rgba(29, 42, 69, 0.08);
}

/* ═══════════════════════════════════════════════════════
   КАРТОЧКА АВТОРИЗАЦИИ (style: auth_card)
   ═══════════════════════════════════════════════════════ */
.v2-auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 16px;
}

.v2-auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 8px 40px rgba(29, 42, 69, 0.12);
    overflow: hidden;
}

.v2-auth-card__header {
    background: #fff;
    padding: 40px 32px 16px;
    /* Уменьшаем нижний отступ шапки, так как нет линии */
    text-align: center;
}

.v2-auth-card__header h1 {
    color: var(--pia-navy);
    font-family: 'Montserrat', sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin: 0 0 8px;
}

.v2-auth-card__header p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin: 4px 0 0;
}

.v2-auth-card__body {
    padding: 16px 32px 40px;
    /* Комплементируем отступ от шапки */
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ═══════════════════════════════════════════════════════
   AUTH CARD V2 (Светлая премиальная тема - Контракт 2)
   ═══════════════════════════════════════════════════════ */
.v2-auth-header--light {
    padding: 40px 32px 32px;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
}

.v2-auth-title {
    color: var(--pia-navy);
    font-size: 26px;
    font-weight: 900;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: -0.5px;
    margin: 0;
}

.v2-auth-icon {
    font-size: 36px;
    margin-bottom: 12px;
    color: #ef4444;
}

.v2-auth-body--spaced {
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
}

.v2-auth-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    margin: 0 0 24px 0;
}

.v2-auth-text--last {
    margin: 0;
}

.v2-auth-action-box {
    margin-top: 40px;
    text-align: center;
}

.v2-auth-footer-box {
    text-align: center;
    margin-top: 24px;
}

.v2-auth-link {
    display: inline-block;
    cursor: pointer;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.v2-auth-link:hover {
    color: var(--pia-navy);
}

.v2-auth-btn--telegram {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 16px;
    background: #229ED9;
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    transition: background-color 0.2s, transform 0.2s;
    width: 100%;
}

.v2-auth-btn--telegram:hover {
    background: #1c8ac0;
}

.v2-auth-btn--telegram:active {
    transform: scale(0.98);
}

.v2-auth-btn--primary {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 16px;
    background: var(--pia-navy);
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    transition: opacity 0.2s, transform 0.2s;
    width: 100%;
    cursor: pointer;
}

.v2-auth-btn--primary:hover {
    opacity: 0.9;
}

.v2-auth-btn--primary:active {
    transform: scale(0.98);
}


/* ═══════════════════════════════════════════════════════
   ВВОД 4-ЗНАЧНОГО КОДА (form_code)
   ═══════════════════════════════════════════════════════ */
.v2-code-group {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.v2-code-input {
    width: 56px;
    height: 64px;
    text-align: center;
    font-size: 24px;
    font-weight: 900;
    color: var(--pia-navy);
    background: #f8fafc;
    border: 2px solid rgba(29, 42, 69, 0.12);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.v2-code-input:focus {
    border-color: var(--pia-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.v2-code-input--error {
    border-color: #ef4444;
    background: #fef2f2;
}

.v2-code-input--error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ═══════════════════════════════════════════════════════
   АНИМАЦИЯ LOADER (мигающие квадратики)
   ═══════════════════════════════════════════════════════ */
@keyframes loaderPulse {

    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ═══════════════════════════════════════════════════════════
   HTML_BLOCK: КАРТОЧКА ПРИВЕТСТВИЯ (.hw-*)
   ═══════════════════════════════════════════════════════════ */

.hw-card {
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: 0 4px 25px rgb(0 0 0 / 0.03);
    overflow: hidden;
    border: 1px solid var(--card-border);
    margin-bottom: 24px;
}

.hw-cover {
    width: 100%;
    height: 180px;
    background: #e2e8f0;
    position: relative;
}

@media (min-width: 640px) {
    .hw-cover {
        height: 220px;
    }
}

.hw-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.hw-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(29, 42, 69, 0.9),
            rgba(29, 42, 69, 0.4),
            transparent);
    z-index: 2;
}

.hw-overlay-text {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    color: white;
    z-index: 3;
}

.hw-brand {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #d4af37;
    opacity: 0.9;
    margin-bottom: 6px;
}

.hw-title {
    font-size: 24px;
    font-weight: 900;
    color: white;
    line-height: 1.2;
}

@media (min-width: 640px) {
    .hw-title {
        font-size: 28px;
    }
}

.hw-body {
    padding: 24px;
}

@media (min-width: 640px) {
    .hw-body {
        padding: 32px;
    }
}

.hw-subtitle {
    font-size: 16px;
    font-weight: 800;
    color: #1d2a45;
    margin-bottom: 20px;
    line-height: 1.4;
}

.hw-subtitle span {
    display: block;
    color: #64748b;
    font-weight: 600;
    margin-top: 4px;
}

.hw-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hw-features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.hw-feature-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.12);
    color: #1d2a45;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.hw-feature-icon i {
    font-size: 10px;
}

.hw-feature-text {
    font-size: 15px;
    color: #64748b;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.hw-cta-btn {
    background: linear-gradient(180deg, #f0c14b 0%, #d4a327 100%);
    color: #1d2a45;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.hw-cta-btn:hover {
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.hw-cta-btn:active {
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════
   HTML_BLOCK: ЛЕНТА НОВОСТЕЙ (.nf-*)
   ═══════════════════════════════════════════════════════════ */

.nf-card-border {
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(to bottom, rgba(29, 42, 69, 0.06), transparent);
}

.nf-card {
    background: #ffffff;
    border-radius: 23px;
    padding: 24px 0 8px 0;
    overflow: hidden;
    position: relative;
}

.nf-bg-icon {
    position: absolute;
    top: -40px;
    right: -40px;
    font-size: 200px;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

.nf-header {
    font-weight: 800;
    color: #1d2a45;
    font-size: 18px;
    padding: 0 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.nf-header-line {
    height: 1px;
    background: rgba(29, 42, 69, 0.06);
    flex: 1;
    margin-left: 8px;
}

/* ─── Таймлайн ─── */
.nf-timeline {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    padding: 0 24px 24px;
    z-index: 1;
}

.nf-timeline::before {
    content: '';
    position: absolute;
    left: 35px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #f1f5f9;
}

/* ─── Элемент новости ─── */
.nf-item {
    position: relative;
    padding-left: 32px;
    cursor: pointer;
}

.nf-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f9fafb;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, border-color 0.3s;
    z-index: 10;
}

.nf-dot-inner {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: background 0.3s;
}

.nf-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.nf-item-date {
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    transition: color 0.3s;
}

.nf-item-title {
    font-size: 16px;
    font-weight: 800;
    color: #1d2a45;
    margin-bottom: 12px;
    line-height: 1.4;
    padding-right: 16px;
}

.nf-body p {
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.4;
    margin: 0 0 8px 0;
}

.nf-detail-box p {
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    letter-spacing: -0.01em;
    line-height: 1.4;
    margin: 0 0 8px 0;
}

.nf-chevron {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nf-chevron i {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.3s;
}

/* ─── Аккордеон: сворачивание/раскрытие ─── */
.nf-body {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0.6;
    transition: grid-template-rows 0.3s, opacity 0.3s;
    pointer-events: none;
}

.nf-body>div {
    overflow: hidden;
}

.nf-item.expanded .nf-body {
    grid-template-rows: 1fr;
    opacity: 1;
    pointer-events: auto;
}

.nf-item.expanded .nf-chevron i {
    transform: rotate(180deg);
}

.nf-item.expanded .nf-dot {
    background: #1d2a45;
    border-color: white;
}

.nf-item.expanded .nf-dot-inner {
    background: #d4af37;
}

.nf-item.expanded .nf-item-date {
    color: #1d2a45;
}

.nf-item:not(.expanded):hover .nf-dot {
    background: #e2e8f0;
}

.nf-item:not(.expanded):hover .nf-dot-inner {
    background: #94a3b8;
}

.nf-item:not(.expanded):hover .nf-chevron {
    background: #f1f5f9;
}

/* Вложенный блок «подробности» (используется в последней новости) */
.nf-detail-box {
    margin-top: 12px;
    background: #f9fafb;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.nf-detail-box p {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.nf-detail-box p:last-child {
    margin-bottom: 0;
}

.nf-detail-box .nf-divider {
    margin: 12px 0;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT: COLUMNS (контейнер колонок для страниц)
   ═══════════════════════════════════════════════════════════ */

.layout-columns {
    display: flex;
    gap: 32px;
    width: 100%;
}

.layout-columns>.layout-col {
    min-width: 0;
}

@media (max-width: 1023px) {
    .layout-columns {
        flex-direction: column;
        gap: 16px;
    }

    .layout-columns>.layout-col {
        flex: none !important;
        width: 100% !important;
    }
}