/* ═══════════════════════════════════════════
   SALES CALL ANALYZER — Liquid Glass 2026
   iPhone-first, Python 3.11 compatible
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;

    /* Liquid Glass palette */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.45);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --glass-blur: 20px;
    --glass-hover: rgba(255, 255, 255, 0.85);

    /* Colors */
    --bg: #f2f2f7;
    --bg-secondary: #e5e5ea;
    --text-primary: #1c1c1e;
    --text-secondary: #8e8e93;
    --text-tertiary: #aeaeb2;
    --accent: #007aff;
    --accent-light: rgba(0, 122, 255, 0.12);
    --green: #34c759;
    --green-light: rgba(52, 199, 89, 0.12);
    --yellow: #ff9f0a;
    --yellow-light: rgba(255, 159, 10, 0.12);
    --red: #ff3b30;
    --red-light: rgba(255, 59, 48, 0.12);
    --orange: #ff9500;
    --purple: #af52de;
    --teal: #5ac8fa;
    --pink: #ff2d55;

    /* Spacing */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    /* Safe areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: calc(80px + var(--safe-bottom));
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

/* ═══ GLASS CARD — основной компонент ═══ */
.glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.glass:active {
    transform: scale(0.98);
    background: var(--glass-hover);
}

.glass-static {
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(135deg, rgba(15, 63, 184, 0.22), rgba(52, 199, 89, 0.16)) border-box;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* Глобально делаем информационные блоки читаемыми на любом фоне */
.glass-static,
.metric-card,
.list-item,
.score-hero,
.script-stage,
.code-block,
.recommendations-card,
.point-card,
.chip,
.script-meta-card,
.empty-state {
    border-width: 1px;
    border-style: solid;
}

/* ═══ НАВИГАЦИЯ — Liquid Glass Tab Bar ═══ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(249, 249, 249, 0.78);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(0, 0, 0, 0.12);
    display: flex;
    justify-content: space-around;
    padding: 6px 0 calc(6px + var(--safe-bottom));
    z-index: 1000;
}

.desktop-nav {
    display: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-tertiary);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    min-width: 52px;
}

.nav-item.active {
    color: var(--accent);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 1px;
    line-height: 1;
}

.nav-label {
    letter-spacing: -0.01em;
}

.nav-label-wrap,
.desktop-nav-label-wrap {
    position: relative;
    display: inline-flex;
}

/* ═══ СТРАНИЦЫ ═══ */
.page {
    padding: 0 16px 20px;
    max-width: 600px;
    margin: 0 auto;
    padding-top: calc(16px + var(--safe-top));
}

@media (display-mode: standalone) {
    .page {
        padding-top: calc(56px + var(--safe-top));
    }
}

/* Десктоп/планшет: верхнее меню; 900px — чтобы не ловить узкое окно на ноутбуке */
@media (min-width: 900px) {
    body {
        padding-bottom: 0;
    }
    body.app-logged-in {
        padding-top: calc(52px + env(safe-area-inset-top, 0px));
    }
    .bottom-nav {
        display: none !important;
    }
    .desktop-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px 12px;
        row-gap: 8px;
        width: 100%;
        box-sizing: border-box;
        padding: 10px 20px;
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
        background: rgba(249, 249, 249, 0.96);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 0.5px solid rgba(0, 0, 0, 0.12);
        max-width: none;
        margin: 0;
    }
    .desktop-nav-item {
        text-decoration: none;
        color: var(--text-secondary);
        font-weight: 600;
        font-size: 0.88rem;
        padding: 8px 14px;
        border-radius: 10px;
        white-space: nowrap;
    }
    .desktop-nav-item.active {
        color: var(--accent);
        background: var(--accent-light);
    }

.desktop-nav-item--inbox .desktop-nav-label-wrap {
    position: relative;
    display: inline-flex;
    padding-top: 8px;
}
    .page {
        max-width: 1100px;
        padding: 12px 20px 24px;
    }
}

.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: -12px;
    margin-bottom: 16px;
}

.back-btn {
    color: var(--accent);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-basis: 100%;
    width: fit-content;
    margin-bottom: 2px;
}

