/* ═══════════════════════════════════════════
   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: 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);
}

/* ═══ НАВИГАЦИЯ — 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;
}

/* ═══ СТРАНИЦЫ ═══ */
.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);
    }
    .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;
}

.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;
}

/* «Ещё»: заметный переход на главную */
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: 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);
}

.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;
}

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

.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;
}

.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: 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;
    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;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.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: 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: 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;
}

.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 var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.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;
}

/* ═══ 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));
    background: linear-gradient(180deg, #e8f0fe 0%, var(--bg) 50%);
}

.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: 64px;
    height: 64px;
    margin: 0 auto 10px;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    line-height: 1.15;
}

.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;
}

/* ═══ USER BADGE ═══ */
.user-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ═══ SCRIPT VIEWER ═══ */
.script-stage {
    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);
    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-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));
    border: 1px solid rgba(37, 99, 235, 0.22);
    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);
}

/* ═══ 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;
}

/* ═══ 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; }
}
