/**
 * OpenAI Realtime Voice Chat - Styles
 * Современный dark theme с неоновыми акцентами
 */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(20, 20, 30, 0.8);
    
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.5);
    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.5);
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    
    --gradient-primary: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    --gradient-glow: linear-gradient(135deg, var(--accent-purple-glow), var(--accent-cyan-glow));
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-purple-glow);
    
    --font-display: 'Outfit', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* 1% высоты viewport (обновляется через JS на mobile/WebView, чтобы не ломался `vh`) */
    --vh: 1vh;
}

/* Светлая тема */
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ed;
    --bg-card: rgba(255, 255, 255, 0.9);
    
    --text-primary: #1a1a1f;
    --text-secondary: #4a4a5a;
    --text-muted: #8a8a9a;
    
    --accent-purple: #7c3aed;
    --accent-purple-glow: rgba(124, 58, 237, 0.3);
    --accent-cyan: #0891b2;
    --accent-cyan-glow: rgba(8, 145, 178, 0.3);
    --accent-pink: #db2777;
    --accent-green: #059669;
    --accent-red: #dc2626;
    --accent-orange: #d97706;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 40px var(--accent-purple-glow);
}

/* Темная тема (по умолчанию) */
[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(20, 20, 30, 0.8);
    
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.5);
    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.5);
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-purple-glow);
}

/* Синяя тема */
[data-theme="blue"] {
    --bg-primary: #0a0f1a;
    --bg-secondary: #121a2a;
    --bg-tertiary: #1a2535;
    --bg-card: rgba(20, 30, 45, 0.8);
    
    --text-primary: #e0e5f0;
    --text-secondary: #90a0b5;
    --text-muted: #506070;
    
    --accent-purple: #6366f1;
    --accent-purple-glow: rgba(99, 102, 241, 0.5);
    --accent-cyan: #0ea5e9;
    --accent-cyan-glow: rgba(14, 165, 233, 0.5);
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-purple-glow);
}

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

html, body {
    height: 100%;
    height: 100vh; /* Fallback */
    height: 100dvh; /* Dynamic viewport height для мобильных */
}

body {
    font-family: var(--font-display);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Улучшения для сенсорных устройств */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Отключаем выделение текста, кроме полей ввода */
    -webkit-tap-highlight-color: transparent;
    /* Убираем подсветку при тапе на iOS */
}

/* Анимированный фон */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-cyan);
    bottom: -50px;
    right: -50px;
    animation-delay: -7s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: var(--accent-pink);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 50px) scale(0.9);
    }
    75% {
        transform: translate(-50px, -20px) scale(1.05);
    }
}

/* Контейнер */
.container {
    position: relative;
    z-index: 1;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height для мобильных */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    max-width: 700px;
    margin: 0 auto;
    min-height: 0; /* Позволяет flex-элементам сжиматься */
}

/* Заголовок */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px 24px;
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
}

/* Кнопка выхода */
.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(30, 30, 40, 0.6);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-logout .btn-icon {
    font-size: 1.2rem;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.25));
    pointer-events: none;
}

.btn-logout .btn-text {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    pointer-events: none;
    white-space: nowrap;
}

.btn-logout:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow:
        0 14px 40px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(6, 182, 212, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.btn-logout:active {
    transform: translateY(0);
    transition: transform var(--transition-fast);
}

.btn-logout:focus-visible {
    outline: 2px solid rgba(6, 182, 212, 0.55);
    outline-offset: 2px;
}

.header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.header .icon {
    font-size: 2.2rem;
    animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

.title-version {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    line-height: 1;
}

.title-temp-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 800;
    font-family: var(--font-display);
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.22);
    backdrop-filter: blur(14px);
    line-height: 1;
    white-space: nowrap;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Иконки в заголовке */
.btn-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
    -webkit-tap-highlight-color: transparent;
}

.btn-header-icon .btn-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.btn-header-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

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

/* Voice Selector Button */
.btn-select-voice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-shadow: 
        0 4px 20px rgba(6, 182, 212, 0.15),
        0 0 0 1px rgba(6, 182, 212, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
    text-transform: none;
    z-index: 10;
    /* Улучшения для сенсорных устройств */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 44px;
}

.btn-select-voice::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Псевдоэлемент не должен блокировать клики */
}

.btn-select-voice .btn-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 4px rgba(6, 182, 212, 0.5));
    z-index: 1;
}

.btn-select-voice:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(139, 92, 246, 0.3));
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 30px rgba(6, 182, 212, 0.25),
        0 0 0 1px rgba(6, 182, 212, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-select-voice:hover::before {
    opacity: 1;
}

.btn-select-voice:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

.btn-select-voice span {
    white-space: nowrap;
    font-weight: 700;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
    z-index: 1;
    position: relative;
    pointer-events: none; /* Чтобы клики проходили через span к кнопке */
}

/* Voice Modal */
.modal-voice {
    max-width: 550px;
}

.voice-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 450px;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
    /* Улучшения прокрутки для мобильных */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.voice-options-list::-webkit-scrollbar {
    width: 6px;
}

.voice-options-list::-webkit-scrollbar-track {
    background: transparent;
}

.voice-options-list::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

.voice-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    border: 2px solid transparent;
    background: 
        linear-gradient(var(--bg-tertiary), var(--bg-tertiary)) padding-box,
        linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05)) border-box;
    position: relative;
    overflow: hidden;
}

.voice-option-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-option-item:hover {
    background: 
        linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15)) padding-box,
        linear-gradient(135deg, rgba(6, 182, 212, 0.4), rgba(139, 92, 246, 0.4)) border-box;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(6, 182, 212, 0.15),
        0 0 0 1px rgba(6, 182, 212, 0.2);
}

.voice-option-item:hover::before {
    opacity: 1;
}

.voice-option-item.active {
    background: 
        linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(139, 92, 246, 0.25)) padding-box,
        linear-gradient(135deg, rgba(6, 182, 212, 0.6), rgba(139, 92, 246, 0.6)) border-box;
    box-shadow: 
        0 8px 30px rgba(6, 182, 212, 0.25),
        0 0 0 1px rgba(6, 182, 212, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.voice-option-item.active::before {
    opacity: 1;
}

.voice-option-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    z-index: 1;
    position: relative;
}

.voice-option-name {
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: capitalize;
    color: var(--text-primary);
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.voice-option-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.voice-option-check {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: white;
    font-size: 1rem;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    z-index: 1;
    position: relative;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.voice-option-item.active .voice-option-check {
    opacity: 1;
    transform: scale(1);
}

/* Анимация появления опций голоса */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


.btn-edit-instructions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-shadow: 
        0 4px 20px rgba(139, 92, 246, 0.15),
        0 0 0 1px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
    text-transform: none;
    z-index: 10;
    /* Улучшения для сенсорных устройств */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 44px;
}

.btn-edit-instructions::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Псевдоэлемент не должен блокировать клики */
}

.btn-edit-instructions .btn-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.5));
    z-index: 1;
}