.page-breadcrumb {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    line-height: 1.35;
    margin-top: -12px;
    margin-bottom: 14px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

@media (max-width: 380px) {
    .page-breadcrumb {
        font-size: 0.72rem;
        line-height: 1.3;
        margin-top: -10px;
        margin-bottom: 12px;
    }
    .page-breadcrumb[data-mobile-hide="1"] {
        display: none;
    }
    .badge {
        font-size: 0.7rem;
        padding: 3px 8px;
        border-radius: 16px;
    }
    .user-badge {
        font-size: 0.72rem;
        padding: 4px 10px;
        border-radius: 16px;
    }
    .page-header {
        gap: 8px;
        margin-bottom: 16px;
    }
    .page-header h1 {
        font-size: 1.7rem;
        line-height: 1.1;
    }
}

/* «Ещё»: заметный переход на главную */
a.more-home-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-lg);
    transition: background 0.2s, transform 0.15s;
}
a.more-home-cta:active {
    transform: scale(0.99);
}
.more-home-cta-icon {
    font-size: 1.75rem;
    line-height: 1;
}
.more-home-cta-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.more-home-cta-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
}
.more-home-cta-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.more-home-cta-chevron {
    color: var(--text-tertiary);
    font-size: 1.25rem;
    font-weight: 300;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 24px 0 12px;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: -8px;
    margin-bottom: 12px;
}

/* ═══ МЕТРИКИ — Glass Cards ═══ */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.metrics-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.metric-card {
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(145deg, rgba(37, 99, 235, 0.22), rgba(175, 82, 222, 0.18)) border-box;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--glass-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

/* Цветные плашки для числовых/процентных метрик во всех сетках */
.metrics-grid .metric-card:nth-child(4n+1),
.metrics-grid-3 .metric-card:nth-child(4n+1) {
    background-color: rgba(99, 102, 241, 0.1);
    background-image: linear-gradient(145deg, rgba(99, 102, 241, 0.14), rgba(79, 70, 229, 0.06));
    border-color: rgba(79, 70, 229, 0.34);
}

.metrics-grid .metric-card:nth-child(4n+2),
.metrics-grid-3 .metric-card:nth-child(4n+2) {
    background-color: rgba(14, 165, 233, 0.1);
    background-image: linear-gradient(145deg, rgba(14, 165, 233, 0.14), rgba(6, 182, 212, 0.06));
    border-color: rgba(14, 165, 233, 0.34);
}

.metrics-grid .metric-card:nth-child(4n+3),
.metrics-grid-3 .metric-card:nth-child(4n+3) {
    background-color: rgba(245, 158, 11, 0.1);
    background-image: linear-gradient(145deg, rgba(245, 158, 11, 0.14), rgba(249, 115, 22, 0.06));
    border-color: rgba(245, 158, 11, 0.36);
}

.metrics-grid .metric-card:nth-child(4n+4),
.metrics-grid-3 .metric-card:nth-child(4n+4) {
    background-color: rgba(52, 199, 89, 0.1);
    background-image: linear-gradient(145deg, rgba(52, 199, 89, 0.14), rgba(16, 185, 129, 0.06));
    border-color: rgba(52, 199, 89, 0.34);
}

.metric-card.accent {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.08), rgba(0, 122, 255, 0.02));
    border-color: rgba(0, 122, 255, 0.2);
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 2px;
    line-height: 1.1;
}

.metric-delta {
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 2px;
}

.good { color: var(--green); }
.warn { color: var(--yellow); }
.bad { color: var(--red); }
.good-bg { background: var(--green-light); color: var(--green); }
.warn-bg { background: var(--yellow-light); color: var(--yellow); }
.bad-bg { background: var(--red-light); color: var(--red); }

/* ═══ SCORE RING — круговой индикатор ═══ */
.score-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 16px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--bg-secondary);
    stroke-width: 8;
}

.score-ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Текст по центру круга: число + подпись одной колонкой (без сдвигов top/% ) */
.score-ring-metric {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    pointer-events: none;
    text-align: center;
    line-height: 1;
    padding: 0 6px;
}