.btn-edit-instructions:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3));
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 30px rgba(139, 92, 246, 0.25),
        0 0 0 1px rgba(139, 92, 246, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-edit-instructions:hover::before {
    opacity: 1;
}

.btn-edit-instructions:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

.btn-edit-instructions span {
    white-space: nowrap;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    z-index: 1;
    position: relative;
    pointer-events: none; /* Чтобы клики проходили через span к кнопке */
}

.btn-ghost.btn-guest-logs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(6, 182, 212, 0.18));
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(18px);
    box-shadow:
        0 4px 20px rgba(245, 158, 11, 0.14),
        0 0 0 1px rgba(6, 182, 212, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.btn-ghost.btn-guest-logs::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(6, 182, 212, 0.16));
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.btn-ghost.btn-guest-logs .btn-icon {
    font-size: 1.15rem;
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5));
    z-index: 1;
}

.btn-ghost.btn-guest-logs span:not(.btn-icon) {
    white-space: nowrap;
    background: linear-gradient(135deg, #f59e0b, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
    z-index: 1;
    position: relative;
}

.btn-ghost.btn-guest-logs:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.26), rgba(6, 182, 212, 0.26));
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 10px 30px rgba(245, 158, 11, 0.22),
        0 0 0 1px rgba(6, 182, 212, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-ghost.btn-guest-logs:hover::before {
    opacity: 1;
}

.btn-ghost.btn-guest-logs:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

.btn-ghost.btn-guest-logs:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px rgba(6, 182, 212, 0.5),
        0 0 0 6px rgba(245, 158, 11, 0.2);
}

/* Статус бар */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 25px;
    padding: 0;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(30, 30, 40, 0.6);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    transition: var(--transition-normal);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Кнопка обновления статуса */
.btn-refresh-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #10b981;
    cursor: pointer;
    transition: all var(--transition-normal);
    -webkit-tap-highlight-color: transparent;
}

.btn-refresh-status svg {
    width: 18px;
    height: 18px;
}

.btn-refresh-status:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
}

.status-indicator.connecting .status-dot {
    background: var(--accent-orange);
    animation: blink 1s infinite;
}

.status-indicator.connected .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.status-indicator.recording .status-dot {
    background: var(--accent-red);
    animation: pulse-dot 1s infinite;
}

.status-indicator.error .status-dot {
    background: var(--accent-red);
}

.status-indicator.disconnected .status-dot {
    background: var(--text-muted);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { transform: scale(1.2); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.status-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.model-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-purple);
}

.model-select {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 6px 12px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-purple);
    cursor: pointer;
    transition: var(--transition-normal);
    outline: none;
}

.model-select:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
}

.model-select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.model-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Основная область */
.main-area {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

/* Визуализатор */
.visualizer-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: rgba(30, 30, 40, 0.8);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

#visualizer {
    width: 100%;
    height: 100%;
}

.visualizer-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.3);
    transition: var(--transition-normal);
}

.pulse-ring.active {
    animation: pulse-ring 1.5s ease-out infinite;
    border-color: var(--accent-red);
}

.pulse-ring.listening {
    border-color: var(--accent-cyan);
    animation: pulse-ring 1s ease-out infinite;
}

.pulse-ring.processing {
    border-color: var(--accent-orange);
    animation: spin 1s linear infinite;
}

.pulse-ring.speaking {
    border-color: var(--accent-green);
    animation: pulse-ring 0.8s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

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

.mic-icon, .speaker-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.4);
    transition: var(--transition-normal);
    z-index: 1;
    position: relative;
}

.mic-icon svg, .speaker-icon svg {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    transition: var(--transition-normal);
}

.mic-icon.active {
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.mic-icon.active svg {
    color: #10b981;
}

.mic-icon.active::after {
    display: none;
}

.speaker-icon.active {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.speaker-icon.active svg {
    color: var(--accent-green);
}

/* Транскрипция */
.transcript-container {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    overflow: hidden;
    min-height: 150px;
}

.transcript-scroll {
    height: 100%;
    padding: 16px;
    overflow-y: auto;
    /* Улучшения прокрутки для мобильных */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Разрешаем выделение текста в контейнере транскрипта */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.transcript-scroll::-webkit-scrollbar {
    width: 6px;
}

.transcript-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.transcript-placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

.transcript-message {
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    position: relative; /* для попапа реакций/индикаторов */
    animation: slide-in 0.3s ease;
    /* Разрешаем выделение текста в сообщениях */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.transcript-message.user {
    background: rgba(139, 92, 246, 0.1);
    border-left: 3px solid var(--accent-purple);
}

.transcript-message.assistant {
    background: rgba(6, 182, 212, 0.1);
    border-left: 3px solid var(--accent-cyan);
}

.transcript-message.system {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--accent-orange);
    font-size: 0.9rem;
}

.message-role {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.message-text {
    color: var(--text-primary);
    line-height: 1.5;
    /* Разрешаем выделение и копирование текста */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

/* =====================================================
   Реакции на сообщения (лайк/дизлайк)
   ===================================================== */
.message-reactions {
    position: absolute;
    right: 12px;
    bottom: 10px;
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 20, 30, 0.35);
    backdrop-filter: blur(18px);
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    z-index: 5;
}

/* Показываем кнопки реакций всегда на сообщениях бота (assistant) */
.transcript-message.assistant[data-message-id] .message-reactions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Показываем попап по hover или по long-press (reactions-open) для других сообщений. 
   Только когда у сообщения есть message_id (иначе кнопки disabled, но не показываем шум). */
.transcript-message[data-message-id]:hover .message-reactions,
.transcript-message.reactions-open[data-message-id] .message-reactions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.msg-reaction-btn {
    width: 30px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.msg-reaction-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(6, 182, 212, 0.25);
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.12);
}

.msg-reaction-btn:active {
    transform: translateY(0);
}

.msg-reaction-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.msg-reaction-btn.active.like {
    background: rgba(16, 185, 129, 0.35);
    border-color: rgba(16, 185, 129, 0.7);
    border-width: 2px;
    box-shadow: 
        0 0 0 2px rgba(16, 185, 129, 0.25),
        0 4px 12px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.msg-reaction-btn.active.dislike {
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.7);
    border-width: 2px;
    box-shadow: 
        0 0 0 2px rgba(239, 68, 68, 0.25),
        0 4px 12px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.message-reactions.saving {
    opacity: 0.85;
}

/* Маленький индикатор реакции, чтобы было видно даже без hover */
.transcript-message[data-reaction="like"]::after,
.transcript-message[data-reaction="dislike"]::after {
    position: absolute;
    right: 14px;
    bottom: 10px;
    font-size: 0.95rem;
    opacity: 0.75;
    pointer-events: none;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.35));
}

.transcript-message[data-reaction="like"]::after {
    content: "👍";
}

.transcript-message[data-reaction="dislike"]::after {
    content: "👎";
}

/* Кнопки управления */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.controls-secondary {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    justify-content: center;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-xl);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    /* Улучшения для сенсорных устройств */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    /* Минимальный размер для удобного тапа */
    min-height: 44px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.btn-primary:disabled {
    opacity: 0.7;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(6, 182, 212, 0.5));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-primary:disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-xl);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: #ffffff;
    color: #000000;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
    justify-content: center;
    transition: all var(--transition-normal);
}

/* Статус 1: Готов к разговору (белая, активна) */
.btn-primary.btn-status-ready {
    background: #ffffff;
    color: #000000;
}