.score-ring-metric .score-ring-value {
    position: static;
    transform: none;
    margin: 0;
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.score-ring-metric .score-ring-label {
    position: static;
    transform: none;
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* Fallback: только число без обёртки */
.score-ring-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.score-ring-label {
    position: absolute;
    top: 62%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dashboard-score-caption {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 10px;
    line-height: 1.35;
    text-align: center !important;
}

/* ═══ Дашборд: две ключевые метрики (балл + конверсия) ═══ */
.dashboard-hero-card {
    padding: 22px 0 20px;
    margin-bottom: 16px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.dashboard-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: start;
}

.dashboard-hero-col {
    text-align: center;
    padding: 8px 4px 4px;
    border-radius: var(--radius-lg);
    min-width: 0;
}

.dashboard-hero-col--metric {
    background: linear-gradient(160deg, rgba(175, 82, 222, 0.08), rgba(0, 122, 255, 0.05));
    border: 1px solid rgba(175, 82, 222, 0.12);
}

.dashboard-hero-col--accent {
    background: linear-gradient(160deg, rgba(52, 199, 89, 0.12), rgba(0, 122, 255, 0.06));
    border: 1px solid rgba(52, 199, 89, 0.18);
}

.dashboard-hero-col .score-ring {
    margin-bottom: 8px;
}

.dashboard-hero-hint {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    line-height: 1.3;
    margin-top: 4px;
    padding: 0 4px;
    text-align: center !important;
}

.metric-card--calls {
    background-color: rgba(99, 102, 241, 0.1);
    background-image: linear-gradient(145deg, rgba(99, 102, 241, 0.14), rgba(79, 70, 229, 0.06));
    border-color: rgba(79, 70, 229, 0.34);
}

.metric-card--managers {
    background-color: rgba(14, 165, 233, 0.1);
    background-image: linear-gradient(145deg, rgba(14, 165, 233, 0.14), rgba(6, 182, 212, 0.06));
    border-color: rgba(14, 165, 233, 0.34);
}

.metric-card--script {
    background-color: rgba(245, 158, 11, 0.1);
    background-image: linear-gradient(145deg, rgba(245, 158, 11, 0.14), rgba(249, 115, 22, 0.06));
    border-color: rgba(245, 158, 11, 0.36);
}

.dashboard-team-cta {
    display: block;
    margin: 14px 0 4px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.dashboard-team-cta:active {
    opacity: 0.85;
}

@media (max-width: 360px) {
    .dashboard-hero-grid {
        gap: 8px;
    }
}

/* ═══ SKILL BARS — навыки ═══ */
.skill-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.skill-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-track {
    width: 100px;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.skill-fill.good { background: var(--green); }
.skill-fill.warn { background: var(--yellow); }
.skill-fill.bad { background: var(--red); }

.skill-score {
    font-weight: 700;
    font-size: 0.88rem;
    min-width: 32px;
    text-align: right;
}

/* ═══ СПИСКИ — Glass List ═══ */
.glass-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.glass-list-grouped {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

.glass-list-grouped .list-item {
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.glass-list-grouped .list-item + .list-item {
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

/* In "Раскрывающаяся инструкция" на мобильной странице интеграций
   строки не должны обрезаться (у .list-subtitle по умолчанию nowrap/ellipsis). */
details > div.list-subtitle {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.list-item {
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(145deg, rgba(37, 99, 235, 0.2), rgba(16, 185, 129, 0.14)) border-box;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--glass-shadow);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

a.list-item:active {
    transform: scale(0.98);
    background: var(--glass-hover);
}

.list-icon {
    font-size: 1.4rem;
    min-width: 32px;
    text-align: center;
}

.list-content {
    flex: 1;
    min-width: 0;
}

.list-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.list-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.list-right {
    text-align: right;
    min-width: 44px;
}

.list-value {
    font-weight: 800;
    font-size: 1.05rem;
}

.list-meta {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 500;
}

/* ═══ BADGE / CHIP ═══ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    max-width: 100%;
    white-space: normal;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: center;
}

.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-red { background: var(--red-light); color: var(--red); }

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.chip {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    cursor: pointer;
    transition: all 0.2s;
}

.chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ═══ CALL DETAIL — Score Hero ═══ */
.score-hero {
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(145deg, rgba(37, 99, 235, 0.24), rgba(175, 82, 222, 0.16)) border-box;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid transparent;
    border-radius: var(--radius-xl);
    padding: 28px 20px;
    text-align: center;
    box-shadow: var(--glass-shadow);
    margin-bottom: 20px;
}

.score-hero-name {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 8px;
}

.score-hero-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

.score-hero-summary {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 10px;
    line-height: 1.4;
}

/* ═══ POINTS (хорошо/плохо) ═══ */
.point-card {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin: 6px 0;
    font-size: 0.88rem;
    line-height: 1.4;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.point-good {
    background: var(--green-light);
    color: #1b7a34;
}

.point-bad {
    background: var(--yellow-light);
    color: #8a5a00;
}

.point-tip {
    background: var(--accent-light);
    color: #0055b3;
}

.recommendations-card {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.06), rgba(175, 82, 222, 0.06));
    border: 1px solid rgba(0, 122, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ═══ ФОРМЫ — Glass Input ═══ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font);
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(145deg, rgba(37, 99, 235, 0.24), rgba(16, 185, 129, 0.2)) border-box;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.2s;
}

input.form-input,
textarea.form-input,
select.form-input {
    border-width: 1px;
    border-style: solid;
}

.form-input:focus {
    outline: none;
    box-shadow:
        0 0 0 4px var(--accent-light),
        inset 0 0 0 1px rgba(37, 99, 235, 0.22);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238e8e93'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-hint {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    margin-top: 4px;
}

/* ═══ КНОПКИ ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: white;
    padding: 16px;
    font-size: 1.05rem;
}

.btn-primary:active {
    background: #0066d6;
}

.btn-secondary {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--accent);
}

.btn-danger {
    background: var(--red-light);
    color: var(--red);
}

.btn-success {
    background: var(--green-light);
    color: var(--green);
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-group .btn {
    flex: 1;
}

/* ═══ TOGGLE ═══ */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.toggle-row + .toggle-row {
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.toggle-label {
    font-weight: 500;
    font-size: 0.95rem;
}

.toggle-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.toggle {
    position: relative;
    width: 51px;
    height: 31px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle:checked {
    background: var(--green);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.3s;
}

.toggle:checked::after {
    transform: translateX(20px);
}

/* ═══ TABS ═══ */
.tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 2px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: fit-content;
}

.tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Админка: фильтры списка клиентов — заметная панель (не сливается с фоном) */
.admin-filter-panel {
    padding: 14px 14px 12px;
    margin-bottom: 16px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0%, rgba(242, 246, 255, 0.92) 100%);
    border: 1px solid rgba(0, 122, 255, 0.18);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.07);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}
.admin-filter-panel .admin-filter-head {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}
.admin-filter-panel .admin-filter-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.admin-filter-panel .admin-filter-tabs {
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
    gap: 4px;
    row-gap: 4px;
}
.admin-filter-panel .admin-filter-tabs .tab {
    flex: 1 1 auto;
    min-width: max(28%, 72px);
}
.admin-filter-panel .admin-filter-tabs:last-child {
    margin-bottom: 0;
}

.admin-client-card {
    margin-bottom: 10px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(16, 185, 129, 0.16)) border-box;
    border: 1px solid transparent;
    overflow: hidden;
}

.admin-client-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    display: block;
}

.admin-client-summary::-webkit-details-marker {
    display: none;
}

.admin-client-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.admin-client-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
}

.admin-client-dot.active { background: var(--green); }
.admin-client-dot.inactive { background: var(--red); }

.admin-client-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.admin-client-chevron {
    margin-left: auto;
    font-size: 1.1rem;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
}

.admin-client-card[open] .admin-client-chevron {
    transform: rotate(180deg);
}

.admin-client-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: flex-end;
}

.admin-client-actions .btn {
    width: auto;
    min-height: 34px;
    padding: 8px 12px;
    font-size: 0.82rem;
}

.admin-license-track {
    margin-top: 0;
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
    overflow: hidden;
}

.admin-license-fill {
    height: 100%;
    border-radius: 999px;
}

.admin-license-fill.active {
    background: linear-gradient(90deg, rgba(52, 199, 89, 0.9), rgba(16, 185, 129, 0.9));
}

.admin-license-fill.inactive {
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.9), rgba(239, 68, 68, 0.9));
}

.admin-client-body {
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    padding: 12px 14px 14px;
}

/* ═══ EMPTY / LOADING / STATUS ═══ */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.empty-desc {
    font-size: 0.88rem;
    line-height: 1.4;
}

.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    margin: 12px 0;
    line-height: 1.4;
}