.btn-primary.btn-status-ready:hover:not(:disabled) {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Статус 2: Продолжить разговор (белая, активна) */
.btn-primary.btn-status-paused {
    background: #ffffff;
    color: #000000;
}

.btn-primary.btn-status-paused:hover:not(:disabled) {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Статус 3: Запись (серая, disabled) */
.btn-primary.btn-status-recording {
    background: rgba(255, 255, 255, 0.3);
    color: rgba(0, 0, 0, 0.4);
    cursor: not-allowed;
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.3);
    color: rgba(0, 0, 0, 0.4);
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(40, 40, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    flex: 1;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(50, 50, 60, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-voice {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-reset {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 146, 60, 0.15));
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    transition: all 0.3s ease;
}

.btn-reset:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(251, 146, 60, 0.25));
    border-color: rgba(245, 158, 11, 0.5);
    color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
    transform: translateY(-1px);
}

.btn-reset:active:not(:disabled) {
    transform: translateY(0);
}

/* Подсказка */
.hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hint-icon {
    font-size: 1.1rem;
}

/* Адаптивность */

/* Планшеты и средние экраны */
@media (max-width: 1024px) {
    .container {
        max-width: 90%;
        padding: 25px 20px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .header-actions {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn-select-voice,
    .btn-edit-instructions,
    .btn-ghost.btn-guest-logs {
        min-width: 120px;
        padding: 12px 18px;
        font-size: 0.9rem;
    }
}

/* Маленькие планшеты */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
        height: 100vh;
        overflow-y: auto;
    }
    
    body {
        overflow: auto;
    }
    
    .header h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .header-actions {
        margin-top: 12px;
        gap: 8px;
    }
    
    .btn-select-voice,
    .btn-edit-instructions,
    .btn-ghost.btn-guest-logs {
        min-width: 110px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .visualizer-container {
        height: 160px;
    }
    
    .main-area {
        gap: 16px;
    }
    
    .controls {
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Мобильные устройства */
@media (max-width: 600px) {
    .container {
        padding: 12px 10px;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
    }
    
    .header {
        margin-bottom: 10px;
    }
    
    .header h1 {
        font-size: 1.5rem;
        flex-direction: row;
        gap: 8px;
    }
    
    .header .icon {
        font-size: 1.4rem;
    }
    
    .subtitle {
        font-size: 0.7rem;
        margin-top: 2px;
    }
    
    /* Кнопки в заголовке - горизонтально, компактно */
    .header-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .btn-select-voice,
    .btn-edit-instructions,
    .btn-ghost.btn-guest-logs {
        width: auto;
        min-width: auto;
        padding: 8px 12px;
        font-size: 0.75rem;
        justify-content: center;
        flex: 1;
        max-width: 120px;
        min-height: 36px;
    }
    
    .btn-select-voice .btn-icon,
    .btn-edit-instructions .btn-icon,
    .btn-ghost.btn-guest-logs .btn-icon {
        font-size: 0.9rem;
    }
    
    .status-bar {
        padding: 6px 12px;
        margin-bottom: 10px;
    }
    
    .status-text {
        font-size: 0.75rem;
    }
    
    .visualizer-container {
        height: 100px;
    }
    
    .main-area {
        gap: 8px;
        flex: 1;
        min-height: 0;
    }
    
    .transcript-container {
        min-height: 80px;
        flex: 1;
    }
    
    .transcript-placeholder {
        padding: 20px 12px;
        font-size: 0.85rem;
    }
    
    /* Кнопки управления - горизонтально */
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        gap: 6px;
        margin-top: 10px;
        justify-content: center;
    }
    
    .btn {
        width: auto;
        flex: 1;
        min-width: 0;
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    .btn .btn-text {
        display: none;
    }
    
    .btn .btn-icon svg {
        width: 18px;
        height: 18px;
    }
    
    /* Показываем текст только для основной кнопки */
    .btn-primary .btn-text {
        display: inline;
    }
    
    .btn-primary {
        flex: 2;
        max-width: none;
    }
    
    .hint {
        text-align: center;
        flex-direction: column;
        gap: 2px;
        margin-top: 8px;
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    .hint-icon {
        font-size: 0.9rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .container {
        padding: 10px 8px;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .header .icon {
        font-size: 1.3rem;
    }
    
    .subtitle {
        font-size: 0.65rem;
    }
    
    .header-actions {
        gap: 4px;
    }
    
    .btn-select-voice,
    .btn-edit-instructions,
    .btn-ghost.btn-guest-logs {
        padding: 6px 10px;
        font-size: 0.7rem;
        max-width: 100px;
        min-height: 32px;
    }
    
    .visualizer-container {
        height: 80px;
    }
    
    .transcript-container {
        min-height: 60px;
    }
    
    .controls {
        gap: 4px;
    }
    
    .btn {
        padding: 8px 10px;
        font-size: 0.75rem;
        min-height: 36px;
    }
    
    .modal-content {
        margin: 5px;
        max-height: 98vh;
    }
}

/* Высокие экраны (например, современные смартфоны) */
@media (min-height: 750px) and (max-width: 600px) {
    .container {
        padding: 16px 12px;
    }
    
    .visualizer-container {
        height: 120px;
    }
    
    .transcript-container {
        min-height: 150px;
    }
    
    .controls {
        margin-top: 16px;
    }
    
    .btn {
        padding: 12px 14px;
    }
    
    .hint {
        margin-top: 12px;
    }
}

/* Очень высокие экраны (iPhone Pro Max и подобные) */
@media (min-height: 850px) and (max-width: 600px) {
    .container {
        padding: 20px 14px;
    }
    
    .visualizer-container {
        height: 140px;
    }
    
    .transcript-container {
        min-height: 180px;
    }
}

/* Очень широкие экраны */
@media (min-width: 1200px) {
    .container {
        max-width: 800px;
        padding: 40px 30px;
    }
    
    .header h1 {
        font-size: 2.8rem;
    }
    
    .visualizer-container {
        height: 240px;
    }
    
    .btn {
        padding: 16px 28px;
        font-size: 1rem;
    }
}

/* Поддержка темной темы системы */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0a0a0f;
        --bg-secondary: #12121a;
        --bg-tertiary: #1a1a25;
    }
}

/* Поддержка уменьшенной анимации */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .orb {
        animation: none;
    }
    
    .pulse-ring {
        animation: none;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 900px) and (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: 10px 16px;
        height: 100vh;
        overflow-y: auto;
    }
    
    .header {
        margin-bottom: 12px;
    }
    
    .header h1 {
        font-size: 1.6rem;
        flex-direction: row;
        gap: 8px;
    }
    
    .header-actions {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 8px;
        gap: 6px;
    }
    
    .btn-select-voice,
    .btn-edit-instructions,
    .btn-ghost.btn-guest-logs {
        width: auto;
        min-width: 100px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .status-bar {
        margin-bottom: 12px;
        padding: 8px 12px;
    }
    
    .visualizer-container {
        height: 100px;
    }
    
    .main-area {
        gap: 10px;
    }
    
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 12px;
        gap: 6px;
    }
    
    .btn {
        width: auto;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .hint {
        margin-top: 8px;
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Модальное окно подтверждения удаления должно быть поверх других */
#confirmDeleteTesterModal {
    z-index: 10000;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay .modal-content {
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: none; /* вместо translateY(0) - меньше шансов сломать скролл на iOS/WebView */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    max-height: calc(100dvh - 40px);
    max-height: calc(var(--vh) * 100 - 40px); /* iOS/Telegram WebView: используем window.innerHeight */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* body скрыт, скроллим только .modal-body */
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    /* Разрешаем выделение текста в заголовках модальных окон */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Для админ панели - явно показываем полосу прокрутки когда нужно */
.modal-admin .modal-body {
    overflow-y: auto; /* Всегда показываем прокрутку если контент больше */
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.4) transparent;
}

.modal-admin .modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-admin .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-admin .modal-body::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
    border-radius: 4px;
}

.modal-admin .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.6);
}

.instructions-textarea {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    background: 
        linear-gradient(var(--bg-tertiary), var(--bg-tertiary)) padding-box,
        linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3)) border-box;
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 20px rgba(139, 92, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    /* Улучшения для сенсорных устройств */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: text; /* Разрешаем выделение текста в полях ввода */
}

.instructions-textarea:focus {
    background: 
        linear-gradient(var(--bg-tertiary), var(--bg-tertiary)) padding-box,
        linear-gradient(135deg, rgba(139, 92, 246, 0.6), rgba(236, 72, 153, 0.6)) border-box;
    box-shadow: 
        0 8px 30px rgba(139, 92, 246, 0.2),
        0 0 0 1px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(1.01);
}

.modal-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px 18px;
    background: 
        linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1)) padding-box,
        linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3)) border-box;
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.1);
}