.alert-error { background: var(--red-light); color: #c0392b; }
.alert-success { background: var(--green-light); color: #1b7a34; }
.alert-info { background: var(--accent-light); color: #0055b3; }
.alert-warning { background: var(--yellow-light); color: #8a5a00; }

/* ═══ LOGIN ═══ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    padding-top: calc(20px + var(--safe-top));
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
    background: linear-gradient(180deg, #F4F1FD 0%, #F9F9FB 45%, var(--bg) 100%);
}

.login-card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 36px 24px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-logo {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    object-fit: contain;
    max-width: min(80px, 28vw);
    max-height: min(80px, 28vw);
    flex-shrink: 0;
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    line-height: 1.15;
    color: #4F26E3;
    overflow-wrap: anywhere;
}

.login-subtitle {
    color: var(--text-secondary);
    margin: 0 auto 24px;
    font-size: 0.96rem;
    line-height: 1.35;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
}

.login-card .form-group {
    margin-bottom: 14px;
    text-align: left;
}

.login-card #loginBtn {
    margin-top: 6px;
}

.login-password-wrap {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

.login-password-wrap .login-password-input {
    flex: 1;
    min-width: 0;
    width: auto;
}

.login-password-toggle {
    flex-shrink: 0;
    align-self: center;
    padding: 10px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(145deg, rgba(37, 99, 235, 0.22), rgba(16, 185, 129, 0.12)) border-box;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
}

.login-password-toggle:active {
    opacity: 0.88;
}

/* ═══ USER BADGE ═══ */
.user-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    max-width: 100%;
    white-space: normal;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: center;
}

/* ═══ SCRIPT VIEWER ═══ */
.script-stage {
    background:
        linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box,
        linear-gradient(145deg, rgba(37, 99, 235, 0.2), rgba(175, 82, 222, 0.14)) border-box;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
}

.script-stage-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.script-stage-header::after {
    content: '›';
    margin-left: auto;
    font-size: 1.2rem;
    color: var(--text-tertiary);
    transition: transform 0.3s;
}

.script-stage.open .script-stage-header::after {
    transform: rotate(90deg);
}

.script-stage-body {
    padding: 0 16px 14px;
    display: none;
}

.script-stage.open .script-stage-body {
    display: block;
}

.script-stage--static .script-stage-header {
    cursor: default;
}

.script-stage--static .script-stage-header::after {
    content: '';
    display: none;
}

.script-stage-goal {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

.script-meta-card {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(246, 249, 255, 0.95), rgba(250, 252, 255, 0.92));
    border: 1px solid rgba(15, 63, 184, 0.2);
    box-shadow: 0 8px 24px rgba(15, 63, 184, 0.08);
    overflow: hidden;
}

.script-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.script-version-label {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--text-primary);
}

.script-version-date {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-top: 2px;
}

.script-update-note {
    margin-top: 10px;
    font-size: 0.74rem;
    color: var(--text-tertiary);
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 430px) {
    .script-meta-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    .script-version-label {
        font-size: 0.92rem;
    }
    .script-version-date {
        font-size: 0.76rem;
    }
    .script-update-note {
        font-size: 0.7rem;
        margin-top: 8px;
    }
    .script-stage {
        margin-bottom: 10px;
    }
    .script-stage-header {
        padding: 12px 12px;
        font-size: 0.9rem;
        gap: 6px;
    }
    .script-stage-body {
        padding: 0 12px 12px;
    }
    .script-stage-goal {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    .script-phrase {
        font-size: 0.84rem;
        padding: 9px 10px;
        margin: 5px 0;
    }
    .script-rule {
        font-size: 0.8rem;
        line-height: 1.35;
    }
}

@media (max-width: 360px) {
    .metrics-grid-3 {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .metric-card {
        padding: 12px;
    }
    .metric-value {
        font-size: 1.5rem;
    }
}

.script-phrase {
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 6px 0;
    font-size: 0.88rem;
    line-height: 1.4;
    color: #0055b3;
    font-style: italic;
}

.script-rule {
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 6px;
}

.script-rule::before {
    content: '•';
    color: var(--accent);
    font-weight: 700;
}

/* ═══ CODE / LINK BLOCK ═══ */
.code-block {
    background:
        linear-gradient(180deg, rgba(242, 246, 255, 0.95), rgba(250, 251, 255, 0.95)) padding-box,
        linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(52, 199, 89, 0.18)) border-box;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-primary);
    word-break: break-word;
    margin-bottom: 8px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.integration-card {
    text-align: left;
}

.integration-copy-btn {
    justify-content: flex-start;
    text-align: left;
    width: auto;
    min-height: 38px;
    padding: 10px 14px;
    margin-top: 2px;
}

/* ═══ INSTRUCTION PAGE ═══ */
.instruction-step {
    display: flex;
    gap: 14px;
    padding: 16px 0;
}

.instruction-step + .instruction-step {
    border-top: 0.5px solid rgba(0, 0, 0, 0.06);
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.step-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* FAQ на странице «Инструкция»: перенос на узких экранах (не ellipsis/nowrap) */
.instruction-faq .list-title,
.instruction-faq .list-subtitle {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.38;
}

.instruction-faq .list-title {
    margin-bottom: 4px;
}

/* ═══ FEEDBACK BUTTONS ═══ */
.feedback-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.feedback-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

.feedback-btn.selected-good {
    background: var(--green-light);
    border-color: var(--green);
}

.feedback-btn.selected-bad {
    background: var(--red-light);
    border-color: var(--red);
}

/* ═══ CHART CONTAINER ═══ */
.chart-container {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--glass-shadow);
    margin: 12px 0;
    overflow: hidden;
}

.mini-bar {
    display: flex;
    align-items: end;
    gap: 3px;
    height: 40px;
}

.mini-bar-item {
    flex: 1;
    border-radius: 3px 3px 0 0;
    min-width: 4px;
    transition: height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 375px) {
    .metrics-grid { gap: 8px; }
    .metric-value { font-size: 1.5rem; }
    .page-header h1 { font-size: 1.6rem; }
    .score-ring { width: 120px; height: 120px; }
    .score-ring-value { font-size: 2rem; }
    .nav-item { min-width: 44px; font-size: 0.6rem; }
    .nav-icon { font-size: 1.3rem; }
}

@media (min-width: 601px) {
    .page { padding-left: 24px; padding-right: 24px; }
    .metrics-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}
/* ═══ EMOTION MAP — эмоциональная карта звонка ═══ */
.emotion-timeline {
    position: relative;
    min-height: 132px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin: 12px 0;
    overflow: visible;
}

.emotion-timeline-track {
    position: relative;
    height: 70px;
    margin-top: 8px;
}

.emotion-timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--bg-secondary);
    transform: translateY(-50%);
}

.emotion-timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.emotion-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    top: 50%;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.emotion-dot:active {
    transform: translate(-50%, -50%) scale(1.4);
}

.emotion-dot.interest {
    background: var(--green);
}

.emotion-dot.tension {
    background: var(--red);
}

.emotion-dot.neutral {
    background: var(--yellow);
}

.emotion-dot.positive {
    background: var(--teal);
}

/* Линия графика */
.emotion-graph {
    position: relative;
    min-height: 186px;
    height: auto;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin: 12px 0;
    overflow: hidden;
}

.emotion-graph svg {
    width: 100%;
    height: 140px;
    display: block;
}

.emotion-graph-line {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.emotion-graph-area {
    opacity: 0.1;
}

.emotion-graph-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.emotion-graph-legend span::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-client::before { background: var(--accent); }
.legend-manager::before { background: var(--green); }

/* Tooltip для точек */
.emotion-tooltip {
    position: fixed;
    background: rgba(28, 28, 30, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 280px;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: none;
}

.emotion-tooltip.visible {
    display: block;
    animation: tooltipIn 0.2s ease;
}

@keyframes tooltipIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.emotion-tooltip-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.emotion-tooltip-time {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

/* Момент-карточки */
.emotion-moment {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius-md);
    padding: 14px;
    margin: 8px 0;
    display: flex;
    gap: 12px;
    border: 1px solid var(--glass-border);
}

.emotion-moment-icon {
    min-width: 32px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.emotion-moment-content {
    flex: 1;
    min-width: 0;
}

.emotion-moment-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.emotion-moment-text {
    font-size: 0.88rem;
    line-height: 1.4;
}

.emotion-moment-quote {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
}

.emotion-moment.interest {
    border-left: 3px solid var(--green);
}

.emotion-moment.interest .emotion-moment-label {
    color: var(--green);
}

.emotion-moment.tension {
    border-left: 3px solid var(--red);
}

.emotion-moment.tension .emotion-moment-label {
    color: var(--red);
}

/* Gauge для общих эмоций */
.emotion-gauges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px 0;
}

.emotion-gauge {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 14px;
    text-align: center;
}

.emotion-gauge-emoji {
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.emotion-gauge-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.emotion-gauge-value {
    font-size: 0.88rem;
    font-weight: 700;
    margin-top: 2px;
}

/* ═══ CALL DETAIL — табы, скелетон, AI-чипы, view transitions ═══ */

.call-skeleton {
    padding: 8px 4px 24px;
}

.sk-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.sk-ring {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: var(--bg-secondary);
}

.sk-block {
    margin-bottom: 22px;
}

.sk-line {
    height: 14px;
    border-radius: 8px;
    background: var(--bg-secondary);
    margin-bottom: 10px;
}

.sk-line--lg { width: 55%; height: 18px; margin: 0 auto; }
.sk-line--md { width: 88%; }
.sk-line--sm { width: 40%; height: 12px; margin: 0 auto; }
.sk-line--short { width: 45%; }
.sk-line--title { width: 35%; height: 16px; margin-bottom: 14px; }

@media (prefers-reduced-motion: no-preference) {
    .shimmer {
        background: linear-gradient(
            90deg,
            var(--bg-secondary) 0%,
            rgba(255, 255, 255, 0.85) 50%,
            var(--bg-secondary) 100%
        );
        background-size: 200% 100%;
        animation: sk-shimmer 1.2s ease-in-out infinite;
    }
}

@keyframes sk-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .shimmer { animation: none; }
}

.call-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 0 16px;
    padding: 4px 2px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 5;
    background: linear-gradient(180deg, var(--bg) 70%, transparent);
}

.call-tabs::-webkit-scrollbar { display: none; }

.call-tab {
    flex: 0 0 auto;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    white-space: nowrap;
}

.call-tab:active {
    transform: scale(0.97);
}

.call-tab.is-active {
    background: var(--accent);
    color: #fff;
}

.call-tab-panel[hidden],
.call-tab-panel:not(.is-active) {
    display: none;
}

.call-tab-panel.is-active {
    display: block;
    min-width: 0;
    width: 100%;
    overflow-x: clip;
    overflow-y: visible;
}

/* Обзор звонка: фиксированный каркас (без «пляски» от Tailwind CDN и flex skill-bar) */
.call-overview-block {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: clip;
}

.call-overview-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: clip;
}

.call-overview-panel .score-hero,
.call-overview-panel .glass-static,
.call-overview-panel .score-transparency,
.call-overview-panel .call-overview-block,
.call-overview-panel .feedback-row {
    max-width: 100%;
    box-sizing: border-box;
}

.call-overview-panel .score-hero-summary {
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: left;
}

.call-overview-panel .score-ring {
    max-width: 100%;
}

.call-overview-panel audio {
    display: block;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
}

.call-overview-panel .score-kpi-grid {
    min-width: 0;
}

.call-overview-panel .score-breakdown-item {
    min-width: 0;
}

.call-overview-stages-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 14px 16px;
    box-sizing: border-box;
}

.call-overview-stage-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e0dfe7;
    background: #fbfaff;
}

.call-overview-stage-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

@media (min-width: 480px) {
    .call-overview-stage-row {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
    }
}

.call-overview-stage-name {
    flex: 0 1 auto;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}

.call-overview-stage-track-wrap {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.call-overview-stage-track {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-secondary);
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

.call-overview-stage-fill {
    height: 100%;
    border-radius: 3px;
    min-width: 0;
    max-width: 100%;
    transition: width 0.35s ease;
}

.call-overview-stage-fill.good { background: var(--green); }
.call-overview-stage-fill.warn { background: var(--yellow); }
.call-overview-stage-fill.bad { background: var(--red); }

.call-overview-stage-score {
    flex: 0 0 auto;
    font-weight: 800;
    font-size: 0.88rem;
    min-width: 2.25rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (min-width: 480px) {
    .call-overview-stage-score {
        text-align: right;
    }
}

.call-overview-stage-comment {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #5b5770;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.score-transparency {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(79, 38, 227, 0.04) 0%, rgba(79, 38, 227, 0.01) 60%, rgba(255, 255, 255, 0.95) 100%);
    padding: 14px 16px;
    box-shadow: 0 8px 20px rgba(20, 16, 43, 0.08);
}

.score-transparency-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.score-transparency-formula {
    font-size: 12px;
    color: var(--text-secondary);
}

.score-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
    min-width: 0;
}

.score-kpi {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 10px;
    min-width: 0;
}

.score-kpi-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.score-kpi-value {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.score-breakdown-list {
    display: grid;
    gap: 8px;
}

.score-breakdown-item {
    border: 1px solid rgba(79, 38, 227, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    padding: 8px 10px;
}

.score-breakdown-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 13px;
    min-width: 0;
}

.score-breakdown-name {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
}
.score-breakdown-val {
    font-weight: 800;
    flex-shrink: 0;
}

.score-breakdown-track {
    height: 7px;
    border-radius: 999px;
    background: #eceaf4;
    overflow: hidden;
}

.score-breakdown-fill {
    height: 100%;
    border-radius: 999px;
}

.score-breakdown-fill.pos {
    background: linear-gradient(90deg, #7B5BFF 0%, #4F26E3 100%);
}

.score-breakdown-fill.neg {
    background: linear-gradient(90deg, #F59E0B 0%, #DC2626 100%);
}

@media (max-width: 720px) {
    .score-kpi-grid { grid-template-columns: 1fr; }
}

.ai-tab-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0 0 12px;
}

.ai-chips-carousel {
    margin: 0 -12px 16px;
    padding: 0 12px;
    overflow: hidden;
}

.ai-chips-track {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.ai-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s, background 0.2s;
}

.ai-chip:active {
    transform: scale(0.96);
}

.ai-chip:hover {
    border-color: var(--accent);
}

.ai-ask-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 14px;
    min-width: 0;
    width: 100%;
}

.ai-question-input {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.ai-ask-row .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    width: auto !important; /* .btn-primary задаёт width:100% и ломает flex-строку */
    padding: 12px 18px !important;
    font-size: 0.98rem !important;
}

.ai-answer {
    min-height: 48px;
}

.ai-answer-loading {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 12px 0;
}

.ai-answer-bubble {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

@media (max-width: 640px) {
    .ai-ask-row {
        flex-direction: column;
    }
    .ai-ask-row .btn {
        width: 100% !important;
    }
    .ai-chips-carousel {
        margin: 0 0 14px;
        padding: 0;
    }
}

body.pull-refresh-hint::before {
    content: 'Отпустите для обновления';
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: var(--accent);
    padding: 6px 0 0;
    font-weight: 600;
}

@supports (view-transition-name: none) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 0.22s;
        animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
}

.calls-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0 20px;
}

.calls-sk-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    min-height: 72px;
}