.info-icon {
    font-size: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(236, 72, 153, 0.05));
}

/* Адаптивность модальных окон */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-content {
        max-height: calc(var(--vh) * 100 - 20px);
        width: 100%;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-body {
        padding: 16px 20px;
    }
    
    .modal-footer {
        padding: 16px 20px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .modal-overlay {
        padding: 5px;
    }
    
    .modal-content {
        max-height: calc(var(--vh) * 100 - 10px);
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 14px 16px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 14px 16px;
    }
    
    .instructions-textarea {
        min-height: 250px;
        font-size: 0.85rem;
        padding: 16px;
    }
    
    .modal-footer {
        padding: 14px 16px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    .modal-content {
        border-radius: 12px;
        max-height: calc(var(--vh) * 100 - 10px);
    }
    
    .modal-header {
        padding: 12px 14px;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 12px 14px;
    }
    
    .instructions-textarea {
        min-height: 200px;
        font-size: 0.8rem;
        padding: 14px;
    }
    
    .modal-footer {
        padding: 12px 14px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

/* =====================================================
   ЛОГИ ГОСТЕЙ - Полностью новая архитектура (glm = guest logs modal)
   ===================================================== */

/* Overlay для модального окна логов */
#guestLogsModal.modal-overlay {
    padding: 20px;
    align-items: center;
    justify-content: center;
}

/* Главный контейнер модального окна */
.guest-logs-modal {
    width: 100%;
    max-width: 1100px;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

/* Шапка модального окна */
.glm-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(6, 182, 212, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glm-title {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.glm-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.glm-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Тело модального окна - главный flex-контейнер */
.glm-body {
    flex: 1;
    min-height: 0; /* КРИТИЧНО: позволяет flex-элементу сжиматься */
    display: flex;
    gap: 16px;
    padding: 16px;
    overflow: hidden; /* Не скроллим body, скроллим только внутренние списки */
}

/* ========== ЛЕВАЯ ПАНЕЛЬ (сайдбар) ========== */
.glm-sidebar {
    flex-shrink: 0;
    width: 320px;
    display: flex;
    flex-direction: column;
    min-height: 0; /* КРИТИЧНО */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px;
}

.glm-sidebar-header {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.glm-search {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.glm-search:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.glm-refresh-btn {
    flex-shrink: 0;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.glm-refresh-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
}

.glm-sidebar-hint {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0 0 10px 0;
}

/* Список IP - ПРОКРУЧИВАЕМЫЙ */
.glm-ip-list {
    flex: 1;
    min-height: 0; /* КРИТИЧНО для работы overflow */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    /* Плавный скролл для мобильных */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.glm-ip-list::-webkit-scrollbar {
    width: 5px;
}

.glm-ip-list::-webkit-scrollbar-track {
    background: transparent;
}

.glm-ip-list::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

.glm-ip-list::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* IP-карточка */
.ip-card {
    flex-shrink: 0;
    width: 100%;
    text-align: left;
    padding: 12px;
    border-radius: 8px;
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.ip-card:hover {
    background: rgba(40, 40, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

.ip-card.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.ip-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}

.ip-text {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.badge {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.ip-card-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.ip-card-login {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    opacity: 0.95;
}

.ip-card-preview {
    font-size: 0.85rem;
    color: var(--text-primary);
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== ПРАВАЯ ПАНЕЛЬ (основная) ========== */
.glm-main {
    flex: 1;
    min-width: 0; /* Для корректного сжатия в flex */
    min-height: 0; /* КРИТИЧНО */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Тулбар */
.glm-main-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.glm-selected-ip {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.glm-count-pill {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Фильтры и кнопки скачивания */
.glm-controls {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.glm-date-filters,
.glm-download-btns {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.glm-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.glm-date-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.glm-date-group span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.glm-date-input {
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    outline: none;
    width: 130px;
}

.glm-date-input:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.glm-select {
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    outline: none;
    min-width: 160px;
}

.glm-select:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.glm-date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

.glm-context-input {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.glm-context-number {
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    outline: none;
    width: 80px;
    text-align: center;
}

.glm-context-number:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.glm-context-hint {
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.7;
    font-style: italic;
}

.glm-clear-dates {
    padding: 7px 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    color: #fca5a5;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.glm-clear-dates:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.glm-dl-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.glm-dl-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.4);
}

.glm-dl-btn.active {
    background: rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.5);
    color: white;
}

.glm-dl-btn.glm-dl-good {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

.glm-dl-btn.glm-dl-good:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.glm-dl-btn.glm-dl-bad {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.glm-dl-btn.glm-dl-bad:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.glm-dl-btn.glm-dl-like {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

.glm-dl-btn.glm-dl-like:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.glm-dl-btn.glm-dl-dislike {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.glm-dl-btn.glm-dl-dislike:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.glm-dl-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== КОНТЕЙНЕР СООБЩЕНИЙ (ПРОКРУЧИВАЕМЫЙ) ========== */
.glm-messages-wrapper {
    flex: 1;
    min-height: 0; /* КРИТИЧНО для работы overflow */
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

/* Лоадер */
.glm-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    z-index: 10;
}

.glm-spinner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent-purple);
    animation: glm-spin 0.8s linear infinite;
}

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

/* Пустое состояние */
.glm-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

.glm-empty-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.glm-empty-desc {
    margin: 0;
    font-size: 0.9rem;
}

/* Список сообщений - ПРОКРУЧИВАЕМЫЙ */
.glm-messages {
    flex: 1;
    min-height: 0; /* КРИТИЧНО */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Плавный скролл */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Выделение текста */
    -webkit-user-select: text;
    user-select: text;
}

.glm-messages::-webkit-scrollbar {
    width: 6px;
}

.glm-messages::-webkit-scrollbar-track {
    background: transparent;
}

.glm-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

.glm-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Стили для сессий */
.session-container {
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.session-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.session-id {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.session-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.session-user {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--text-secondary);
}

.session-prompt-version {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.28);
    color: rgba(103, 232, 249, 0.95);
}

.session-rating-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.session-rating-badge.good {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.session-rating-badge.bad {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-download-session {
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-download-session:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
    transform: translateY(-1px);
}

.btn-download-ip {
    padding: 10px 16px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-download-ip:hover {
    background: #059669;
    transform: translateY(-1px);
}

.session-messages {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Пузырёк сообщения */
.log-bubble {
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    -webkit-user-select: text;
    user-select: text;
}

.log-bubble.user {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.log-bubble.assistant {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.log-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.pill.user {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
}

.pill.assistant {
    background: rgba(6, 182, 212, 0.15);
    color: #5eead4;
}

.log-text {
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    -webkit-user-select: text;
    user-select: text;
    cursor: text;
}

/* ========== АДАПТИВНОСТЬ ДЛЯ ЛОГОВ ========== */

/* Планшеты */
@media (max-width: 900px) {
    .glm-body {
        flex-direction: column;
    }
    
    .glm-sidebar {
        width: 100%;
        max-height: 200px;
    }
    
    .glm-ip-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 10px;
        padding-bottom: 8px;
    }
    
    .ip-card {
        min-width: 200px;
        flex-shrink: 0;
    }
    
    .glm-main {
        flex: 1;
    }
}

/* Мобильные */
@media (max-width: 600px) {
    #guestLogsModal.modal-overlay {
        padding: 10px;
    }
    
    .guest-logs-modal {
        height: 95vh;
        max-height: 95vh;
        border-radius: 16px;
    }
    
    .glm-header {
        padding: 12px 16px;
    }
    
    .glm-title {
        font-size: 1.2rem;
    }
    
    .glm-body {
        padding: 10px;
        gap: 10px;
    }
    
    .glm-sidebar {
        max-height: 160px;
        padding: 10px;
    }
    
    .glm-sidebar-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .glm-refresh-btn {
        width: 100%;
    }
    
    .glm-sidebar-hint {
        font-size: 0.8rem;
    }
    
    .ip-card {
        min-width: 160px;
        padding: 10px;
    }
    
    .ip-text {
        font-size: 0.85rem;
    }
    
    .glm-main-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .glm-selected-ip {
        font-size: 1rem;
        text-align: center;
    }
    
    .glm-count-pill {
        text-align: center;
    }
    
    .glm-controls {
        padding: 10px;
        gap: 8px;
    }
    
    .glm-date-filters,
    .glm-download-btns {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .glm-date-group {
        justify-content: space-between;
    }
    
    .glm-date-input {
        flex: 1;
    }
    
    .glm-dl-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .session-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .btn-download-session {
        width: 100%;
        justify-content: center;
    }
    
    .btn-download-ip {
        width: 100%;
        justify-content: center;
    }
}

/* Очень маленькие экраны */
@media (max-width: 400px) {
    .glm-header {
        padding: 10px 12px;
    }
    
    .glm-title {
        font-size: 1.1rem;
    }
    
    .glm-close {
        width: 32px;
        height: 32px;
    }
    
    .glm-body {
        padding: 8px;
    }
    
    .glm-sidebar {
        max-height: 140px;
    }
    
    .ip-card {
        min-width: 140px;
    }
    
    .glm-messages {
        padding: 8px;
    }
    
    .log-bubble {
        padding: 10px;
    }
    
    .session-messages {
        padding: 8px;
    }
}

/* ----- Кнопки оценки сессии ----- */
.rating-controls {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.4s ease forwards;
}

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

.rating-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.rating-buttons {
    display: flex;
    gap: 12px;
}

.btn-rate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.btn-rate::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-rate-good {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.btn-rate-good::before {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.1));
}

.btn-rate-good:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.25));
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
}

.btn-rate-good:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-rate-good.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(6, 182, 212, 0.35));
    border-color: rgba(16, 185, 129, 0.7);
    box-shadow: 
        0 0 20px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.btn-rate-bad {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(236, 72, 153, 0.15));
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-rate-bad::before {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(236, 72, 153, 0.1));
}

.btn-rate-bad:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(236, 72, 153, 0.25));
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.2);
}

.btn-rate-bad:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-rate-bad.active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(236, 72, 153, 0.35));
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow: 
        0 0 20px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.btn-rate:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-rate.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rate-icon {
    font-size: 1.3rem;
}

.rate-text {
    font-weight: 700;
}

.rating-status {
    min-width: 180px;
    text-align: center;
}

.rating-saved {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.rating-saved.good {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.rating-saved.bad {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(236, 72, 153, 0.2));
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.rating-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    color: var(--text-muted);
    border: 1px solid rgba(139, 92, 246, 0.2);
    animation: fadeIn 0.3s ease;
}


/* ----- Модальное окно подтверждения ----- */
.modal-confirm {
    max-width: 420px;
    text-align: center;
}

.modal-confirm .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-confirm .modal-header h2 {
    color: #fbbf24;
    font-size: 1.3rem;
    margin: 0;
}

.modal-confirm .modal-body {
    padding: 0 20px 20px;
}

.confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    padding: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 146, 60, 0.2));
    border: 2px solid rgba(245, 158, 11, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-icon svg {
    width: 32px;
    height: 32px;
    color: #fbbf24;
}

.confirm-message {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0 0 12px;
    font-weight: 500;
    line-height: 1.4;
}

.confirm-submessage {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}


.modal-footer .btn {
    min-width: 120px;
    justify-content: center;
}

.modal-footer .btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
}

.modal-footer .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.modal-footer .btn-reset {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 146, 60, 0.2));
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.modal-footer .btn-reset:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(251, 146, 60, 0.3));
    border-color: rgba(245, 158, 11, 0.6);
    color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}


/* =====================================================
   АДМИН ПАНЕЛЬ - Стили управления
   ===================================================== */

/* Кнопка открытия админ панели */
.btn-admin-stats {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.20), rgba(59, 130, 246, 0.20));
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-shadow:
        0 4px 20px rgba(16, 185, 129, 0.14),
        0 0 0 1px rgba(59, 130, 246, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
    position: relative;
    overflow: hidden;
    min-width: 140px;
    text-transform: none;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 44px;
}

.btn-admin-stats:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.30), rgba(59, 130, 246, 0.30));
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 8px 30px rgba(16, 185, 129, 0.22),
        0 0 0 1px rgba(59, 130, 246, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-admin-stats span:not(.btn-icon) {
    white-space: nowrap;
    font-weight: 800;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    z-index: 1;
    position: relative;
}

.btn-admin-stats .btn-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.35));
    z-index: 1;
}

.btn-admin-panel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(245, 158, 11, 0.2));
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-shadow: 
        0 4px 20px rgba(239, 68, 68, 0.15),
        0 0 0 1px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
    text-transform: none;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 44px;
}

.btn-admin-panel:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(245, 158, 11, 0.3));
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 30px rgba(239, 68, 68, 0.25),
        0 0 0 1px rgba(239, 68, 68, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-admin-panel span:not(.btn-icon) {
    white-space: nowrap;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    z-index: 1;
    position: relative;
}

.btn-admin-panel .btn-icon {
    font-size: 1.2rem;
    z-index: 1;
}

/* Модальное окно админ панели */
.modal-admin {
    max-width: 700px;
    width: 95%;
    /* Разрешаем выделение текста в админ панели */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.modal-admin-stats {
    max-width: 760px;
    width: 95%;
    /* Разрешаем выделение текста */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.admin-stats-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.admin-stats-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 14px;
    color: var(--text-secondary);
}

.admin-stats-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-stats-head,
.admin-stats-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-stats-head {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-stats-user {
    font-weight: 800;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-stats-chars {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 120px;
}

.admin-stats-chars-main {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.admin-stats-chars-today {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.admin-stats-last {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: right;
    min-width: 140px;
}

.admin-stats-row.inactive {
    opacity: 0.75;
}

/* Статистика по символам */
.char-stats-section {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1), rgba(0, 191, 255, 0.1));
    border: 1px solid rgba(138, 43, 226, 0.2);
    border-radius: var(--radius-lg);
}

.char-stats-title {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.char-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.char-stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

.char-stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(138, 43, 226, 0.3);
    transform: translateY(-2px);
}

.char-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.char-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.2;
}

.char-stat-change {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.char-stat-change-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1.2;
}

.char-stat-change-icon {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.char-stat-change-positive {
    color: #4ade80;
}

.char-stat-change-positive .char-stat-change-value {
    color: #4ade80;
}

.char-stat-change-negative {
    color: #f87171;
}

.char-stat-change-negative .char-stat-change-value {
    color: #f87171;
}

.char-stat-change-neutral {
    color: var(--text-secondary);
}

.char-stat-change-neutral .char-stat-change-value {
    color: var(--text-secondary);
}

/* Статистика по реакциям */
.reaction-stats-section {
    margin-top: 24px;
    margin-bottom: 24px;
}

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

.reaction-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.reaction-stat-card {
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.reaction-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.reaction-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.reaction-stat-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.reaction-stat-icons .thumbs-up {
    color: #facc15;
}

.reaction-stat-icons .thumbs-down {
    color: #ef4444;
}

/* Адаптивность для статистики по символам */
@media (max-width: 600px) {
    .char-stats-section {
        padding: 16px;
    }

    .char-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .char-stat-value {
        font-size: 1.5rem;
    }

    .char-stat-change-value {
        font-size: 1.5rem;
    }

    /* Адаптивность для таблицы пользователей */
    .admin-stats-head,
    .admin-stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }

    .admin-stats-head > div {
        display: none;
    }

    .admin-stats-head > div:first-child {
        display: block;
        font-size: 0.75rem;
    }

    .admin-stats-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .admin-stats-user {
        font-size: 0.9rem;
        width: 100%;
    }

    .admin-stats-chars {
        width: 100%;
        align-items: flex-start;
        min-width: auto;
    }

    .admin-stats-last {
        width: 100%;
        text-align: left;
        min-width: auto;
    }

    .admin-stats-chars::before {
        content: 'Символы: ';
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 4px;
    }

    .admin-stats-last::before {
        content: 'Последнее использование: ';
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 4px;
    }
}

.admin-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0; /* Убираем padding, т.к. он уже есть у .modal-body */
    /* Разрешаем выделение текста */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.admin-section {
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: visible;
    flex-shrink: 0;
    min-height: auto;
}

.admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    /* Разрешаем выделение текста в заголовках */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.admin-section-content {
    padding: 16px 20px;
    /* Разрешаем выделение текста */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    /* Блоки контента должны расти по содержимому */
    min-height: auto;
    flex-shrink: 0;
}

.admin-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.5;
    /* Разрешаем выделение текста в подсказках */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Метрики промпта (админка) */
.prompt-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.prompt-metric-card {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.prompt-metric-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.prompt-metric-value {
    margin-top: 6px;
    font-size: 1.35rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.prompt-metric-sub {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.prompt-metrics-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-metrics-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.prompt-metrics-row.current {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.22);
}

.prompt-metrics-version {
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--text-primary);
}

.prompt-metrics-stats {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

@media (max-width: 520px) {
    .prompt-metrics-grid {
        grid-template-columns: 1fr;
    }
    .prompt-metrics-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .prompt-metrics-stats {
        white-space: normal;
    }
}

/* Убеждаемся, что все кнопки в админ панели не выделяются */
.modal-admin button,
.modal-admin .btn,
.modal-admin .toggle-switch {
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Toggle Switch для режима обслуживания */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    border-color: rgba(239, 68, 68, 0.5);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.maintenance-status {
    margin-bottom: 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    /* Разрешаем выделение текста в бейджах статуса */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.status-badge.status-on {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(245, 158, 11, 0.2));
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge.status-off {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Форма ввода в админке */
.admin-input,
.admin-textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-display);
    transition: all 0.3s ease;
}

.admin-input:focus,
.admin-textarea:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.admin-input::placeholder,
.admin-textarea::placeholder {
    color: var(--text-muted);
}

.admin-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: var(--font-display);
    line-height: 1.5;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    /* Разрешаем выделение текста в лейблах */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    /* Разрешаем выделение текста в подсказках форм */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Кнопка добавления тестировщика */
.btn-add-tester {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.btn-add-tester:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-add-tester .btn-icon {
    font-size: 1rem;
}

/* Список тестировщиков */
.testers-list {
    max-height: none;
    overflow: visible;
    margin-top: 16px;
}

.testers-search {
    width: 100%;
    padding: 12px 16px;
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.testers-search:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.testers-category {
    margin-bottom: 12px;
}

.testers-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.testers-category-header:hover {
    background: rgba(40, 40, 50, 0.8);
}

.testers-category-header .chevron {
    font-size: 0.8rem;
    transition: transform var(--transition-normal);
}

.testers-category-header.expanded .chevron {
    transform: rotate(180deg);
}

.testers-category-content {
    margin-top: 8px;
    padding: 8px;
    background: rgba(20, 20, 30, 0.4);
    border-radius: 8px;
}
}

.testers-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: var(--text-secondary);
    /* Разрешаем выделение текста */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.testers-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    /* Разрешаем выделение текста */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.testers-empty p:first-child {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.testers-empty .hint {
    font-size: 0.85rem;
}

.testers-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tester-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.tester-card:hover {
    background: rgba(40, 40, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

.tester-card.inactive {
    opacity: 0.6;
}

.tester-card.inactive .tester-email {
    text-decoration: line-through;
}

.tester-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tester-email {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    /* Разрешаем выделение email тестировщиков */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.tester-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tester-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 6px;
    color: #a78bfa;
    /* Разрешаем выделение текста времени */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.tester-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    /* Разрешаем выделение текста статуса */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    padding: 3px 8px;
    border-radius: 6px;
}

.tester-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.tester-status.suspended {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.tester-deadline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.22);
    color: #fbbf24;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.tester-priority {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 4px;
}

.tester-priority input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.tester-priority .priority-star {
    color: #facc15;
    font-size: 0.9rem;
}

.tester-deactivation-reason {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: #f87171;
    font-size: 0.85rem;
    line-height: 1.4;
}

.tester-actions-btns {
    display: flex;
    gap: 8px;
}

.btn-check-tester,
.btn-edit-tester {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #a78bfa;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.btn-check-tester:hover,
.btn-edit-tester:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.btn-delete-tester {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.btn-delete-tester:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Кнопка одобрения заявки */
.btn-approve-application {
    padding: 8px 14px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    color: #4ade80;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.btn-approve-application:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
    transform: translateY(-1px);
}

/* Карточка заявки */
.application-card {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
}

.application-card .tester-info {
    width: 100%;
}

.application-card .tester-meta {
    flex-wrap: wrap;
}

.application-email,
.application-tg,
.application-date,
.application-details {
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.application-text {
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    font-style: italic;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.application-card .tester-actions-btns {
    width: 100%;
    justify-content: flex-end;
}

/* Модальное окно добавления/редактирования тестировщика */
.modal-add-tester,
.modal-edit-tester,
.modal-tester-credentials {
    max-width: 450px;
}

.tester-email-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    /* Разрешаем выделение email */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.tester-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-warning {
    flex: 1;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 146, 60, 0.2));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    color: #fbbf24;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(251, 146, 60, 0.3));
    transform: translateY(-1px);
}

.btn-danger {
    flex: 1;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #f87171;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(236, 72, 153, 0.3));
    transform: translateY(-1px);
}

/* Отображение нового пароля */
.new-password-display {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
}

.new-password-display label {
    display: block;
    margin-bottom: 8px;
    color: #34d399;
    font-weight: 600;
    font-size: 0.9rem;
}

.password-copy-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.password-copy-box code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-all;
    /* Разрешаем выделение (body по умолчанию запрещает user-select) */
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

.btn-copy {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Адаптивность для админ панели */
@media (max-width: 768px) {
    .modal-admin {
        max-width: 98%;
    }
    
    .admin-body {
        padding: 0; /* Padding уже у .modal-body */
        gap: 16px;
    }
    
    .admin-section-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .admin-section-header h3 {
        font-size: 1rem;
    }
    
    .admin-section-content {
        padding: 12px 16px;
    }
    
    .testers-list {
        max-height: none;
        overflow: visible;
    }
    
    .tester-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .tester-actions-btns {
        width: 100%;
    }
    
    .btn-edit-tester {
        flex: 1;
        text-align: center;
    }
    
    .tester-actions {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 600px) {
    .btn-admin-panel,
    .btn-admin-stats {
        min-width: auto;
        padding: 8px 12px;
        font-size: 0.75rem;
        max-width: 120px;
        flex: 1;
    }
    
    .btn-admin-panel span:not(.btn-icon),
    .btn-admin-stats span:not(.btn-icon) {
        display: none;
    }
    
    .toggle-switch {
        width: 48px;
        height: 24px;
    }
    
    .toggle-slider:before {
        height: 18px;
        width: 18px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(22px);
    }
}

/* ----- Сообщение о переподключении ----- */
.transcript-message.system .message-text {
    color: var(--text-primary);
}

/* Зелёный текст для успешного переподключения */
.transcript-message.system:has(.message-text:contains("Переподключено")),
.transcript-message.system:has(.message-text:contains("✅")) {
    border-left-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
}

/* Специальные стили для системных сообщений с эмодзи */
.transcript-message.system .message-text:first-letter {
    font-size: 1.1em;
}

/* Адаптивность для кнопок оценки и скачивания */
@media (max-width: 768px) {
    .rating-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }
    
    .rating-label {
        font-size: 0.85rem;
    }
    
    .rating-buttons {
        justify-content: center;
        gap: 10px;
    }
    
    .btn-rate {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .rating-status {
        min-width: auto;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .rating-controls {
        flex-direction: row;
        gap: 8px;
        padding: 10px 12px;
        margin-top: 10px;
    }
    
    .rating-label {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .rating-buttons {
        gap: 8px;
    }
    
    .btn-rate {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .rate-icon {
        font-size: 1rem;
    }
    
    .rate-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .rating-controls {
        padding: 8px 10px;
    }
    
    .rating-label {
        font-size: 0.7rem;
    }
    
    .btn-rate {
        padding: 6px 10px;
    }
    
    /* Адаптивность для модального окна подтверждения */
    .modal-confirm {
        max-width: 90vw;
        margin: 20px;
    }
    
    .modal-confirm .modal-body {
        padding: 0 16px 16px;
    }
    
    .confirm-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 16px;
    }
    
    .confirm-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .confirm-message {
        font-size: 1rem;
    }
    
    .confirm-submessage {
        font-size: 0.9rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
        min-width: auto;
    }
}

/* =====================================================
   Terms of Service (Условия использования)
   ===================================================== */

/* Модалка принятия условий на главной */
.modal-terms {
    max-width: 720px;
}

.terms-summary {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
}

[data-theme="light"] .terms-summary {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.terms-lead {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.terms-bullets {
    margin-top: 10px;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.terms-bullets li {
    margin: 6px 0;
}

.terms-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.terms-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    user-select: text;
}

[data-theme="light"] .terms-link {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
}

.terms-link:hover {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15), 0 10px 30px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.terms-checkbox {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    user-select: text;
}

[data-theme="light"] .terms-checkbox {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

.terms-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 4px;
    accent-color: var(--accent-purple);
}

.terms-error {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    font-size: 0.92rem;
    user-select: text;
}

[data-theme="light"] .terms-error {
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

/* Страница /terms */
body.terms-body {
    overflow: auto;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.terms-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 36px 20px 60px;
    max-width: 980px;
    margin: 0 auto;
}

.terms-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
    padding: 24px;
}

/* Адаптация границ для светлой темы */
[data-theme="light"] .terms-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--bg-card);
}

.terms-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.terms-title {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.terms-meta {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.terms-actions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.terms-actions .btn {
    width: auto;
    min-width: 180px;
}

/* Синяя кнопка для страницы условий */
.terms-actions .btn-secondary {
    background: var(--accent-cyan) !important;
    color: white !important;
    border: none !important;
}

.terms-actions .btn-secondary:hover:not(:disabled) {
    background: #0891b2 !important;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

[data-theme="light"] .terms-actions .btn-secondary {
    background: #0ea5e9 !important;
    color: white !important;
}

[data-theme="light"] .terms-actions .btn-secondary:hover:not(:disabled) {
    background: #0284c7 !important;
}

[data-theme="blue"] .terms-actions .btn-secondary {
    background: #0ea5e9 !important;
    color: white !important;
}

[data-theme="blue"] .terms-actions .btn-secondary:hover:not(:disabled) {
    background: #0284c7 !important;
}

.terms-accept-box {
    margin-top: 18px;
}

.terms-accept-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.terms-accept-row .btn {
    width: auto;
    min-width: 220px;
}

.terms-accept-status {
    margin-top: 16px;
}

.btn-accepted {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: default;
    opacity: 0.8;
}

.btn-accepted .status-icon {
    font-size: 1.1rem;
}

/* Зеленая кнопка для страницы условий */
#termsPageAcceptBtn {
    background: #10b981 !important;
    color: white !important;
    border: none !important;
}

#termsPageAcceptBtn:hover:not(:disabled) {
    background: #059669 !important;
}

#termsPageAcceptBtn:disabled {
    background: rgba(16, 185, 129, 0.3) !important;
    color: rgba(255, 255, 255, 0.5) !important;
}

.terms-accept-status .terms-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 8px;
}

.terms-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.10);
    margin: 22px 0;
}

[data-theme="light"] .terms-divider {
    background: rgba(0, 0, 0, 0.08);
}

.terms-article {
    color: var(--text-secondary);
    line-height: 1.7;
}

.terms-article h2 {
    color: var(--text-primary);
    margin: 18px 0 8px;
    font-size: 1.2rem;
}

.terms-article h3 {
    color: var(--text-primary);
    margin: 14px 0 8px;
    font-size: 1.05rem;
}

.terms-article p {
    margin: 8px 0;
}

.terms-article ul,
.terms-article ol {
    padding-left: 20px;
    margin: 8px 0 10px;
}

.terms-article li {
    margin: 6px 0;
}

.terms-article a {
    color: var(--accent-cyan);
    text-decoration: none;
}

.terms-article a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .terms-title {
        font-size: 1.5rem;
    }

    .terms-actions .btn,
    .terms-accept-row .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Футер со ссылкой на условия использования */
.legal-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 14px;
    display: flex;
    justify-content: flex-end;
    z-index: 5;
    pointer-events: none; /* не перекрывает клики по интерфейсу */
}

.legal-footer-link {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(20, 20, 30, 0.45);
    backdrop-filter: blur(10px);
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 400;
    transition: var(--transition-normal);
}

[data-theme="light"] .legal-footer-link {
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.7);
}

.legal-footer-link:hover {
    color: var(--text-primary);
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .legal-footer {
        bottom: 10px;
    }

    .legal-footer-link {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* =====================================================
   Toast (легкие уведомления)
   ===================================================== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    transform: translateX(-50%) translateY(10px);
    z-index: 120;
    max-width: min(520px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 20, 30, 0.55);
    backdrop-filter: blur(18px);
    color: var(--text-primary);
    font-size: 0.92rem;
    line-height: 1.35;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.16);
}

.toast.toast-info {
    border-color: rgba(6, 182, 212, 0.28);
    background: rgba(6, 182, 212, 0.12);
}

/* =====================================================
   Индикатор реакций в админ-логах
   ===================================================== */
.log-reaction {
    margin-left: 8px;
    font-size: 0.95rem;
    opacity: 0.9;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.35));
}

/* =====================================================
   Обновленные стили для визуализатора (фиолетовая волна)
   ===================================================== */
.visualizer-container {
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#visualizer {
    background: transparent;
}

/* Иконка микрофона с перечеркиванием */
.mic-icon {
    position: relative;
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
}

.mic-icon svg {
    color: #10b981;
    position: relative;
    z-index: 1;
}

.mic-icon::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 32px;
    background: #10b981;
    transform: rotate(45deg);
    top: 9px;
    left: 50%;
    margin-left: -1px;
    z-index: 2;
}

/* =====================================================
   Профиль пользователя
   ===================================================== */
.modal-profile {
    max-width: 600px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-avatar svg {
    width: 32px;
    height: 32px;
    color: white;
}

.profile-info {
    flex: 1;
}

.profile-username {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: #a78bfa;
    font-size: 0.9rem;
    font-weight: 600;
}

.role-icon {
    font-size: 1rem;
}

.profile-section {
    margin-bottom: 24px;
}

.profile-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.profile-section-header .section-icon {
    font-size: 1.2rem;
}

.profile-section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.profile-section-content {
    padding-left: 32px;
}

.profile-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-icon.status-active {
    background: #10b981;
    color: white;
}

.status-text {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-value {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-left: 0;
}

.profile-stat-card {
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.profile-stat-card.profile-stat-highlight {
    background: rgba(30, 40, 39, 0.8);
    border-color: rgba(16, 185, 129, 0.3);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =====================================================
   Успешность промпта (обновленный дизайн)
   ===================================================== */
.prompt-metrics-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.prompt-metric-card {
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.prompt-metric-card.prompt-metric-current {
    background: rgba(30, 30, 40, 0.9);
}

.prompt-metric-card.prompt-metric-success {
    background: rgba(30, 30, 40, 0.9);
}

.prompt-metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.prompt-metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.prompt-metric-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.prompt-versions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.prompt-version-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all var(--transition-normal);
}

.prompt-version-item.current {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.prompt-version-item.current::before {
    content: '⭐';
    font-size: 1.2rem;
    margin-right: 4px;
}

.prompt-version-number {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
}

.prompt-version-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.prompt-version-success {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
    text-align: right;
}

.btn-show-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-show-more:hover {
    background: rgba(40, 40, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

/* =====================================================
   Рефералы
   ===================================================== */
.referrals-list {
    margin-top: 16px;
}

.referrals-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.referral-item {
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
}

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

.referral-user-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
    font-size: 1rem;
}

.referral-username {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.referral-id {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.referral-metrics {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.referral-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.referral-badge.purple {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.referral-badge.green {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.referral-badge.blue {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.referral-badge.orange {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
}

.referral-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    border-radius: 6px;
}

.referral-expand:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* =====================================================
   Заявки - бейдж
   ===================================================== */
.applications-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
    font-size: 0.85rem;
    font-weight: 600;
}

/* =====================================================
   Кнопка обновления (зеленая)
   ===================================================== */
.btn-refresh-green {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-refresh-green:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-refresh-green .btn-icon {
    font-size: 1rem;
}

/* =====================================================
   Обновленные стили для модального окна инструкций
   ===================================================== */
.instructions-textarea {
    border: 2px solid #10b981;
    border-radius: 8px;
    background: rgba(20, 20, 30, 0.8);
    color: var(--text-primary);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 300px;
    width: 100%;
}

.instructions-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.modal-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 8px;
    margin-top: 12px;
}

.modal-info .info-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.modal-info span:not(.info-icon) {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Зеленая кнопка сохранения в модальном окне инструкций */
#saveInstructionsBtn {
    background: #10b981 !important;
    color: white !important;
    border: none !important;
}

#saveInstructionsBtn:hover:not(:disabled) {
    background: #059669 !important;
}

#saveInstructionsBtn:disabled {
    background: rgba(16, 185, 129, 0.3) !important;
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Зеленая кнопка сохранения в модальном окне инструкций */
#saveInstructionsBtn {
    background: #10b981 !important;
    color: white !important;
    border: none !important;
}

#saveInstructionsBtn:hover:not(:disabled) {
    background: #059669 !important;
}

#saveInstructionsBtn:disabled {
    background: rgba(16, 185, 129, 0.3) !important;
    color: rgba(255, 255, 255, 0.5) !important;
}


/* Зеленая кнопка для страницы условий */
#termsPageAcceptBtn {
    background: #10b981 !important;
    color: white !important;
    border: none !important;
}

#termsPageAcceptBtn:hover:not(:disabled) {
    background: #059669 !important;
}

#termsPageAcceptBtn:disabled {
    background: rgba(16, 185, 129, 0.3) !important;
    color: rgba(255, 255, 255, 0.5) !important;
}