.calls-sk-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.calls-sk-body {
    flex: 1;
    min-width: 0;
}

.calls-sk-line {
    height: 12px;
    border-radius: 6px;
    background: var(--bg-secondary);
    margin-bottom: 8px;
}

.calls-sk-line--title {
    width: 45%;
    height: 14px;
}

.calls-sk-body .calls-sk-line:last-child {
    width: 88%;
    margin-bottom: 0;
}

.calls-sk-right {
    flex-shrink: 0;
    width: 44px;
    text-align: right;
}

.calls-sk-badge {
    height: 22px;
    border-radius: 8px;
    background: var(--bg-secondary);
    margin-bottom: 6px;
}

.calls-sk-meta {
    height: 10px;
    border-radius: 5px;
    background: var(--bg-secondary);
    margin-left: auto;
    width: 70%;
}

/* Inbox nav badge + лента */
body.has-inbox-nav .bottom-nav .nav-item {
    min-width: 44px;
    padding: 4px 4px;
    font-size: 0.58rem;
}

.nav-item--inbox .nav-icon-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 1px;
}

.nav-item--inbox .nav-icon {
    margin-bottom: 0;
}

.nav-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--red);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
}

.nav-badge--top {
    top: -10px;
    right: -18px;
}

.nav-item--inbox .nav-label-wrap {
    padding-top: 8px;
}

.nav-badge[hidden] {
    display: none !important;
}

.page-inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.page-inbox-header h1 {
    margin: 0;
}

.inbox-list {
    flex-direction: column;
    gap: 12px;
    padding-bottom: 24px;
}

.inbox-bubble {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.inbox-bubble--unread {
    border-color: rgba(0, 122, 255, 0.45);
    box-shadow: 0 0 0 1px var(--accent-light);
}

.inbox-bubble-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.inbox-bubble-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.inbox-bubble-body {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-primary);
    margin-bottom: 10px;
    white-space: pre-wrap;
}

.inbox-bubble-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.inbox-bubble-link:hover {
    text-decoration: underline;
}

/* Глобальный мини-футер: оферта и политика (base.html) */
.app-legal-mini {
    /* footer должен выглядеть одинаково на обычных и legal-страницах.
       margin-top:auto в не-flex раскладке даёт непредсказуемые прыжки отступов. */
    margin: 16px auto 0;
    max-width: 1440px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px 10px;
    text-align: center;
}

.app-legal-mini p {
    margin: 0;
    font-size: 10px;
    line-height: 1.5;
    color: #9a95a8;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.app-legal-mini a {
    color: #8b8799;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.app-legal-mini a:hover {
    color: #5b5770;
}

.app-legal-mini-sep {
    color: #d1ced9;
    margin: 0 0.35em;
}

@media (min-width: 1024px) {
    body.app-logged-in .app-legal-mini {
        padding-bottom: calc(10px + var(--safe-bottom));
    }
}

/* Офлайн-баннер PWA */
.app-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    color: #1c1c1e;
    background: linear-gradient(180deg, #fff3cd 0%, #ffe69c 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.app-offline-banner[hidden] {
    display: none !important;
}

body.has-offline-banner {
    padding-top: calc(44px + env(safe-area-inset-top, 0px));
}

@media (min-width: 900px) {
    body.app-logged-in.has-offline-banner {
        padding-top: calc(96px + env(safe-area-inset-top, 0px));
    }

    body.app-logged-in.has-offline-banner .desktop-nav {
        top: 44px;
    }
}