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

:root {
    --bg-deep: #0a0a0f;
    --bg-dark: #0f0f18;
    --bg-elevated: rgba(20, 20, 35, 0.7);
    --bg-glass: rgba(15, 15, 25, 0.6);
    --text-primary: #e8e8f0;
    --text-secondary: #b8b8d0;
    --text-muted: #7a7a99;
    --border-subtle: rgba(212, 175, 55, 0.2);
    --border-gold: rgba(212, 175, 55, 0.4);
    --gold: #d4af37;
    --gold-bright: #f9d423;
    --gold-glow: rgba(212, 175, 55, 0.25);
    --gold-glow-strong: rgba(212, 175, 55, 0.5);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-sm: 0 2px 10px 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-gold: 0 0 20px rgba(212, 175, 55, 0.3);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(ellipse at 30% 40%, #1a0b2e, #0a0a0f 80%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition);
    font-size: 15px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.05), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ==================== FONT SIZE CLASSES ==================== */
body.font-small { font-size: 12px; }
body.font-small .message-content { font-size: 12px; }
body.font-small .chat-name { font-size: 11px; }
body.font-small .input-area textarea { font-size: 12px; }
body.font-small .mode-select { font-size: 10px; }
body.font-small .auth-title { font-size: 22px; }
body.font-small .chat-title { font-size: 16px; }
body.font-small .auth-card, body.font-small .auth-input, body.font-small .auth-btn,
body.font-small .auth-switch, body.font-small .auth-sub, body.font-small .message-box,
body.font-small .sidebar, body.font-small .sidebar *, body.font-small .modal-content,
body.font-small .modal-content *, body.font-small .setting-item, body.font-small .setting-item *,
body.font-small .chat-item, body.font-small .chat-item *, body.font-small .top-bar,
body.font-small .top-bar *, body.font-small .rate-limit-container,
body.font-small .rate-limit-container * { font-size: 12px; }
body.font-small .nickname-display { font-size: 12px; }
body.font-small .credits-footer { font-size: 9px; }
body.font-small .dev-text { font-size: 8px; }

body.font-medium { font-size: 15px; }
body.font-medium .message-content { font-size: 15px; }
body.font-medium .chat-name { font-size: 13px; }
body.font-medium .input-area textarea { font-size: 14px; }
body.font-medium .mode-select { font-size: 13px; }
body.font-medium .auth-title { font-size: 26px; }
body.font-medium .chat-title { font-size: 18px; }
body.font-medium .auth-card, body.font-medium .auth-input, body.font-medium .auth-btn,
body.font-medium .auth-switch, body.font-medium .auth-sub, body.font-medium .message-box,
body.font-medium .sidebar, body.font-medium .sidebar *, body.font-medium .modal-content,
body.font-medium .modal-content *, body.font-medium .setting-item, body.font-medium .setting-item *,
body.font-medium .chat-item, body.font-medium .chat-item *, body.font-medium .top-bar,
body.font-medium .top-bar *, body.font-medium .rate-limit-container,
body.font-medium .rate-limit-container * { font-size: 14px; }
body.font-medium .nickname-display { font-size: 14px; }
body.font-medium .credits-footer { font-size: 10px; }
body.font-medium .dev-text { font-size: 9px; }

body.font-large { font-size: 18px; }
body.font-large .message-content { font-size: 18px; line-height: 1.6; }
body.font-large .chat-name { font-size: 15px; }
body.font-large .input-area textarea { font-size: 17px; }
body.font-large .mode-select { font-size: 14px; }
body.font-large .chat-title { font-size: 22px; }
body.font-large .nickname-display { font-size: 16px; }
body.font-large .rate-limit-text { font-size: 12px; }
body.font-large .auth-title { font-size: 30px; }
body.font-large .auth-card, body.font-large .auth-input, body.font-large .auth-btn,
body.font-large .auth-switch, body.font-large .message-box, body.font-large .sidebar,
body.font-large .sidebar *, body.font-large .modal-content, body.font-large .modal-content *,
body.font-large .setting-item, body.font-large .setting-item *, body.font-large .chat-item,
body.font-large .chat-item *, body.font-large .top-bar, body.font-large .top-bar *,
body.font-large .rate-limit-container, body.font-large .rate-limit-container * { font-size: 16px; }
body.font-large .credits-footer { font-size: 11px; }

/* ==================== LUXURY LIGHT THEME ==================== */
body.luxury-light {
    --bg-deep: #fef9f0;
    --bg-dark: #ffffff;
    --bg-elevated: rgba(255, 255, 245, 0.92);
    --bg-glass: rgba(255, 252, 245, 0.85);
    --text-primary: #2c2416;
    --text-secondary: #5e5340;
    --text-muted: #a19076;
    --border-subtle: rgba(212, 175, 55, 0.35);
    --border-gold: rgba(212, 175, 55, 0.55);
    --shadow-sm: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-md: 0 6px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
}

body.luxury-light {
    background: radial-gradient(ellipse at 30% 40%, #fffaf0, #f5efe3 90%);
}

body.luxury-light::before {
    background: radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.15), transparent 65%);
}

body.luxury-light .auth-card,
body.luxury-light .sidebar,
body.luxury-light .modal-content {
    background: rgba(255, 252, 245, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

body.luxury-light .message.ai {
    background: rgba(255, 255, 250, 0.92);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #2c2416;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

body.luxury-light .message.ai .message-content {
    color: #2c2416;
}

body.luxury-light .message.ai .message-content h1,
body.luxury-light .message.ai .message-content h2,
body.luxury-light .message.ai .message-content h3,
body.luxury-light .message.ai .message-content h4,
body.luxury-light .message.ai .message-content h5,
body.luxury-light .message.ai .message-content h6 {
    color: #5a3e1b;
}

body.luxury-light .message.ai .message-content code {
    background: rgba(212, 175, 55, 0.15);
    color: #8b6914;
}

body.luxury-light .message.ai .message-content a {
    color: #d4af37;
}

body.luxury-light .message.ai .message-content a:hover {
    color: #b8941c;
}

body.luxury-light .message.user {
    background: linear-gradient(135deg, #d4af37, #e6c85c);
    color: #1e1a10;
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
}

body.luxury-light .message.user .message-content {
    color: #1e1a10;
}

body.luxury-light .input-area textarea {
    background: rgba(255, 252, 245, 0.95);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #2c2416;
}

body.luxury-light .input-area textarea::placeholder {
    color: #a19076;
}

body.luxury-light .input-area textarea:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

body.luxury-light .top-bar,
body.luxury-light .rate-limit-container {
    background: rgba(255, 252, 245, 0.85);
    backdrop-filter: blur(12px);
    border-bottom-color: rgba(212, 175, 55, 0.3);
}

body.luxury-light .chat-container {
    background: rgba(250, 245, 235, 0.4);
}

body.luxury-light .sidebar {
    background: rgba(255, 252, 245, 0.94) !important;
    border-right-color: rgba(212, 175, 55, 0.35) !important;
}

body.luxury-light .input-area {
    background: rgba(255, 250, 240, 0.55) !important;
}

body.luxury-light .chat-header {
    background: rgba(255, 250, 240, 0.35) !important;
}

body.luxury-light .input-row textarea {
    background: rgba(255, 252, 245, 0.95) !important;
    border: 1px solid rgba(212, 175, 55, 0.4) !important;
    color: #2c2416 !important;
}

body.luxury-light .input-row textarea::placeholder {
    color: #a19076 !important;
}

body.luxury-light .input-row textarea:focus {
    border-color: #d4af37 !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2) !important;
}

body.luxury-light .sidebar-header,
body.luxury-light .sidebar-footer {
    border-color: rgba(212, 175, 55, 0.25);
}

body.luxury-light .chat-item {
    background: rgba(212, 175, 55, 0.05);
    color: #2c2416;
}

body.luxury-light .chat-item:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.5);
}

body.luxury-light .chat-item.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.1));
    border-color: #d4af37;
}

body.luxury-light .chat-name {
    color: #2c2416;
}

body.luxury-light .search-chat-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(212, 175, 55, 0.4);
    color: #2c2416;
}

body.luxury-light .search-chat-input::placeholder {
    color: #a19076;
}

body.luxury-light .search-chat-input:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

body.luxury-light .mode-select,
body.luxury-light .icon-btn,
body.luxury-light .input-buttons button:not(.image-gen-btn),
body.luxury-light .chat-rename-btn,
body.luxury-light .chat-delete-btn,
body.luxury-light .chat-download-btn {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.08));
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: #5a4a2a;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

body.luxury-light .mode-select:hover,
body.luxury-light .icon-btn:hover,
body.luxury-light .input-buttons button:not(.image-gen-btn):hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(212, 175, 55, 0.2));
    border-color: #d4af37;
    color: #2c2416;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

body.luxury-light .image-gen-btn {
    background: linear-gradient(135deg, #d4af37, #f0c674) !important;
    border: none !important;
    color: #2c2416 !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

body.luxury-light .image-gen-btn:hover {
    background: linear-gradient(135deg, #e6c85c, #f9d423) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.4);
}

body.luxury-light .send-btn {
    background: linear-gradient(135deg, #d4af37, #e6c85c) !important;
    border: none !important;
    color: #2c2416 !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

body.luxury-light .send-btn:hover {
    background: linear-gradient(135deg, #e6c85c, #f9d423) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

body.luxury-light .photo-btn,
body.luxury-light .chart-btn,
body.luxury-light .voice-btn {
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: #5a4a2a;
}

body.luxury-light .photo-btn:hover,
body.luxury-light .chart-btn:hover,
body.luxury-light .voice-btn:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: #d4af37;
    color: #2c2416;
}

body.luxury-light .voice-btn.listening {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

body.luxury-light .auth-input,
body.luxury-light .setting-item input,
body.luxury-light .setting-item select,
body.luxury-light .setting-item textarea,
body.luxury-light .sd-profile-fields input,
body.luxury-light .sd-file-btn {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(212, 175, 55, 0.4);
    color: #2c2416;
}

body.luxury-light .auth-input::placeholder,
body.luxury-light .setting-item input::placeholder {
    color: #a19076;
}

body.luxury-light .setting-label {
    color: #5e5340;
}

body.luxury-light .code-block-wrapper {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(212, 175, 55, 0.3);
}

body.luxury-light .code-header {
    background: rgba(212, 175, 55, 0.1);
}

body.luxury-light .code-language {
    color: #8b6914;
}

body.luxury-light .copy-code-btn {
    color: #5e5340;
}

body.luxury-light .copy-code-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #8b6914;
}

body.luxury-light .copy-code-btn.copied {
    color: #22c55e;
}

body.luxury-light .typing-indicator {
    background: rgba(255, 252, 245, 0.9);
    border-color: rgba(212, 175, 55, 0.3);
}

body.luxury-light .typing-indicator span {
    background: #d4af37;
}

body.luxury-light .menu-toggle {
    background: rgba(255, 252, 245, 0.9);
    border-color: rgba(212, 175, 55, 0.4);
}

body.luxury-light .menu-toggle span {
    background: #8b6914;
}

body.luxury-light .credits-footer {
    color: #a19076;
    border-top-color: rgba(212, 175, 55, 0.3);
}

body.luxury-light .credits-footer:hover {
    color: #d4af37;
}

body.luxury-light .rate-limit-bar {
    background: linear-gradient(90deg, #c9a52e, #e6c85c);
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}

body.luxury-light .rate-limit-text,
body.luxury-light .rate-limit-reset {
    color: #5e5340;
}

body.luxury-light .message-box.error {
    background: rgba(239, 68, 68, 0.12);
    color: #c2410c;
}

body.luxury-light .message-box.success {
    background: rgba(34, 197, 94, 0.12);
    color: #2b7a3e;
}

body.luxury-light .overlay {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
}

body.luxury-light .auth-title,
body.luxury-light .chat-title,
body.luxury-light .modal-title {
    background: linear-gradient(135deg, #b8860b, #d4af37);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.luxury-light .chat-sub {
    color: #7a6b55;
}

body.luxury-light .nickname-display {
    color: #2c2416;
}

body.luxury-light .status-dot {
    background: #2e7d32;
}

body.luxury-light .sidebar-logo {
    color: #b8860b;
}

body.luxury-light .sidebar-logo-img {
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

body.luxury-light .modal-buttons button.close-modal {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #5e5340;
}

body.luxury-light .modal-buttons button.close-modal:hover {
    background: rgba(212, 175, 55, 0.15);
}

body.luxury-light .modal-buttons button.save-settings {
    background: linear-gradient(135deg, #d4af37, #e6c85c);
    border: none;
    color: #2c2416;
}

body.luxury-light .modal-buttons button.save-settings:hover {
    background: linear-gradient(135deg, #e6c85c, #f9d423);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

body.luxury-light .avatar-preview img {
    border-color: #d4af37;
}

body.luxury-light .avatar-upload-btn {
    background: #d4af37;
}

body.luxury-light .photo-action-sheet {
    background: rgba(255, 252, 245, 0.98);
    border-top-color: #d4af37;
}

body.luxury-light .photo-action-sheet button:first-child {
    background: linear-gradient(135deg, #d4af37, #e6c85c);
    color: #2c2416;
}

body.luxury-light .photo-action-sheet button:nth-child(2) {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.4);
    color: #5e5340;
}

body.luxury-light .photo-action-sheet button:last-child {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

body.luxury-light .chat-rename-btn,
body.luxury-light .chat-delete-btn,
body.luxury-light .chat-download-btn {
    background: transparent;
}

body.luxury-light .chat-rename-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #8b6914;
}

body.luxury-light .chat-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

body.luxury-light .chat-download-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #8b6914;
}

body.luxury-light .new-chat-btn {
    background: linear-gradient(135deg, #d4af37, #e6c85c);
    color: #2c2416;
}

body.luxury-light .new-chat-btn:hover {
    background: linear-gradient(135deg, #e6c85c, #f9d423);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

body.luxury-light .password-modal-btn {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.4);
    color: #5e5340;
}

body.luxury-light .password-modal-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
}

body.luxury-light .speak-ai-msg-btn {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.4);
    color: #5e5340;
}

body.luxury-light .speak-ai-msg-btn:hover {
    background: #d4af37;
    border-color: #d4af37;
    color: #2c2416;
}

body.luxury-light .message-content img {
    border-color: rgba(212, 175, 55, 0.4);
}

body.luxury-light .custom-mode-item {
    background: rgba(212, 175, 55, 0.05);
    color: #2c2416;
}

body.luxury-light .custom-mode-item:hover {
    background: rgba(212, 175, 55, 0.15);
}

body.luxury-light .delete-custom-mode {
    color: #dc2626;
}

body.luxury-light .chart-type-btn.active {
    background: #d4af37 !important;
    color: #2c2416 !important;
}

body.luxury-light .banner-features span {
    background: rgba(212, 175, 55, 0.15) !important;
    color: #8b6914 !important;
    border-color: rgba(212, 175, 55, 0.3) !important;
}

body.luxury-light .auth-logo-img {
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.3);
}

body.luxury-light .auth-credits {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
}

body.luxury-light .auth-credits,
body.luxury-light .auth-credits * {
    color: #5e5340;
}

body.luxury-light .lang-select select {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
    color: #2c2416;
}

body.luxury-light .lang-select select:focus {
    border-color: #d4af37;
}

body.luxury-light ::-webkit-scrollbar-track {
    background: rgba(212, 175, 55, 0.1);
}

body.luxury-light ::-webkit-scrollbar-thumb {
    background: #d4af37;
}

body.luxury-light ::-webkit-scrollbar-thumb:hover {
    background: #e6c85c;
}

/* ==================== AUTH STYLES ==================== */
.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.auth-logo-img {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    padding: 3px;
    box-shadow: 0 0 32px rgba(212, 175, 55, 0.5), 0 4px 16px rgba(0,0,0,0.4);
}

.auth-credits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.auth-credits-logo {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: contain;
}

.sidebar-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 40%, #1a0b2e, #0a0a0f);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.auth-card {
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 20px 22px;
    width: 90%;
    max-width: 420px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.3);
    text-align: center;
    margin: auto;
    position: relative;
    flex-shrink: 0;
}

.auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

.auth-sub {
    letter-spacing: 4px;
    font-size: 9px;
    color: rgba(212, 175, 55, 0.5);
    margin-bottom: 16px;
    font-weight: 500;
    text-transform: uppercase;
}

.auth-banner {
    position: relative;
    border-radius: 16px;
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: 0 6px 30px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,175,55,0.15);
}

.auth-banner-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 180px;
    min-height: 100px;
    filter: brightness(0.85) saturate(1.1);
}

.banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    background: linear-gradient(to top, rgba(5,3,15,0.9) 0%, rgba(5,3,15,0.3) 50%, transparent 100%);
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.banner-features {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: max-content;
    animation: bannerScroll 30s linear infinite;
    padding: 0 12px 8px;
}

.banner-features:hover {
    animation-play-state: paused;
}

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

.banner-features span {
    background: rgba(212, 175, 55, 0.14);
    backdrop-filter: blur(6px);
    padding: 3px 10px;
    border-radius: 20px;
    color: rgba(212, 175, 55, 0.9);
    font-weight: 500;
    white-space: nowrap;
    font-size: 10px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.banner-features span:hover {
    background: rgba(212, 175, 55, 0.28);
    border-color: rgba(212, 175, 55, 0.5);
}

.banner-features i {
    margin-right: 4px;
    font-size: 9px;
    opacity: 0.8;
}

.auth-input {
    width: 100%;
    padding: 9px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    margin-bottom: 8px;
    transition: var(--transition);
    font-family: inherit;
}

.auth-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-btn {
    width: 100%;
    padding: 9px;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    color: #0a0a0a;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 6px;
    font-family: inherit;
    letter-spacing: 1px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(212, 175, 55, 0.4);
}

.auth-switch {
    margin-top: 12px;
    color: var(--text-secondary);
}

.auth-switch span {
    color: var(--gold);
    cursor: pointer;
    font-weight: 700;
    margin-left: 5px;
}

.auth-switch span:hover {
    text-decoration: underline;
    text-shadow: 0 0 5px var(--gold-glow);
}

.lang-select {
    margin-top: 10px;
}

.lang-select select {
    background: rgba(255,255,255,0.05);
    background-color: #1a1830;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
}

.lang-select select option,
#authLanguage option {
    background-color: #1a1830;
    color: var(--text-primary);
}

body.luxury-light .lang-select select option,
body.luxury-light #authLanguage option {
    background-color: #fffcf4;
    color: #2c2416;
}

.lang-select select:focus {
    border-color: var(--gold);
    outline: none;
}

.message-box {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    text-align: center;
}

.message-box.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.message-box.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.app {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* МЕНЮ-БУРГЕР */
.menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2000;
    width: 44px;
    height: 44px;
    background: rgba(15, 15, 25, 0.92);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    display: none !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 2px 16px rgba(0,0,0,0.5);
    border: 1px solid var(--border-subtle);
}

body:not(.auth-visible) .menu-toggle {
    display: flex !important;
}

body.sidebar-open .menu-toggle,
body.sidebar-open:not(.auth-visible) .menu-toggle {
    display: none !important;
}

.menu-toggle span {
    width: 22px;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

/* САЙДБАР */
.sidebar {
    width: 290px;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-gold);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 100;
    overflow: hidden;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex !important;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -290px;
        transition: left 0.3s ease;
        box-shadow: 5px 0 30px rgba(0,0,0,0.5);
        z-index: 1000;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .chat-container {
        width: 100%;
    }
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: none;
}

@media (max-width: 768px) {
    .overlay.active {
        display: block;
        pointer-events: auto;
        z-index: 999 !important;
    }
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-family: 'Playfair Display', serif;
    margin-bottom: 16px;
    color: var(--gold);
}

.search-chat-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    margin-bottom: 12px;
    font-family: inherit;
}

.search-chat-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.new-chat-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    border: none;
    border-radius: var(--radius-md);
    color: #0a0a0a;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}


/* ========== SIDEBAR ACTION BUTTONS (REDESIGN) ========== */
.sidebar-action-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 0 4px 0;
}

.sidebar-btn-row {
    display: flex;
    gap: 6px;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 11px 10px;
    position: relative;
    white-space: nowrap;
    min-width: 0;
}

.sidebar-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sidebar-btn--primary {
    width: 100%;
    background: linear-gradient(135deg, #d4af37, #f0cc5a);
    color: #0a0a0a;
    box-shadow: 0 2px 12px rgba(212,175,55,0.25);
    font-size: 14px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.sidebar-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(212,175,55,0.4);
}

.sidebar-btn--secondary {
    flex: 1;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(124,58,237,0.1));
    border: 1px solid rgba(139,92,246,0.35);
    color: #a78bfa;
}

.sidebar-btn--secondary:hover {
    background: linear-gradient(135deg, rgba(139,92,246,0.3), rgba(124,58,237,0.2));
    border-color: rgba(139,92,246,0.6);
    transform: translateY(-1px);
}

.sidebar-btn--plans {
    flex: 1.4;
    background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(180,140,30,0.06));
    border: 1px solid rgba(212,175,55,0.35);
    color: #d4af37;
}

.sidebar-btn--plans:hover {
    background: linear-gradient(135deg, rgba(212,175,55,0.25), rgba(180,140,30,0.12));
    border-color: rgba(212,175,55,0.6);
    transform: translateY(-1px);
}

/* Активные премиум-темы после активации кода/ключа */
body.theme-pro .sidebar-btn--plans {
    background: linear-gradient(135deg, rgba(167,139,250,0.22), rgba(124,58,237,0.08));
    border-color: rgba(167,139,250,0.55);
    color: #c4b5fd;
    box-shadow: 0 0 14px rgba(167,139,250,0.25);
}

body.theme-business .sidebar-btn--plans {
    background: linear-gradient(135deg, rgba(212,175,55,0.32), rgba(180,140,30,0.14));
    border-color: rgba(212,175,55,0.8);
    color: #f0cc5a;
    box-shadow: 0 0 16px rgba(212,175,55,0.35);
}

.sidebar-btn--icon-only {
    flex: 0 0 44px;
    padding: 0;
    position: relative;
    height: 44px;
}

.sidebar-btn--icon-only i {
    line-height: 1;
    margin: 0;
    transform: translate(var(--icon-nudge-x, 0px), var(--icon-nudge-y, 0px));
}

/* Если иконка визуально не по центру - это рисунок глифа шрифта, а не CSS.
   Поправь смещение здесь в пикселях (можно и через DevTools на телефоне: удержать
   на элементе -> Inspect, или просто менять эти 2 числа и смотреть на живом сайте): */
#groupChatBtn i { --icon-nudge-x: 4px; --icon-nudge-y: 1px; }
#newFolderBtn i { --icon-nudge-x: 4px; --icon-nudge-y: 1px; }

/* ==================== ПАПКИ ЧАТОВ ==================== */
.chat-folder {
    margin-bottom: 4px;
}

.chat-folder-pinned .chat-folder-header {
    background: rgba(212, 175, 55, 0.06);
    color: var(--gold);
}

.chat-folder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.chat-folder-header:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.chat-folder-header:hover .chat-actions {
    opacity: 1;
}

.chat-folder-name {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-folder-toggle-icon {
    font-size: 10px;
    color: var(--text-muted);
    width: 10px;
}

.chat-folder-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 1px 7px;
    margin-left: 2px;
}

.chat-folder-header .chat-actions {
    opacity: 0;
    transition: var(--transition);
}

.chat-folder-chats {
    padding-left: 14px;
    border-left: 1px solid var(--border-subtle);
    margin-left: 14px;
}

/* ==================== МЕНЮ ДЕЙСТВИЙ ЧАТА (long-press) ==================== */
.chat-actions-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.chat-actions-sheet-overlay.open {
    opacity: 1;
}

.chat-actions-sheet {
    background: var(--bg-elevated);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 480px;
    border-radius: 20px 20px 0 0;
    padding: 8px 12px 24px;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
    border: 1px solid var(--border-gold);
    border-bottom: none;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.5);
}

.chat-actions-sheet-overlay.open .chat-actions-sheet {
    transform: translateY(0);
}

.chat-actions-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 4px;
    margin: 8px auto 14px;
}

.chat-actions-sheet-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--gold);
    padding: 0 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 6px;
}

.chat-actions-sheet-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.chat-actions-sheet-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sheet-action {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 13px 10px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition);
}

.sheet-action i {
    width: 18px;
    text-align: center;
    color: var(--gold);
}

.sheet-action:hover, .sheet-action:active {
    background: rgba(212,175,55,0.1);
}

.sheet-action--danger {
    color: var(--danger);
}

.sheet-action--danger i {
    color: var(--danger);
}

.sidebar-plan-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    background: rgba(212,175,55,0.2);
    color: #d4af37;
    border: 1px solid rgba(212,175,55,0.4);
    border-radius: 4px;
    padding: 2px 5px;
    margin-left: 2px;
}

.sidebar-plan-badge.plan-pro {
    background: rgba(245,158,11,0.2);
    color: #f59e0b;
    border-color: rgba(245,158,11,0.4);
}

.sidebar-plan-badge.plan-business {
    background: rgba(139,92,246,0.2);
    color: #a78bfa;
    border-color: rgba(139,92,246,0.4);
}

/* Убираем старые стили new-chat-btn для sidebar-btn */
.sidebar-action-btns .new-chat-btn { display: none; }

.chats-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}

/* ========== SKELETON LOADING ДЛЯ ЧАТОВ ========== */
.chats-loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.skeleton-item {
    height: 48px;
    width: 100%;
    border-radius: var(--radius-md);
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(212,175,55,0.1) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s infinite ease-in-out;
}

@keyframes skeletonShimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

body.luxury-light .skeleton-item {
    background: linear-gradient(
        90deg,
        rgba(0,0,0,0.05) 25%,
        rgba(212,175,55,0.15) 50%,
        rgba(0,0,0,0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s infinite ease-in-out;
}

.chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
}

.chat-item:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--border-gold);
}

.chat-item.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.05));
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.chat-name {
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-name i {
    margin-right: 8px;
}

.chat-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: var(--transition);
}

.chat-item:hover .chat-actions {
    opacity: 1;
}

.chat-rename-btn, .chat-delete-btn, .chat-download-btn, .chat-move-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.chat-rename-btn { color: var(--text-secondary); }
.chat-delete-btn { color: var(--danger); }
.chat-download-btn { color: var(--text-secondary); }
.chat-download-btn:hover { color: var(--gold); transform: translateY(-1px); }
.chat-move-btn { color: var(--text-secondary); }
.chat-move-btn:hover { color: var(--gold); transform: translateY(-1px); }

.folder-rename-btn, .folder-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.folder-rename-btn { color: var(--text-secondary); }
.folder-rename-btn:hover { color: var(--gold); transform: translateY(-1px); }
.folder-delete-btn { color: var(--danger); }
.folder-delete-btn:hover { transform: translateY(-1px); }

.custom-dialog-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    margin: 16px 0 0;
    transition: var(--transition);
}

.custom-dialog-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
.chat-pin-btn { background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); transition: var(--transition); color: var(--text-muted); }
.chat-pin-btn:hover { color: var(--gold); transform: rotate(45deg); }

.chat-pinned {
    background: rgba(212, 175, 55, 0.06);
    border-color: rgba(212, 175, 55, 0.25);
}
.chat-pinned .chat-pin-btn {
    color: var(--gold);
    opacity: 1;
}
.chat-pinned .chat-actions {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.icon-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.icon-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
    transform: translateY(-1px);
}

.credits-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    margin-top: 8px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: var(--transition);
}

.credits-footer:hover {
    color: var(--gold);
}

.dev-logo {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    object-fit: contain;
}

.dev-text {
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ЧАТ КОНТЕЙНЕР */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: rgba(10, 10, 15, 0.5);
    overflow: hidden;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(15, 15, 25, 0.7);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-gold);
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.user-info-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    transition: var(--transition);
}

.user-info-center:hover {
    background: rgba(212, 175, 55, 0.1);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.nickname-display {
    font-weight: 600;
}

.status-dot {
    width: 9px;
    height: 9px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 5px var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.mode-select {
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.mode-select:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

.rate-limit-container {
    padding: 8px 24px;
    background: rgba(15, 15, 25, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.rate-limit-text {
    color: var(--text-secondary);
}

.rate-limit-bar-wrapper {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.rate-limit-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 5px var(--gold-glow);
}

.rate-limit-reset {
    color: var(--text-muted);
    font-family: monospace;
}

.rate-limit-container {
    cursor: pointer;
    position: relative;
}

.rate-limit-container:hover .rate-limit-text {
    color: var(--gold);
}

.rate-limit-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 16px;
    padding: 20px 20px 16px;
    width: 280px;
    z-index: 9999;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
    backdrop-filter: blur(20px);
}

.rate-limit-popup.visible {
    display: block;
}

.rate-limit-popup-title {
    color: var(--gold);
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.rate-limit-popup-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.rate-limit-popup-text b {
    color: var(--text-primary);
}

.rate-limit-popup-close {
    display: block;
    padding: 10px 16px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    color: var(--gold);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
}

.rate-limit-popup-close:hover {
    background: rgba(212, 175, 55, 0.25);
}

.chat-header {
    padding: 20px 24px 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.ai-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    padding: 3px;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.chat-title-section {
    flex: 1;
}

.chat-title {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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

.chat-sub {
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    font-size: 0.8rem;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    max-width: 88%;
    min-width: 0;
}

.message.msg-animate {
    animation: msgFadeIn 0.35s ease forwards;
}

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

/* Deprecated - kept for compatibility */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    color: #0a0a0a;
    border-radius: 22px 22px 6px 22px;
    padding: 12px 20px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
    min-width: 0;
    width: fit-content;
    max-width: 85%;
    word-break: break-word;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message.user .message-content {
    word-break: break-word;
    white-space: pre-wrap;
    min-width: 0;
    overflow-wrap: anywhere;
    color: #0a0a0a;
}

/* Карточка прикреплённого файла */
.file-card-attachment {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(10, 8, 20, 0.75);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    padding: 10px 14px;
    margin: 4px 0;
    max-width: 240px;
    box-sizing: border-box;
    vertical-align: top;
}
.file-card-icon {
    width: 36px;
    height: 36px;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.file-card-icon i {
    color: var(--gold);
    font-size: 17px;
}
.file-card-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f0e6b8;
}
.file-card-sub {
    font-size: 11px;
    color: rgba(212, 175, 55, 0.6);
    margin-top: 2px;
}

/* Скрыть аватарку внутри пузырька пользователя если туда попадает */
.message.user .message-avatar,
.message.user > img:not(.message-content img) {
    display: none !important;
}

.message.ai {
    align-self: flex-start;
    gap: 12px;
    background: rgba(20, 20, 35, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 22px 22px 22px 6px;
    padding: 12px 20px;
    border: 1px solid var(--border-gold);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
    overflow: visible;
    max-width: 88%;
    min-width: 0;
    width: fit-content;
}

.message.ai .message-content {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.5;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

/* ── AI Disclaimer ────────────────────────────────────────── */
.ai-disclaimer {
    display: block;
    width: 100%;
    margin-top: 9px;
    padding-top: 7px;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    font-size: 10.5px;
    line-height: 1.4;
    color: var(--text-secondary);
    opacity: 0.55;
    font-style: italic;
    user-select: none;
    letter-spacing: 0.1px;
}

body.luxury-light .ai-disclaimer {
    border-top-color: rgba(212, 175, 55, 0.25);
}

/* ── AI Sources tab ───────────────────────────────────────── */
.ai-sources {
    display: block;
    width: 100%;
    margin-top: 10px;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    padding-top: 8px;
}

.ai-sources summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--gold);
    opacity: 0.85;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-gold);
    background: rgba(212, 175, 55, 0.06);
    transition: all 0.2s ease;
    user-select: none;
}

.ai-sources summary::-webkit-details-marker { display: none; }

.ai-sources summary:hover {
    background: rgba(212, 175, 55, 0.14);
    opacity: 1;
}

.ai-sources summary i.fa-globe { font-size: 10.5px; }

.ai-sources-count {
    background: var(--gold);
    color: #15121c;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    line-height: 1.4;
}

.ai-sources-arrow {
    font-size: 9px;
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.ai-sources[open] summary .ai-sources-arrow {
    transform: rotate(180deg);
}

.ai-sources-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    animation: aiSourcesFadeIn 0.18s ease;
}

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

.ai-source-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.18);
    background: rgba(255, 255, 255, 0.025);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.ai-source-item:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
    transform: translateX(2px);
}

.ai-source-favicon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.ai-source-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.ai-source-title {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-source-host {
    font-size: 10.5px;
    color: var(--gold);
    opacity: 0.75;
}

.ai-source-go {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

body.luxury-light .ai-sources { border-top-color: rgba(212, 175, 55, 0.25); }
body.luxury-light .ai-source-item { background: rgba(0,0,0,0.02); border-color: rgba(212,175,55,0.3); }
body.luxury-light .ai-source-title { color: #2a2a3a; }

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    align-self: flex-start;
}

/* Сообщения других участников группы (не текущего пользователя, не ИИ) */
.message.other {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 22px 22px 22px 6px;
    padding: 10px 18px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 85%;
    width: fit-content;
    min-width: 0;
}

.message.other .message-content {
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    line-height: 1.5;
}

.message-sender-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 4px;
    display: block;
    letter-spacing: 0.2px;
}

/* Плашка со списком участников группового чата */
.group-members-bar {
    padding: 8px 18px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(212, 175, 55, 0.06);
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    overflow-x: auto;
    white-space: nowrap;
}

.message-content {
    line-height: 1.5;
    word-break: break-word;
    flex: 1;
}

.message-content a:not(.ai-source-item) {
    color: var(--gold, #d4af37);
    text-decoration: underline;
    word-break: break-all;
}
.message-content a:not(.ai-source-item):hover {
    opacity: 0.8;
}

.message-content h1, .message-content h2, .message-content h3,
.message-content h4, .message-content h5, .message-content h6 {
    margin: 10px 0 6px;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700;
    line-height: 1.3;
}
.message-content h1 { font-size: 1.35em; color: var(--gold); }
.message-content h2 { font-size: 1.2em; color: var(--gold); }
.message-content h3 { font-size: 1.08em; }
.message-content h4 { font-size: 1.02em; }
.message-content h5 { font-size: 0.96em; }
.message-content h6 { font-size: 0.9em; opacity: 0.85; }

.message-content code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--gold-bright);
}

.message-content pre {
    margin: 12px 0;
    overflow-x: auto;
    background: rgba(0,0,0,0.4);
    border-radius: var(--radius-md);
    padding: 0;
}

.code-block-wrapper {
    background: rgba(0,0,0,0.4);
    border-radius: var(--radius-md);
    margin: 12px 0;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border-subtle);
}

.code-language {
    color: var(--gold);
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.75rem;
}

.copy-code-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: inherit;
}

.copy-code-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--gold);
}

.copy-code-btn.copied {
    color: var(--success);
}

.code-block-wrapper pre {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
}

.code-block-wrapper code {
    display: block;
    font-family: 'Courier New', monospace;
    line-height: 1.4;
    white-space: pre !important;
    word-wrap: normal !important;
    word-break: normal !important;
    tab-size: 4;
    background: transparent;
    padding: 0;
}

.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 20px;
    background: rgba(20, 20, 35, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    align-self: flex-start;
    border: 1px solid var(--border-subtle);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ==================== ИСПРАВЛЕННЫЕ СТИЛИ ДЛЯ INPUT-AREA ==================== */
/* Кнопка + больше не внутри поля ввода, а отдельная кнопка рядом */
.input-area {
    padding: 16px 24px 24px;
    background: rgba(10, 10, 15, 0.5);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.input-row textarea {
    flex: 1;
    padding: 14px 20px;
    background: rgba(20, 20, 35, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    resize: none;
    font-family: inherit;
    transition: var(--transition);
    font-size: 14px;
    line-height: 1.4;
}

.input-row textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.plus-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    border: none;
    color: #0a0a0a;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.plus-btn .fas,
.plus-btn .far {
    margin: 0 !important;
    line-height: 1;
}

.plus-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

.plus-btn.active {
    transform: rotate(45deg);
}

/* ==================== КНОПКА ПРИКРЕПЛЕНИЯ ФАЙЛА ==================== */
.attach-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.12);
    border: 1.5px solid rgba(212, 175, 55, 0.35);
    color: var(--gold);
    font-size: 17px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attach-btn:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--gold);
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

.attach-btn.has-file {
    background: rgba(212, 175, 55, 0.3);
    border-color: var(--gold);
    color: var(--gold-bright);
    animation: attachPulse 1.5s ease-in-out infinite;
}

@keyframes attachPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(212, 175, 55, 0.3); }
    50% { box-shadow: 0 0 16px rgba(212, 175, 55, 0.6); }
}

/* ==================== BOTTOM SHEET "ЧТО ДОБАВИТЬ" (attach-sheet) ==================== */
.attach-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.attach-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.attach-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: var(--bg-elevated);
    backdrop-filter: blur(20px);
    max-width: 480px;
    margin: 0 auto;
    border-radius: 20px 20px 0 0;
    padding: 8px 14px 24px;
    border: 1px solid var(--border-gold);
    border-bottom: none;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.5);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.attach-sheet.open {
    transform: translateY(0);
}

.attach-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 4px;
    margin: 8px auto 14px;
}

.attach-sheet-title {
    font-weight: 700;
    color: var(--gold);
    padding: 0 6px 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 10px;
}

.attach-sheet-quick {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px 16px;
}

.attach-sheet-quick button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 12px 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.attach-sheet-quick button:hover {
    background: rgba(212,175,55,0.1);
    border-color: var(--border-gold);
}

/* Иконка внутри верхнего ряда (Файл/Фото/Звонок/Голос) — квадрат 44x44, glyph строго по центру */
.attach-sheet-quick button i {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 17px;
    color: var(--gold);
}

.attach-sheet-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.attach-sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 10px 8px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 12px;
    transition: var(--transition);
}

.attach-sheet-item:hover, .attach-sheet-item:active {
    background: rgba(212,175,55,0.1);
}

/* ---- Квадратная иконка списка: фикс. размер + flex-центрирование убирает "плавающий" глиф ---- */
.attach-sheet-item-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Сам глиф FA: line-height:1 убирает вертикальный сдвиг от строчной высоты шрифта,
   width/height + flex-центрирование на самом <i> компенсируют то, что optical-центр
   иконки (chart-line, film, file-word и т.п.) не совпадает с центром её em-квадрата */
.attach-sheet-item-icon i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
    font-size: 18px;
}

/* ---- ТОЧНАЯ optical-коррекция (замерено по пикселям скриншота, не на глаз) ----
   Flex центрирует em-box глифа, но сам "рисунок" иконки у Font Awesome почти всегда
   смещён влево внутри своего em-box (правое поле шире левого) — поэтому даже при
   идеальной CSS-центровке иконки визуально "уезжают" влево. Сдвигаем каждую вправо
   на замеренную величину. */
#imageGenBtn .attach-sheet-item-icon i     { transform: translateX(3px); }
#chartBtn .attach-sheet-item-icon i        { transform: translate(5px, -1px); }
#presentationBtn .attach-sheet-item-icon i { transform: translateX(3px); }
#documentBtn .attach-sheet-item-icon i     { transform: translateX(4px); }
#animateVideoBtn .attach-sheet-item-icon i { transform: translateX(2px); }

.attach-sheet-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.attach-sheet-item-text b {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.attach-sheet-item-text small {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== ПРЕВЬЮ НЕСКОЛЬКИХ ПРИКРЕПЛЁННЫХ ФАЙЛОВ ==================== */
.attached-files-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 4px;
    margin-bottom: 6px;
}

.attached-file-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 10px;
    max-width: 220px;
}

.attached-file-chip i.fa-paperclip,
.attached-file-chip i.fa-file-pdf {
    color: var(--gold);
    font-size: 12px;
    flex-shrink: 0;
}

.attached-file-chip .attached-file-chip-name {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attached-file-chip .attached-file-chip-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

.attached-file-chip .attached-file-chip-remove:hover {
    opacity: 0.75;
}

body.luxury-light .attached-file-chip {
    background: rgba(180, 140, 20, 0.1);
    border-color: rgba(180, 140, 20, 0.35);
}

body.luxury-light .attach-btn {
    background: rgba(180, 140, 20, 0.12);
    border-color: rgba(180, 140, 20, 0.4);
    color: #7a5c00;
}

.send-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold-bright)) !important;
    color: #0a0a0a !important;
    font-weight: 700 !important;
    padding: 10px 22px;
    border-radius: var(--radius-xl);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    height: 48px;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

.input-buttons {
    display: none;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
    animation: fadeInUp 0.3s ease;
}

.input-buttons.show {
    display: flex;
}

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

.input-buttons button {
    padding: 10px 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.input-buttons button:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
    transform: translateY(-1px);
}

.image-gen-btn {
    background: linear-gradient(135deg, var(--gold), #f9d423) !important;
    color: #0a0a0a !important;
    border: none !important;
    font-weight: 700 !important;
}

.image-gen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.5);
}

.voice-btn.listening {
    background: var(--danger);
    border-color: var(--danger);
    animation: pulse 1s infinite;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(15, 15, 25, 0.9);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border-gold);
}

.modal-title {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-align: center;
    font-size: 1.4rem;
}

.modal-title i {
    margin-right: 8px;
}

.setting-item {
    margin-bottom: 18px;
}

.setting-label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.setting-label i {
    margin-right: 6px;
}

.setting-item input, .setting-item select, .setting-item textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.setting-item select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #1a1830;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23d4af37' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

/* Native dropdown popup (option list) ignores rgba backgrounds on Android,
   so give it an explicit opaque background + readable text color */
.setting-item select option {
    background-color: #1a1830;
    color: var(--text-primary);
}

body.luxury-light .setting-item select {
    background-color: rgba(255, 255, 255, 0.95);
}

body.luxury-light .setting-item select option {
    background-color: #fffcf4;
    color: #2c2416;
}

.setting-item input:focus, .setting-item select:focus, .setting-item textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.avatar-preview {
    display: flex;
    justify-content: center;
    position: relative;
    margin-bottom: 24px;
}

.avatar-preview img {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: calc(50% - 42px);
    background: var(--gold);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.avatar-upload-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px var(--gold-glow);
}

.password-modal-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 18px;
}

.password-modal-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.close-modal {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.save-settings {
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    border: none;
    color: #0a0a0a;
}

.save-settings:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.image-preview-content {
    background: rgba(15, 15, 25, 0.9);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-gold);
}

.image-preview-content img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--border-gold);
}

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

.image-preview-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.send-image-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    border: none;
    color: #0a0a0a;
}

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

.photo-action-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1100;
    animation: slideUp 0.3s ease;
    border-top: 1px solid var(--border-gold);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.photo-action-sheet button {
    padding: 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.photo-action-sheet button:first-child {
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    border: none;
    color: #0a0a0a;
}

.photo-action-sheet button:nth-child(2) {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.photo-action-sheet button:last-child {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    color: var(--danger);
}

.photo-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1099;
}

.custom-mode-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.custom-mode-item:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--border-gold);
}

.delete-custom-mode {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--danger);
}

.chart-type-btn.active {
    background: var(--gold) !important;
    color: #0a0a0a !important;
    border-color: var(--gold) !important;
}

/* ==================== МОБИЛЬНАЯ ВЕРСИЯ ==================== */
@media (max-width: 768px) {
    .top-bar {
        padding-left: 60px;
        padding-right: 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .user-info-center {
        justify-content: center;
        padding: 6px;
    }
    
    .user-avatar {
        width: 34px;
        height: 34px;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: space-between;
        gap: 6px;
    }
    
    .mode-select {
        flex: 1;
        padding: 6px 10px;
        min-width: 0;
    }
    
    .messages-area {
        padding: 12px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .input-area {
        padding: 12px;
    }
    
    /* Мобильные адаптации для исправленных стилей */
    .input-row {
        gap: 8px;
    }
    
    .plus-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
    
    .send-btn {
        padding: 8px 16px;
        height: 42px;
        font-size: 12px;
    }
    
    .input-row textarea {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .input-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .input-buttons button {
        flex: 1;
        padding: 8px 12px;
        white-space: nowrap;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 16px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .ai-avatar {
        width: 42px;
        height: 42px;
    }
    
    .code-block-wrapper code {
        line-height: 1.3;
    }
    
    .rate-limit-container {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px 16px;
        gap: 8px;
    }
    
    .auth-banner-img {
        max-height: 170px;
        min-height: 120px;
    }
    
    .banner-features span {
        padding: 4px 10px;
    }
    
    .menu-toggle {
        display: none !important;
    }
    body:not(.auth-visible) .menu-toggle {
        display: flex !important;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 16px 14px;
        max-width: 380px;
        width: 92%;
    }
    
    .auth-logo-img {
        width: 46px;
        height: 46px;
    }
    
    .auth-banner-img {
        max-height: 140px;
        min-height: 100px;
    }
    
    .banner-features span {
        padding: 3px 10px;
        font-size: 9px;
    }
    
    .rate-limit-container {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .mode-select {
        width: 100%;
    }
    
    .input-buttons button {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    .message {
        max-width: 95%;
    }
    
    /* Маленькие мобильные адаптации */
    .plus-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .send-btn {
        padding: 6px 12px;
        font-size: 11px;
        height: 38px;
    }
    
    .input-row textarea {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .input-buttons button {
        padding: 8px 10px;
        font-size: 10px;
    }
}

/* ==================== AUTH RESPONSIVE FIXES ==================== */

/* Landscape mobile / tablet */
@media (max-height: 600px) {
    .auth-overlay {
        align-items: flex-start;
        padding: 10px 0;
    }

    .auth-card {
        max-height: none;
        margin: 10px auto;
        padding: 14px 18px;
    }

    .auth-logo {
        margin-bottom: 6px;
    }

    .auth-logo-img {
        width: 40px;
        height: 40px;
    }

    .auth-title {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .auth-sub {
        font-size: 9px;
        margin-bottom: 8px;
        letter-spacing: 2px;
    }

    .auth-banner {
        margin-bottom: 8px;
    }

    .auth-banner-img {
        max-height: 70px;
        min-height: 50px;
    }

    .banner-features span {
        font-size: 8px;
        padding: 2px 8px;
    }

    .auth-input {
        padding: 7px 12px;
        margin-bottom: 6px;
        font-size: 13px;
    }

    .auth-btn {
        padding: 7px;
        margin-top: 4px;
        font-size: 12px;
    }

    .auth-switch {
        margin-top: 8px;
        font-size: 12px;
    }

    .lang-select {
        margin-top: 6px;
    }

    .auth-credits {
        margin-top: 6px;
        padding: 4px;
        font-size: 10px;
    }

    .captchaBlock,
    #captchaBlock {
        margin-bottom: 8px !important;
    }
}

/* Very small screens (320px) */
@media (max-width: 360px) {
    .auth-card {
        width: 95%;
        padding: 16px 14px;
    }

    .auth-logo-img {
        width: 44px;
        height: 44px;
    }

    .auth-title {
        font-size: 19px;
    }

    .auth-banner-img {
        max-height: 80px;
        min-height: 60px;
    }

    .banner-features span {
        font-size: 8px;
        padding: 2px 7px;
    }
}

/* Landscape on phone specifically */
@media (max-height: 500px) and (orientation: landscape) {
    .auth-banner {
        display: none;
    }

    .auth-card {
        padding: 12px 16px;
    }

    .auth-logo-img {
        width: 36px;
        height: 36px;
    }

    .auth-title {
        font-size: 16px;
    }

    .auth-sub {
        display: none;
    }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-bright);
}

/* ==================== ПОИСК С ИКОНКОЙ ==================== */
.search-chat-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-chat-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    margin-right: 0;
}

.search-chat-wrapper .search-chat-input {
    padding-left: 34px !important;
}

body.luxury-light .search-chat-icon {
    color: #a19076;
}

/* ==================== КАСТОМНЫЙ ДРОПДАУН ==================== */
/* ==================== CUSTOM SELECT ==================== */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
}

.custom-select-btn .cs-left {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* Компактный вариант кнопки кастомного селекта — для языка на экране входа */
.custom-select-btn.lang-select-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: var(--text-primary);
}

.custom-select-btn.lang-select-btn:hover {
    border-color: var(--gold);
}

body.luxury-light .custom-select-btn.lang-select-btn {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
    color: #2c2416;
}

body.luxury-light .custom-select-btn.lang-select-btn:hover {
    border-color: #d4af37;
}

/* Полноширинный вариант кнопки кастомного селекта — для карточек настроек */
.custom-select-btn.setting-select-btn {
    width: 100%;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 400;
    white-space: normal;
    color: var(--text-primary);
}

.custom-select-btn.setting-select-btn:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
}

.custom-select-btn.setting-select-btn .cs-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-select-btn.setting-select-btn .custom-select-arrow {
    margin-left: 8px;
    font-size: 12px;
}

body.luxury-light .custom-select-btn.setting-select-btn {
    background: rgba(0,0,0,0.03);
    color: #2c2416;
}

.custom-select-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
}

.custom-select-btn .fas {
    margin-right: 0;
    font-size: 13px;
    color: var(--gold);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.custom-select-arrow {
    margin-left: 2px;
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Оригинальный дропдаун скрыт - используем floating */
.custom-select-dropdown {
    display: none !important;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== FLOATING DROPDOWN - рендерится в body, поверх всего ===== */
.floating-dropdown {
    position: fixed !important;
    display: block !important;
    z-index: 99999 !important;
    min-width: 200px;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;

    background: rgba(18, 16, 30, 0.97) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(212, 175, 55, 0.35) !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(212,175,55,0.1) !important;

    padding: 6px !important;
    animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);

    /* Скроллбар */
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,0.3) transparent;
}

.floating-dropdown::-webkit-scrollbar {
    width: 4px;
}
.floating-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.floating-dropdown::-webkit-scrollbar-thumb {
    background: rgba(212,175,55,0.3);
    border-radius: 4px;
}

.floating-dropdown .custom-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    color: #ffffff;
    border-radius: 10px;
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    margin: 2px 0;
}

.floating-dropdown .custom-select-option .fas,
.floating-dropdown .custom-select-option [class*="fa-"] {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--gold);
    flex-shrink: 0;
    margin-right: 0;
    text-align: center;
    background: rgba(212,175,55,0.1);
    border-radius: 6px;
    padding: 2px;
}

@media (hover: hover) {
    .floating-dropdown .custom-select-option:hover {
        background: rgba(212, 175, 55, 0.13);
        color: #fff;
    }

    .floating-dropdown .custom-select-option:hover .fas,
    .floating-dropdown .custom-select-option:hover [class*="fa-"] {
        background: rgba(212,175,55,0.22);
        color: var(--gold-bright);
    }
}

.floating-dropdown .custom-select-option.selected {
    background: rgba(212, 175, 55, 0.16);
    color: var(--gold-bright);
    font-weight: 500;
}

.floating-dropdown .custom-select-option.selected .fas,
.floating-dropdown .custom-select-option.selected [class*="fa-"] {
    background: rgba(212,175,55,0.28);
    color: var(--gold-bright);
}

/* Светлая тема */
body.luxury-light .floating-dropdown {
    background: rgba(255, 252, 244, 0.98) !important;
    border-color: rgba(180, 140, 20, 0.4) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(180,140,20,0.15) !important;
}

body.luxury-light .floating-dropdown .custom-select-option {
    color: #2c2416;
}

body.luxury-light .floating-dropdown .custom-select-option .fas,
body.luxury-light .floating-dropdown .custom-select-option [class*="fa-"] {
    color: #8a6800;
    background: rgba(180,140,20,0.1);
}

body.luxury-light .floating-dropdown .custom-select-option:hover {
    background: rgba(180, 140, 20, 0.12);
    color: #1a0f00;
}

body.luxury-light .floating-dropdown .custom-select-option.selected {
    background: rgba(180, 140, 20, 0.15);
    color: #5a3e00;
}

/* ==================== ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ КНОПОК ==================== */
.speak-ai-msg-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    font-size: 14px;
    transition: var(--transition);
    vertical-align: middle;
    flex-shrink: 0;
}

.speak-ai-msg-btn:hover {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.05);
    color: #0a0a0a;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

.message.ai {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: nowrap;
}

.message.ai .message-content {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow: hidden;
}

.speak-btn-wrapper {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
    gap: 0;
}

.regen-ai-msg-btn:disabled,
.copy-ai-msg-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.variant-nav {
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    gap: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 20px;
    padding: 2px 6px;
}

.variant-nav-btn {
    background: transparent;
    border: none;
    color: var(--gold);
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: var(--transition);
}

.variant-nav-btn:hover:not(:disabled) {
    background: var(--gold);
    color: #0a0a0a;
}

.variant-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.variant-nav-btn .fas {
    margin-right: 0;
}

.variant-nav-label {
    font-size: 11px;
    color: var(--text-secondary, #cfcfcf);
    min-width: 26px;
    text-align: center;
    user-select: none;
}

body.luxury-light .variant-nav {
    background: rgba(0,0,0,0.04);
    border-color: rgba(212, 175, 55, 0.35);
}

body.luxury-light .variant-nav-label {
    color: #5e5340;
}

@media (max-width: 480px) {
    .variant-nav {
        margin-left: 4px;
        padding: 1px 4px;
    }
    .variant-nav-btn {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    .variant-nav-label {
        font-size: 10px;
        min-width: 20px;
    }
}

.message-content img {
    max-width: 100%;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.2s ease;
    margin: 8px 0;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.message-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

/* ==================== СТИЛИ ДЛЯ ИКОНОК FONT AWESOME ==================== */
.fas, .far, .fab {
    margin-right: 6px;
    font-size: 0.9em;
}

.btn-icon-only .fas, 
.btn-icon-only .far {
    margin-right: 0;
}

button .fas, 
button .far,
.mode-select .fas,
.mode-select .far {
    margin-right: 8px;
}

.auth-title .fas,
.auth-title .far {
    margin-right: 8px;
    margin-left: 8px;
}

.banner-features .fas,
.banner-features .far {
    margin-right: 6px;
}

.speak-ai-msg-btn .fas {
    margin-right: 0;
}

.rate-limit-warning i,
.message-box i,
.message-content i {
    margin-right: 6px;
}

@media (max-width: 768px) {
    .fas, .far, .fab {
        margin-right: 4px;
    }
    
    button .fas, 
    button .far {
        margin-right: 5px;
    }
    
    .speak-ai-msg-btn {
        width: 26px;
        height: 26px;
        font-size: 12px;
        margin-left: 6px;
    }
}

@media (max-width: 480px) {
    .speak-ai-msg-btn {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
}
/* ==================== FILE CARD ==================== */
.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(212, 175, 55, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 12px;
    margin: 10px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    max-width: 320px;
}

.file-card:hover {
    background: rgba(212, 175, 55, 0.13);
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.15);
}

.file-card:active {
    transform: translateY(0);
}

.file-card-icon {
    width: 40px;
    height: 40px;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--gold);
    flex-shrink: 0;
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.file-card-arrow {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

body.luxury-light .file-card {
    background: rgba(212, 175, 55, 0.07);
    border-color: rgba(139, 105, 20, 0.25);
}

body.luxury-light .file-card:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(139, 105, 20, 0.45);
}

body.luxury-light .file-card-name {
    color: #1a1a2e;
}

/* ==================== CODE VIEWER MODAL ==================== */
.cv-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: flex-end;
    justify-content: center;
}

.cv-modal.cv-open {
    display: flex;
}

.cv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    animation: cvFadeIn 0.2s ease;
}

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

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

.cv-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
    height: 82vh;
    background: #0e0b1f;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: cvSlideUp 0.25s cubic-bezier(.32,1.2,.6,1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-bottom: none;
}

.cv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(0,0,0,0.35);
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    gap: 10px;
    flex-shrink: 0;
}

.cv-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cv-file-icon {
    width: 38px;
    height: 38px;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--gold);
    flex-shrink: 0;
}

.cv-file-title-wrap {
    min-width: 0;
}

.cv-filename {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv-filemeta {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: 1px;
}

.cv-topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cv-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.cv-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.cv-btn-gold {
    background: linear-gradient(135deg, rgba(212,175,55,0.25), rgba(212,175,55,0.15));
    border-color: rgba(212,175,55,0.4);
    color: var(--gold);
}

.cv-btn-gold:hover {
    background: linear-gradient(135deg, rgba(212,175,55,0.4), rgba(212,175,55,0.25));
    color: #f0cc00;
}

.cv-btn-close {
    padding: 7px 10px;
    border-color: rgba(255,80,80,0.2);
}

.cv-btn-close:hover {
    background: rgba(255,80,80,0.15);
    border-color: rgba(255,80,80,0.4);
    color: #ff6b6b;
}

.cv-btn-success {
    background: rgba(34,197,94,0.15) !important;
    border-color: rgba(34,197,94,0.4) !important;
    color: #22c55e !important;
}

.cv-code-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.cv-line-numbers {
    display: flex;
    flex-direction: column;
    padding: 16px 12px 16px 16px;
    background: rgba(0,0,0,0.2);
    border-right: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.2);
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    flex-shrink: 0;
    overflow: hidden;
    min-width: 40px;
}

.cv-line-numbers span {
    display: block;
}

.cv-pre {
    flex: 1;
    margin: 0;
    padding: 16px 20px;
    overflow: auto;
    background: transparent;
    color: rgba(255,255,255,0.88);
    white-space: pre;
    word-wrap: normal;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,0.3) transparent;
}

.cv-pre::-webkit-scrollbar { width: 6px; height: 6px; }
.cv-pre::-webkit-scrollbar-track { background: transparent; }
.cv-pre::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.3); border-radius: 3px; }

/* Светлая тема для модала */
body.luxury-light .cv-panel {
    background: #faf8f0;
    border-color: rgba(139,105,20,0.25);
}

body.luxury-light .cv-topbar {
    background: rgba(212,175,55,0.08);
    border-color: rgba(139,105,20,0.2);
}

body.luxury-light .cv-filename { color: #1a1a2e; }
body.luxury-light .cv-filemeta { color: rgba(0,0,0,0.4); }

body.luxury-light .cv-btn {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.12);
    color: rgba(0,0,0,0.65);
}

body.luxury-light .cv-btn:hover {
    background: rgba(0,0,0,0.1);
    color: #000;
}

body.luxury-light .cv-line-numbers {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.07);
    color: rgba(0,0,0,0.25);
}

body.luxury-light .cv-pre {
    color: #1a1a2e;
}

/* Мобильные адаптации */
@media (max-width: 600px) {
    .cv-panel { height: 90vh; border-radius: 16px 16px 0 0; }
    .cv-btn span { display: none; }
    .cv-btn { padding: 8px 10px; }
    .cv-topbar { padding: 12px 12px; }
    .cv-filename { font-size: 13px; }
    .file-card { max-width: 100%; }
}

/* ==================== PC / DESKTOP MODE ==================== */
/* Только настоящий ПК: широкий экран + мышь (не телефон в горизонтали) */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
    /* ── App wrapper: sidebar + chat side by side, full viewport height ── */
    .app {
        display: flex !important;
        flex-direction: row !important;
        height: 100vh !important;
        overflow: hidden !important;
        width: 100vw;
    }

    /* ── Sidebar: always visible, fixed width, full height, no slide-in ── */
    .sidebar {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 280px !important;
        min-width: 280px !important;
        max-width: 280px !important;
        height: 100vh !important;
        flex-shrink: 0 !important;
        transform: none !important;
        transition: none !important;
        box-shadow: none !important;
        z-index: 10 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* Chats list scrollable inside sidebar */
    .sidebar .chats-list {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        min-height: 0 !important;
    }

    /* ── Hide mobile-only elements ── */
    .menu-toggle {
        display: none !important;
    }

    .overlay {
        display: none !important;
    }

    /* ── Chat container: takes remaining space, own scroll ── */
    .chat-container {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: 0 !important;
        height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* ── Messages area: fills remaining vertical space, own scroll ── */
    .messages-area {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        padding: 24px 36px !important;
    }

    /* ── Input area: never grows beyond reasonable size ── */
    .input-area {
        flex-shrink: 0 !important;
        padding: 14px 36px 18px !important;
    }

    /* Always show extra buttons, hide the + toggle */
    .input-buttons {
        display: flex !important;
        animation: none !important;
    }

    .plus-btn {
        display: none !important;
    }

    /* Wider textarea on desktop */
    .input-row textarea {
        max-height: 160px;
        font-size: 15px !important;
    }

    /* Top bar wider padding */
    .top-bar {
        padding: 12px 32px !important;
        flex-shrink: 0;
    }

    /* Chat header */
    .chat-header {
        padding: 18px 36px 14px !important;
        flex-shrink: 0;
    }

    /* Rate-limit bar */
    .rate-limit-container {
        padding: 8px 36px !important;
        flex-shrink: 0;
    }

    /* Code viewer centered on desktop */
    .cv-modal {
        align-items: center !important;
    }
    .cv-panel {
        border-radius: 20px !important;
        border-bottom: 1px solid rgba(212, 175, 55, 0.2) !important;
        height: 75vh !important;
    }

    /* Scrollbar styling */
    .messages-area::-webkit-scrollbar { width: 5px; }
    .messages-area::-webkit-scrollbar-track { background: transparent; }
    .messages-area::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.25); border-radius: 3px; }
    .messages-area::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,0.45); }

    .chats-list::-webkit-scrollbar { width: 4px; }
    .chats-list::-webkit-scrollbar-track { background: transparent; }
    .chats-list::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.2); border-radius: 2px; }
}

/* ── Телефон / планшет в горизонтали - оставляем мобильный режим ── */
@media (min-width: 1024px) and (hover: none),
       (min-width: 1024px) and (pointer: coarse) {
    /* Принудительно сбрасываем PC-стили обратно к мобильным */
    .sidebar {
        position: fixed !important;
        left: -290px !important;
        top: 0 !important;
        width: 290px !important;
        min-width: unset !important;
        max-width: unset !important;
        height: 100vh !important;
        transition: left 0.3s ease !important;
        box-shadow: 5px 0 30px rgba(0,0,0,0.5) !important;
        z-index: 1000 !important;
    }

    .sidebar.open {
        left: 0 !important;
    }

    .menu-toggle {
        display: flex !important;
    }

    /* Скрыть бургер когда сайдбар открыт */
    body.sidebar-open .menu-toggle {
        display: none !important;
    }

    .sidebar.open ~ * .menu-toggle {
        display: none !important;
    }

    .overlay.active {
        display: block !important;
        pointer-events: auto !important;
        z-index: 999 !important;
    }

    .app {
        height: auto !important;
        overflow: visible !important;
    }

    .chat-container {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    .input-buttons {
        display: none !important;
    }

    .input-buttons.show {
        display: flex !important;
    }

    .plus-btn {
        display: flex !important;
    }
}

/* ==================== PRESENTATION BUTTON ==================== */
.presentation-btn {
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 700 !important;
}

.presentation-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5) !important;
    background: linear-gradient(135deg, #6d28d9, #9333ea) !important;
}

body.luxury-light .presentation-btn {
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    color: #fff !important;
}

/* ==================== PRESENTATION MODAL ==================== */
/* ========== PRESENTATION MODAL - EliteTon Redesign ========== */
.pres-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 600px) {
    .pres-modal { align-items: center; }
}

.pres-modal.pres-open {
    display: flex;
}

.pres-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 3, 14, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pres-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 580px;
    max-height: 92vh;
    background: linear-gradient(170deg, #0e0c1e 0%, #0a0814 100%);
    border-radius: 28px 28px 0 0;
    border: 1px solid rgba(212,175,55,0.22);
    border-bottom: none;
    box-shadow: 0 -8px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(212,175,55,0.08) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: presSheetUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 600px) {
    .pres-panel {
        border-radius: 26px;
        border-bottom: 1px solid rgba(212,175,55,0.22);
        animation: presSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
        max-height: 88vh;
    }
}

@keyframes presSheetUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes presSlideIn {
    from { transform: translateY(24px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Drag handle for mobile sheet */
.pres-drag-handle {
    width: 40px;
    height: 4px;
    background: rgba(212,175,55,0.3);
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .pres-drag-handle { display: none; }
}

.pres-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px 16px;
    position: relative;
}

.pres-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 22px; right: 22px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.25), transparent);
}

.pres-header-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(145deg, rgba(212,175,55,0.15) 0%, rgba(212,175,55,0.05) 100%);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--gold);
    border: 1px solid rgba(212,175,55,0.25);
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(212,175,55,0.12);
}

.pres-title {
    font-weight: 700;
    font-size: 17px;
    font-family: 'Playfair Display', serif;
    color: #ede8d8;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.pres-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    letter-spacing: 0.1px;
}

.pres-close {
    margin-left: auto;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.pres-close:hover {
    background: rgba(255,80,80,0.12);
    border-color: rgba(255,80,80,0.2);
    color: #f87171;
}

.pres-body {
    padding: 20px 22px 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Topic input - full-width prominent */
.pres-topic-wrap {
    position: relative;
}

.pres-topic-wrap input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(212,175,55,0.2);
    border-radius: 14px;
    padding: 14px 16px 14px 44px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14.5px;
    outline: none;
    transition: all 0.22s;
}

.pres-topic-wrap input::placeholder { color: rgba(184,184,208,0.4); }

.pres-topic-wrap input:focus {
    border-color: rgba(212,175,55,0.55);
    background: rgba(212,175,55,0.04);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.09);
}

.pres-topic-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(212,175,55,0.45);
    font-size: 14px;
    pointer-events: none;
}

/* Section label */
.pres-label {
    display: block;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(212,175,55,0.7);
    margin-bottom: 9px;
}

/* Slide count - pill toggle row */
.pres-slide-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pres-pill {
    flex: 1;
    min-width: 52px;
    padding: 9px 6px;
    border-radius: 11px;
    border: 1.5px solid rgba(212,175,55,0.15);
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.18s;
}

.pres-pill:hover {
    border-color: rgba(212,175,55,0.35);
    color: var(--gold);
    background: rgba(212,175,55,0.06);
}

.pres-pill.active {
    border-color: var(--gold);
    background: rgba(212,175,55,0.12);
    color: var(--gold);
    box-shadow: 0 0 10px rgba(212,175,55,0.15);
}

/* Style selector - horizontal cards */
.pres-style-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.pres-style-card {
    position: relative;
    padding: 11px 12px;
    border-radius: 13px;
    border: 1.5px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.pres-style-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: inherit;
}

.pres-style-card[data-style="dark"]::before   { background: linear-gradient(135deg, rgba(212,175,55,0.08), transparent); }
.pres-style-card[data-style="light"]::before  { background: linear-gradient(135deg, rgba(250,240,200,0.06), transparent); }
.pres-style-card[data-style="purple"]::before { background: linear-gradient(135deg, rgba(168,85,247,0.1), transparent); }
.pres-style-card[data-style="blue"]::before   { background: linear-gradient(135deg, rgba(59,130,246,0.1), transparent); }

.pres-style-card:hover::before,
.pres-style-card.active::before { opacity: 1; }

.pres-style-card.active {
    border-color: rgba(212,175,55,0.45);
    box-shadow: 0 0 14px rgba(212,175,55,0.1);
}

.pres-style-dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.pres-style-dot.dark   { background: linear-gradient(135deg, #1a1625, #0d0b18); border: 1px solid rgba(212,175,55,0.3); color: #d4af37; }
.pres-style-dot.light  { background: linear-gradient(135deg, #f5f0e8, #ede6d4); border: 1px solid rgba(180,150,40,0.3); color: #8a6d10; }
.pres-style-dot.purple { background: linear-gradient(135deg, #2d1b69, #1a0e45); border: 1px solid rgba(168,85,247,0.4); color: #c084fc; }
.pres-style-dot.blue   { background: linear-gradient(135deg, #0f2447, #071830); border: 1px solid rgba(59,130,246,0.35); color: #60a5fa; }

.pres-style-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}

.pres-style-card.active .pres-style-name { color: var(--text-primary); }

.pres-style-check {
    margin-left: auto;
    color: var(--gold);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.18s;
}

.pres-style-card.active .pres-style-check { opacity: 1; }

/* Extra textarea */
.pres-extra-wrap textarea {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1.5px solid rgba(255,255,255,0.07);
    border-radius: 13px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    resize: none;
    transition: all 0.2s;
    line-height: 1.5;
    min-height: 72px;
}

.pres-extra-wrap textarea::placeholder { color: rgba(184,184,208,0.35); }

.pres-extra-wrap textarea:focus {
    border-color: rgba(212,175,55,0.3);
    background: rgba(212,175,55,0.02);
}

/* Progress */
.pres-progress {
    display: none;
    align-items: center;
    gap: 11px;
    padding: 11px 15px;
    background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.18);
    border-radius: 12px;
    color: rgba(212,175,55,0.85);
    font-size: 12.5px;
}

.pres-progress.visible { display: flex; }

.pres-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(212,175,55,0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

/* Footer */
.pres-footer {
    padding: 14px 22px 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (min-width: 600px) {
    .pres-footer { padding-bottom: 14px; }
}

.pres-footer::before {
    display: none;
}

.pres-btn {
    padding: 13px 20px;
    border-radius: 14px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.22s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.pres-btn-cancel {
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.09);
    color: var(--text-muted);
    padding: 13px 18px;
    flex-shrink: 0;
}

.pres-btn-cancel:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-secondary);
}

.pres-btn-generate {
    flex: 1;
    background: linear-gradient(135deg, #c9971e 0%, #e8c84a 45%, #c9971e 100%);
    background-size: 200% auto;
    color: #0a0814;
    font-weight: 700;
    font-size: 14.5px;
    box-shadow: 0 4px 20px rgba(212,175,55,0.25);
    transition: all 0.25s;
}

.pres-btn-generate:hover {
    background-position: right center;
    box-shadow: 0 6px 28px rgba(212,175,55,0.38);
    transform: translateY(-1px);
}

.pres-btn-generate:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(212,175,55,0.2);
}

.pres-btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Hidden select (keep for JS compatibility) */
#presSlideCount, #presStyleSelect {
    display: none !important;
}

#docLength, #docFormatSelect {
    display: none !important;
}

#docFormatCards {
    grid-template-columns: 1fr 1fr 1fr;
}

#docFormatCards .pres-style-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 14px 8px;
}

#docFormatCards .pres-style-name {
    text-align: center;
}

#docFormatCards .pres-style-check {
    position: absolute;
    top: 8px;
    right: 8px;
    margin-left: 0;
}

#docFormatCards .pres-style-dot {
    margin: 0 auto;
}

#docFormatCards .pres-style-dot i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

/* Light theme overrides */
body.luxury-light .pres-panel {
    background: linear-gradient(170deg, #faf7ee 0%, #f4f0e3 100%);
    border-color: rgba(180,140,30,0.25);
}

body.luxury-light .pres-title { color: #2c2010; }
body.luxury-light .pres-subtitle { color: #8a7a55; }
body.luxury-light .pres-label { color: rgba(160,120,20,0.8); }

body.luxury-light .pres-topic-wrap input,
body.luxury-light .pres-extra-wrap textarea {
    background: rgba(255,255,255,0.75);
    border-color: rgba(180,140,30,0.2);
    color: #2c2010;
}

body.luxury-light .pres-topic-wrap input:focus,
body.luxury-light .pres-extra-wrap textarea:focus {
    border-color: rgba(180,140,30,0.5);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(180,140,30,0.08);
}

body.luxury-light .pres-pill {
    background: rgba(0,0,0,0.03);
    border-color: rgba(180,140,30,0.18);
    color: #6a5c3a;
}

body.luxury-light .pres-pill.active {
    background: rgba(180,140,30,0.12);
    border-color: #c9971e;
    color: #8a6010;
}

body.luxury-light .pres-style-card {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.08);
}

body.luxury-light .pres-style-card.active {
    border-color: rgba(180,140,30,0.45);
}

body.luxury-light .pres-style-name { color: #5a4e30; }
body.luxury-light .pres-style-card.active .pres-style-name { color: #2c2010; }

body.luxury-light .pres-btn-cancel {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.1);
    color: #8a7a55;
}

body.luxury-light .pres-drag-handle { background: rgba(180,140,30,0.25); }

body.luxury-light .pres-header::after {
    background: linear-gradient(90deg, transparent, rgba(180,140,30,0.2), transparent);
}

/* ==================== CRITICAL AUTH FIX ==================== */
#authOverlay {
    z-index: 99999 !important;
    pointer-events: all !important;
}

#authOverlay .auth-card {
    pointer-events: all !important;
    z-index: 100000 !important;
    position: relative !important;
}

#authOverlay .auth-card * {
    pointer-events: auto !important;
}

#authOverlay button,
#authOverlay input,
#authOverlay select,
#authOverlay a {
    pointer-events: auto !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(212,175,55,0.25) !important;
}

/* sidebar and overlay stay below auth */
#sidebar { z-index: 500 !important; }
#overlay { z-index: 490 !important; }
.app { z-index: 1 !important; }
.menu-toggle { z-index: 495 !important; }

/* ==================== SMOOTH ANIMATIONS ==================== */
html { scroll-behavior: smooth; }

body {
    transition: background 0.5s cubic-bezier(0.4,0,0.2,1),
                color 0.35s cubic-bezier(0.4,0,0.2,1) !important;
}

.message {
    animation: msgSlideIn 0.38s cubic-bezier(0.34,1.2,0.64,1) both;
}

@keyframes msgSlideIn {
    from { opacity:0; transform:translateY(14px) scale(0.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

.message.user {
    animation: msgSlideInRight 0.38s cubic-bezier(0.34,1.2,0.64,1) both;
}

@keyframes msgSlideInRight {
    from { opacity:0; transform:translateX(20px) scale(0.97); }
    to   { opacity:1; transform:translateX(0) scale(1); }
}

.sidebar {
    transition: transform 0.38s cubic-bezier(0.4,0,0.2,1),
                left 0.38s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.38s ease !important;
}

.modal { animation: modalFadeIn 0.28s cubic-bezier(0.4,0,0.2,1) both; }

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

.modal-content {
    animation: modalSlideUp 0.32s cubic-bezier(0.34,1.2,0.64,1) both;
}

@keyframes modalSlideUp {
    from { opacity:0; transform:translateY(30px) scale(0.96); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

.typing-indicator {
    animation: typingFadeIn 0.25s cubic-bezier(0.4,0,0.2,1) both;
}

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

/* Smooth buttons - only in chat, NOT auth */
.chat-container button,
.sidebar button,
.input-row button,
.modal button,
.top-bar button {
    transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
}

.chat-container button:active,
.sidebar button:active,
.input-row button:active {
    transform: scale(0.94);
    transition: all 0.08s ease !important;
}

/* Auth must NEVER be blocked */
#authOverlay {
    z-index: 99999 !important;
    pointer-events: all !important;
}
#authOverlay .auth-card {
    pointer-events: all !important;
    z-index: 100000 !important;
    position: relative !important;
}
#authOverlay button,
#authOverlay input,
#authOverlay select,
#authOverlay a {
    pointer-events: auto !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(212,175,55,0.2) !important;
    transition: all 0.2s ease !important;
    transform: none !important;
}
#authOverlay button:active { opacity: 0.8 !important; transform: none !important; }
#sidebar { z-index: 500 !important; }
#overlay { z-index: 490 !important; }
.app { z-index: 1 !important; }
.menu-toggle { z-index: 495 !important; }

/* ==================== MARKDOWN TABLES ==================== */
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin: 14px 0;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.message-content table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 12.5px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.message-content th {
    background: linear-gradient(135deg,rgba(212,175,55,0.28),rgba(212,175,55,0.15));
    color: var(--gold);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(212,175,55,0.3);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.message-content td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: var(--text-secondary);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.message-content tr:last-child td { border-bottom: none; }
.message-content tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
.message-content tr:hover td { background: rgba(212,175,55,0.07); transition: background 0.2s; }
.message-content th:first-child, .message-content td:first-child { width: 30%; }

body.luxury-light .message-content th {
    background: linear-gradient(135deg,rgba(212,175,55,0.2),rgba(212,175,55,0.1));
    color: #8b6914;
    border-bottom-color: rgba(212,175,55,0.35);
}
body.luxury-light .message-content td { border-bottom-color: rgba(0,0,0,0.06); color:#5e5340; }
body.luxury-light .message-content tr:nth-child(even) td { background:rgba(212,175,55,0.04); }
body.luxury-light .message-content tr:hover td { background:rgba(212,175,55,0.09); }

/* ==================== CHAT MODE SELECTOR ==================== */
.chat-mode-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 24px;
    gap: 22px;
    animation: msgSlideIn 0.4s cubic-bezier(0.34,1.2,0.64,1) both;
}

.chat-mode-title {
    font-size: 17px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

.chat-mode-options {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 380px;
}

.chat-mode-card {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(212,175,55,0.2);
    border-radius: 20px;
    padding: 22px 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34,1.2,0.64,1);
}

.chat-mode-card:hover {
    border-color: rgba(212,175,55,0.55);
    transform: translateY(-5px);
    box-shadow: 0 14px 32px rgba(0,0,0,0.3);
}

.chat-mode-card.pro:hover {
    border-color: rgba(255,95,168,0.55);
    box-shadow: 0 14px 32px rgba(255,95,168,0.2);
}

.chat-mode-card:active { transform: scale(0.95) !important; }

.chat-mode-icon { font-size: 34px; margin-bottom: 10px; display: block; color: var(--gold); }
.chat-mode-card.pro .chat-mode-icon { color: #ff5fa8; }
.chat-mode-label { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.chat-mode-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

body.luxury-light .chat-mode-card {
    background: linear-gradient(160deg, rgba(255,252,245,0.9), rgba(250,240,220,0.6));
    border-color: rgba(212,175,55,0.3);
}
body.luxury-light .chat-mode-card:hover {
    box-shadow: 0 14px 32px rgba(212,175,55,0.18);
}
body.luxury-light .chat-mode-card.pro:hover {
    box-shadow: 0 14px 32px rgba(255,95,168,0.16);
}
body.luxury-light .chat-mode-icon { color: #b8860b; }
body.luxury-light .chat-mode-card.pro .chat-mode-icon { color: #ff5fa8; }
body.luxury-light .chat-mode-label { color: #2d2416; }
body.luxury-light .chat-mode-desc { color: #8a7a55; }

/* ==================== CALL UI ==================== */
.call-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(22px);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: callFadeIn 0.35s ease both;
}

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

.call-card {
    position: relative;
    background: linear-gradient(145deg,#1a1530,#0d0b1a);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 32px;
    padding: 40px 32px 32px;
    width: 88%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 40px rgba(212,175,55,0.08);
    animation: callCardIn 0.42s cubic-bezier(0.34,1.2,0.64,1) both;
}

@keyframes callCardIn {
    from { opacity:0; transform:scale(0.85) translateY(24px); }
    to   { opacity:1; transform:scale(1) translateY(0); }
}

.call-avatar-ring {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
}

.call-avatar-ring::before,
.call-avatar-ring::after {
    content:'';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(212,175,55,0.35);
    animation: callRing 1.8s ease-out infinite;
}

.call-avatar-ring::after {
    inset: -18px;
    border-color: rgba(212,175,55,0.18);
    animation-delay: 0.6s;
}

@keyframes callRing {
    0%   { transform:scale(1); opacity:1; }
    100% { transform:scale(1.25); opacity:0; }
}

.call-avatar-letter {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    background: linear-gradient(135deg,#1a0b2e,#0d0b1a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg,var(--gold),var(--gold-bright));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    z-index: 1;
}

.call-avatar-img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    object-fit: cover;
    background: linear-gradient(135deg,#1a0b2e,#0d0b1a);
    position: relative;
    z-index: 1;
    display: block;
}

/* ===== "Живое" лицо-робот EliteTon в звонке ===== */
.robot-face {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    background: radial-gradient(circle at 35% 30%, #2a1a4a, #0d0b1a 70%);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.robot-eye {
    position: absolute;
    top: 38px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gold-bright, #f0d060);
    box-shadow: 0 0 6px 1px rgba(212,175,55,0.6);
    animation: robotBlink 4.5s ease-in-out infinite;
}
.robot-eye-left { left: 26px; }
.robot-eye-right { right: 26px; }

@keyframes robotBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.12); }
}

.robot-mouth {
    position: absolute;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    width: 28px;
    height: 4px;
    border-radius: 3px;
    background: var(--gold-bright, #f0d060);
    box-shadow: 0 0 5px rgba(212,175,55,0.5);
}

/* Слушает - глаза светятся ярче */
.robot-face.state-listening .robot-eye {
    box-shadow: 0 0 10px 3px rgba(212,175,55,0.9);
}

/* Думает - глаза "бегают" из стороны в сторону */
.robot-face.state-thinking .robot-eye {
    animation: robotThinkEyes 1.1s ease-in-out infinite, robotBlink 4.5s ease-in-out infinite;
}
@keyframes robotThinkEyes {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

/* Говорит - рот активно "болтает" */
.robot-face.state-speaking .robot-mouth {
    animation: robotTalk 0.32s ease-in-out infinite;
}
@keyframes robotTalk {
    0%, 100% { height: 4px; width: 26px; }
    50% { height: 15px; width: 18px; border-radius: 8px; }
}

.call-self-video {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 74px;
    height: 98px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--gold);
    display: none;
    z-index: 3;
    background: #000;
}
.call-self-video.active { display: block; }
.call-self-video.mirrored { transform: scaleX(-1); } /* зеркалим только фронтальную камеру */

.call-ctrl-btn.cam-btn.active {
    background: var(--gold);
    color: #1a0b2e;
}

.call-ctrl-btn.switch-cam-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
    align-self: center;
}

.call-name {
    font-size: 21px;
    font-weight: 700;
    background: linear-gradient(135deg,var(--gold),var(--gold-bright));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 5px;
}

.call-status { font-size:14px; color:var(--text-muted); margin-bottom:8px; min-height:20px; }

.call-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 34px;
    margin: 10px 0 18px;
}

.call-waveform .bar {
    width: 4px;
    background: linear-gradient(to top,var(--gold),var(--gold-bright));
    border-radius: 2px;
    animation: waveBar 1.2s ease-in-out infinite;
    min-height: 5px;
}

.call-waveform .bar:nth-child(1){animation-delay:0s}
.call-waveform .bar:nth-child(2){animation-delay:.1s}
.call-waveform .bar:nth-child(3){animation-delay:.2s}
.call-waveform .bar:nth-child(4){animation-delay:.3s}
.call-waveform .bar:nth-child(5){animation-delay:.4s}
.call-waveform .bar:nth-child(6){animation-delay:.3s}
.call-waveform .bar:nth-child(7){animation-delay:.2s}
.call-waveform .bar:nth-child(8){animation-delay:.1s}

@keyframes waveBar {
    0%,100% { height:5px; }
    50%      { height:28px; }
}

.call-waveform.silent .bar {
    animation: waveSilent 2s ease-in-out infinite;
}

@keyframes waveSilent {
    0%,100% { height:5px; }
    50%      { height:9px; }
}

.call-transcript {
    background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.18);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    min-height: 44px;
    max-height: 80px;
    overflow-y: auto;
    text-align: left;
    line-height: 1.5;
    margin-bottom: 18px;
}

.call-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 14px;
    gap: 14px;
}

.call-ctrl-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    transition: all 0.25s cubic-bezier(0.34,1.3,0.64,1);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
}

.call-ctrl-btn:hover { transform: scale(1.1); }
.call-ctrl-btn:active { transform: scale(0.9) !important; }
.call-ctrl-btn.muted, .call-ctrl-btn.mute-btn:hover { background:rgba(212,175,55,0.2); border-color:rgba(212,175,55,0.4); }

.call-ctrl-btn.end-btn {
    width: 68px;
    height: 68px;
    font-size: 24px;
    background: linear-gradient(135deg,#ef4444,#dc2626);
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(239,68,68,0.4);
}

.call-ctrl-btn.end-btn:hover { box-shadow:0 8px 28px rgba(239,68,68,0.6); }

/* Call button in input */
.call-btn-input {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(212,175,55,0.1);
    border: 1px solid rgba(212,175,55,0.3);
    color: var(--gold);
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.34,1.3,0.64,1);
    flex-shrink: 0;
}

.call-btn-input:hover {
    background: rgba(212,175,55,0.22);
    border-color: var(--gold);
    transform: scale(1.08);
    box-shadow: 0 0 14px rgba(212,175,55,0.3);
}

.call-btn-input.active {
    background: linear-gradient(135deg,#ef4444,#dc2626);
    border-color: #ef4444;
    color: white;
    animation: callPulse 1.5s ease-in-out infinite;
}

@keyframes callPulse {
    0%,100% { box-shadow:0 0 0 0 rgba(239,68,68,0.4); }
    50%      { box-shadow:0 0 0 8px rgba(239,68,68,0); }
}

body.luxury-light .call-card {
    background: linear-gradient(145deg,#fffaf0,#f5efe3);
    border-color: rgba(212,175,55,0.4);
}
body.luxury-light .call-status { color:#8a7a55; }
body.luxury-light .call-transcript { background:rgba(212,175,55,0.08); border-color:rgba(212,175,55,0.25); color:#5e5340; }
body.luxury-light .call-ctrl-btn { background:rgba(0,0,0,0.06); border-color:rgba(0,0,0,0.12); color:#5e5340; }

/* ==================== ЛУПА ДЛЯ СЛАБОЗРЯЩИХ ==================== */
.magnifier-lens {
    position: fixed;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.6), 0 0 20px rgba(212,175,55,0.4);
    pointer-events: none;
    z-index: 999999;
    overflow: hidden;
    display: none;
    background: var(--bg-deep);
}

.magnifier-lens.active {
    display: block;
}

.magnifier-content {
    position: absolute;
    transform-origin: 0 0;
    pointer-events: none;
}

/* Кнопка лупы в настройках - добавляется через JS */
.magnifier-toggle-btn {
    width: 100%;
    padding: 10px 14px;
    background: rgba(212,175,55,0.1);
    border: 1.5px solid rgba(212,175,55,0.3);
    border-radius: var(--radius-md);
    color: var(--gold);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.magnifier-toggle-btn:hover {
    background: rgba(212,175,55,0.2);
    border-color: var(--gold);
}

.magnifier-toggle-btn.on {
    background: rgba(212,175,55,0.25);
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(212,175,55,0.3);
}

/* Плавающая кнопка лупы (всегда видна когда активна) */
.magnifier-fab {
    position: fixed;
    bottom: 90px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    border: none;
    color: #0a0a0a;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(212,175,55,0.5);
    transition: var(--transition);
}

.magnifier-fab.visible {
    display: flex;
}

.magnifier-fab:hover {
    transform: scale(1.1);
}

/* ==================== ICON ALIGNMENT FIXES ==================== */
/* Ensure all FontAwesome icons in buttons are perfectly centered */
button .fas,
button .far,
button .fab,
.icon-btn .fas,
.icon-btn .far,
.new-chat-btn .fas,
.new-chat-btn .far,
.send-btn .fas,
.send-btn .far,
.auth-btn .fas,
.auth-btn .far,
.save-settings .fas,
.close-modal .fas,
.password-modal-btn .fas,
.social-link-btn .fas,
.social-link-btn .fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    margin-right: 6px;
    margin-left: 0;
    position: relative;
    top: 0;
}

/* Fix icon-only buttons (no text beside icon) */
.call-btn-input .fas,
.attach-btn .fas,
.plus-btn .fas,
.voice-btn .fas,
.speak-ai-msg-btn .fas,
.call-ctrl-btn .fas {
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

/* ===== FIX: Marketplace card icons - убираем margin чтобы иконка была по центру ===== */
.mp-card-icon .fas,
.mp-card-icon .far,
.mp-card-icon .fab,
.mp-fav-btn .fas,
.mp-fav-btn .far,
.mp-fav-btn .fab,
.mp-install-btn .fas,
.mp-install-btn .far,
.mp-badge .fas,
.mp-badge .far,
.mp-badge i,
.search-chat-icon .fas,
.search-chat-icon .far {
    margin-right: 0 !important;
    margin-left: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

/* Исключение: badge с текстом после иконки - маленький отступ */
.mp-badge i {
    margin-right: 3px !important;
}

/* Иконка в mp-card-author (перед именем автора) - тоже нужен маленький отступ */
.mp-card-author .fas,
.mp-card-author .far {
    margin-right: 4px !important;
    margin-left: 0 !important;
}

/* Иконка в mp-stat (стрелка загрузок, комментарий) - отступ справа убираем */
.mp-stat .fas,
.mp-stat .far {
    margin-right: 4px !important;
    margin-left: 0 !important;
}

/* Fix chat action buttons (rename, delete, download) */
.chat-rename-btn .fas,
.chat-delete-btn .fas,
.chat-download-btn .fas,
.delete-device-btn .fas {
    margin-right: 0;
}

/* Fix auth title icons */
.auth-title .fas,
.auth-title .far {
    vertical-align: middle;
    line-height: 1;
}

/* Fix modal title icons */
.modal-title .fas,
.modal-title .far {
    margin-right: 8px;
    vertical-align: middle;
}

/* Fix setting label icons */
.setting-label .fas,
.setting-label .far {
    width: 16px;
    text-align: center;
    margin-right: 8px;
    vertical-align: middle;
}

/* ==================== PROFESSIONAL REFINEMENTS (v2) ==================== */

/* --- Шрифт: заменяем Inter на более характерный --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Playfair+Display:wght@400;600;700;800;900&display=swap');

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* --- Тонкая горизонтальная золотая линия наверху страницы --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold-bright) 50%, var(--gold) 70%, transparent 100%);
    z-index: 99999;
    pointer-events: none;
}

/* --- Auth Card: более чистый, строгий --- */
.auth-card {
    border: 1px solid rgba(212, 175, 55, 0.25) !important;
    box-shadow: 0 20px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(212,175,55,0.1) !important;
}

/* --- Auth title: Playfair тоньше и строже --- */
.auth-title {
    font-size: 22px !important;
    letter-spacing: 3px !important;
    font-weight: 700 !important;
}

/* --- Auth sub: тоньше, изящнее --- */
.auth-sub {
    font-size: 8px !important;
    letter-spacing: 5px !important;
    opacity: 0.6;
}

/* --- Auth inputs: более строгий стиль --- */
.auth-input {
    border-radius: 8px !important;
    font-size: 13px !important;
    letter-spacing: 0.3px;
    padding: 10px 16px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(212,175,55,0.18) !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

.auth-input:focus {
    border-color: rgba(212,175,55,0.6) !important;
    box-shadow: 0 0 0 2px rgba(212,175,55,0.12) !important;
    background: rgba(255,255,255,0.06) !important;
}

/* --- Auth button: без скругления сверху, строгий --- */
.auth-btn {
    border-radius: 8px !important;
    letter-spacing: 1.5px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 11px !important;
    background: linear-gradient(135deg, #c9a42a, #e8c84f) !important;
    box-shadow: 0 2px 12px rgba(212,175,55,0.3) !important;
}

.auth-btn:hover {
    box-shadow: 0 4px 20px rgba(212,175,55,0.45) !important;
    transform: translateY(-1px) !important;
}

/* --- Banner features tags: чище, меньше --- */
.banner-features span {
    font-size: 9px !important;
    letter-spacing: 0.4px !important;
    font-weight: 600 !important;
    padding: 3px 9px !important;
    background: rgba(10,8,20,0.65) !important;
    border-color: rgba(212,175,55,0.25) !important;
}

/* --- Sidebar: тоньше граница, чище фон --- */
.sidebar {
    background: rgba(8, 8, 16, 0.92) !important;
    border-right: 1px solid rgba(212,175,55,0.2) !important;
}

.sidebar-logo span {
    font-size: 11px !important;
    letter-spacing: 3px !important;
    font-weight: 700 !important;
    color: rgba(212,175,55,0.8) !important;
}

/* --- New chat btn: строже --- */
.new-chat-btn {
    border-radius: 8px !important;
    letter-spacing: 1.5px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #c9a42a, #e8c84f) !important;
    padding: 10px !important;
}

/* --- Chat items: более чистые --- */
.chat-item {
    border-radius: 8px !important;
    padding: 10px 12px !important;
}

.chat-name {
    font-size: 12.5px !important;
    font-weight: 500 !important;
    letter-spacing: 0.1px;
}

/* --- Icon buttons в footer: единый стиль --- */
.icon-btn {
    border-radius: 8px !important;
    font-size: 11px !important;
    letter-spacing: 1px !important;
    font-weight: 600 !important;
    padding: 9px 12px !important;
}

/* --- Top bar: чище --- */
.top-bar {
    padding: 10px 20px !important;
    border-bottom: 1px solid rgba(212,175,55,0.18) !important;
}

/* --- Mode select кнопки: строже --- */
.mode-select, .custom-select-btn {
    border-radius: 8px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    padding: 7px 14px !important;
}

/* --- Chat header: чище, минимализм --- */
.chat-header {
    padding: 16px 24px 10px !important;
    border-bottom: 1px solid rgba(212,175,55,0.12) !important;
    background: rgba(10,10,18,0.4);
}

.chat-title {
    font-size: 1.15rem !important;
    letter-spacing: 0.5px;
}

.chat-sub {
    font-size: 0.72rem !important;
    letter-spacing: 0.8px !important;
    color: rgba(212,175,55,0.45) !important;
    text-transform: uppercase;
}

/* --- Crown icon: заменяется на тонкий символ через CSS --- */
.crown-icon i {
    color: var(--gold) !important;
    font-size: 0.85em !important;
    opacity: 0.85;
}

/* --- Messages: более чистые бабблы --- */
.message.user {
    border-radius: 16px 16px 4px 16px !important;
    font-size: 13.5px !important;
}

.message.ai {
    border-radius: 4px 16px 16px 16px !important;
}

.message-avatar {
    border-radius: 50%;
    border: 1.5px solid rgba(212,175,55,0.3) !important;
}

/* --- Input area: чище --- */
.input-row textarea {
    border-radius: 12px !important;
    font-size: 13.5px !important;
    background: rgba(15,15,25,0.8) !important;
    border-color: rgba(212,175,55,0.15) !important;
}

.input-row textarea:focus {
    border-color: rgba(212,175,55,0.5) !important;
    box-shadow: 0 0 0 2px rgba(212,175,55,0.12) !important;
}

/* --- Send button: строже --- */
.send-btn {
    border-radius: 12px !important;
    font-size: 11px !important;
    letter-spacing: 1.5px !important;
    background: linear-gradient(135deg, #c9a42a, #e8c84f) !important;
}

/* --- Plus btn --- */
.plus-btn {
    border-radius: 50% !important;
    background: linear-gradient(135deg, #c9a42a, #e8c84f) !important;
}

/* --- Input extra buttons: строже --- */
.input-buttons button {
    border-radius: 8px !important;
    font-size: 11px !important;
    letter-spacing: 0.5px;
    padding: 9px 16px !important;
}

.image-gen-btn {
    background: linear-gradient(135deg, #c9a42a, #e8c84f) !important;
}

/* --- Модальное окно: чище --- */
.modal-content {
    border-radius: 16px !important;
    border: 1px solid rgba(212,175,55,0.2) !important;
    box-shadow: 0 20px 80px rgba(0,0,0,0.8) !important;
}

.modal-title {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 17px !important;
    letter-spacing: 0.3px !important;
    font-weight: 700 !important;
}

/* --- Typing indicator: аккуратнее --- */
.typing-indicator {
    padding: 12px 16px !important;
}

/* --- Scrollbar: тоньше --- */
::-webkit-scrollbar {
    width: 4px !important;
}

::-webkit-scrollbar-thumb {
    background: rgba(212,175,55,0.3) !important;
    border-radius: 2px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212,175,55,0.55) !important;
}

/* --- Auth credits footer: чище --- */
.auth-credits {
    font-size: 10px !important;
    letter-spacing: 0.5px;
    border: 1px solid rgba(212,175,55,0.12) !important;
    background: rgba(255,255,255,0.02) !important;
}

/* --- Devfooter в сайдбаре --- */
.credits-footer {
    font-size: 9.5px !important;
    letter-spacing: 0.8px;
    border-top: 1px solid rgba(212,175,55,0.1) !important;
}

.dev-text {
    font-size: 9px !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase;
    font-weight: 500 !important;
}

/* --- QR login button: чище --- */
.qr-login-btn {
    border-radius: 8px !important;
    font-size: 13px !important;
    letter-spacing: 0.5px !important;
}

/* --- GitHub login button --- */
#githubLoginBtn {
    border-radius: 8px !important;
    font-size: 13px !important;
    letter-spacing: 0.3px !important;
    transition: all 0.2s ease !important;
    border-color: rgba(255,255,255,0.1) !important;
}

#githubLoginBtn:hover {
    background: #2f3640 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
}

/* --- Lang select: чище --- */
.lang-select select {
    border-radius: 8px !important;
    font-size: 12px !important;
    letter-spacing: 0.3px;
    padding: 7px 14px !important;
}

/* --- Code blocks: чище --- */
.code-block-wrapper {
    border-radius: 10px !important;
    border: 1px solid rgba(212,175,55,0.12) !important;
}

.code-header {
    border-radius: 10px 10px 0 0 !important;
}

/* --- Social buttons в сайдбаре --- */
.social-link-btn {
    border-radius: 8px !important;
    font-size: 11px !important;
    letter-spacing: 0.5px;
}

/* --- Меню toggle: чище --- */
.menu-toggle {
    border-radius: 8px !important;
    width: 40px !important;
    height: 40px !important;
}

/* --- Marketplace btn: выделить --- */
.marketplace-sidebar-btn {
    border-radius: 8px !important;
    font-size: 11px !important;
    letter-spacing: 1px !important;
}

/* --- Message box error/success --- */
.message-box {
    border-radius: 8px !important;
    font-size: 12.5px !important;
    letter-spacing: 0.2px;
}

/* --- Rate limit popup: чище --- */
.rate-limit-popup {
    border-radius: 12px !important;
    border: 1px solid rgba(212,175,55,0.2) !important;
}

/* --- User avatar border: тоньше --- */
.user-avatar {
    border: 1.5px solid rgba(212,175,55,0.6) !important;
    box-shadow: 0 0 6px rgba(212,175,55,0.2) !important;
}

/* --- AI avatar --- */
.ai-avatar {
    box-shadow: 0 0 12px rgba(212,175,55,0.3) !important;
    border-radius: 50% !important;
}

/* --- Status dot: мягче --- */
.status-dot {
    width: 7px !important;
    height: 7px !important;
    box-shadow: 0 0 4px var(--success) !important;
}

/* --- VK ID widget выравнивание --- */
#vkidContainer {
    margin-top: 4px !important;
}

/* ==================== END PROFESSIONAL REFINEMENTS ==================== */

/* ═══════════════════════════════════════════════════════════
   ETA v4 - Professional Premium Auth 2026
   Полный редизайн: фон, карточка, типографика, анимации
═══════════════════════════════════════════════════════════ */

/* ── Декоративные орбы на фоне ── */
.eta-bg-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
    opacity: 0.45;
}
.eta-orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(212,175,55,0.18) 0%, transparent 70%);
    top: -120px; left: -100px;
    animation: etaOrbFloat 12s ease-in-out infinite;
}
.eta-orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(120,60,200,0.15) 0%, transparent 70%);
    bottom: -80px; right: -80px;
    animation: etaOrbFloat 16s ease-in-out infinite reverse;
}
.eta-orb-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(212,175,55,0.1) 0%, transparent 70%);
    top: 50%; left: 60%;
    animation: etaOrbFloat 20s ease-in-out infinite;
    animation-delay: -5s;
}
@keyframes etaOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(30px, -20px) scale(1.05); }
    66%       { transform: translate(-20px, 15px) scale(0.97); }
}

/* ── Карточка ── */
.auth-card.eta-card {
    width: min(460px, 94vw);
    max-width: none;
    background: rgba(10, 9, 22, 0.92);
    backdrop-filter: blur(32px) saturate(1.4);
    -webkit-backdrop-filter: blur(32px) saturate(1.4);
    border: 1px solid rgba(212,175,55,0.22);
    border-radius: 24px;
    padding: 30px 28px 24px;
    box-shadow:
        0 0 0 1px rgba(212,175,55,0.08) inset,
        0 32px 80px rgba(0,0,0,0.8),
        0 0 60px rgba(212,175,55,0.06);
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: etaCardIn 0.45s cubic-bezier(0.22,1,0.36,1) both;
}
/* Золотая линия сверху */
.auth-card.eta-card::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(212,175,55,0.6), transparent);
}
@keyframes etaCardIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Шапка ── */
.eta-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-bottom: 20px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(212,175,55,0.1);
}

.eta-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eta-logo-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}
.eta-logo-wrap::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    background: radial-gradient(circle, rgba(212,175,55,0.5), transparent 70%);
    z-index: 0;
}
.eta-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    position: relative;
    z-index: 1;
    display: block;
}

.eta-brand-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    line-height: 1;
}
.eta-name-gold {
    background: linear-gradient(135deg, #FFD700 0%, #F59E0B 45%, #FFE566 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.eta-name-ai {
    color: rgba(255,255,255,0.45);
    -webkit-text-fill-color: rgba(255,255,255,0.45);
    font-weight: 300;
    letter-spacing: 1.5px;
}

.eta-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    -webkit-text-fill-color: #fff;
    background: none;
    letter-spacing: -0.5px;
    line-height: 1.15;
    margin: 0;
}

.eta-desc {
    font-size: 0.84rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.6;
    margin: 0;
    max-width: 320px;
}

/* ── Бегущая строка ── */
.eta-ticker-outer {
    width: calc(100% + 56px);
    margin-left: -28px;
    overflow: hidden;
    padding: 12px 0;
    border-top: 1px solid rgba(212,175,55,0.08);
    border-bottom: 1px solid rgba(212,175,55,0.08);
    margin-bottom: 20px;
    -webkit-mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
    mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
}

.eta-ticker-inner {
    display: flex;
    gap: 8px;
    width: max-content;
    animation: etaTicker 32s linear infinite;
}
.eta-ticker-outer:hover .eta-ticker-inner {
    animation-play-state: paused;
}
@keyframes etaTicker {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.eta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    background: rgba(212,175,55,0.07);
    border: 1px solid rgba(212,175,55,0.14);
    border-radius: 99px;
    font-size: 0.74rem;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    letter-spacing: 0.1px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}
.eta-chip i {
    background: linear-gradient(135deg, #FFD700, #F59E0B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 0.76rem;
}

/* ── Google CTA ── */
.eta-google-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

/* ── Разделитель ── */
.eta-divider {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.eta-divider::before,
.eta-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.07);
}
.eta-divider span {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.27);
    letter-spacing: 0.4px;
    white-space: nowrap;
}

/* ── Вторичные кнопки ── */
.eta-secondary {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.eta-sec-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 10px;
    border-radius: 14px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.12s;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.88);
    background: transparent;
}
.eta-sec-btn:active { transform: scale(0.96); }

.eta-github {
    background: rgba(22,27,34,0.9);
    border-color: rgba(255,255,255,0.12);
}
.eta-github:hover {
    background: rgba(36,41,46,0.95);
    border-color: rgba(255,255,255,0.22);
}

.eta-telegram-btn {
    background: rgba(36,161,222,0.08);
    border-color: rgba(36,161,222,0.2);
    color: rgba(36,161,222,0.9);
    -webkit-text-fill-color: rgba(36,161,222,0.9);
}
.eta-telegram-btn:hover {
    background: rgba(36,161,222,0.16);
    border-color: rgba(36,161,222,0.4);
}

.eta-qr {
    background: rgba(212,175,55,0.07);
    border-color: rgba(212,175,55,0.2);
    color: rgba(212,175,55,0.9);
    -webkit-text-fill-color: rgba(212,175,55,0.9);
}
.eta-qr:hover {
    background: rgba(212,175,55,0.13);
    border-color: rgba(212,175,55,0.38);
}

/* ── VK ── */
.eta-vkid {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

/* ── Блок доверия ── */
.eta-trust {
    width: 100%;
    background: rgba(255,255,255,0.022);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 18px;
}
.eta-trust-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.725rem;
    color: rgba(255,255,255,0.52);
    text-align: left;
}
.eta-trust-item i {
    color: #4ade80;
    font-size: 0.78rem;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

/* ── Язык ── */
.eta-lang-wrap {
    margin-top: 16px !important;
    margin-bottom: 0 !important;
}

/* ── Футер ── */
.eta-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.eta-footer-copy {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.4px;
}
.eta-footer-dev {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    color: rgba(255,255,255,0.22);
}
.eta-footer-dblogo {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    opacity: 0.45;
}
.eta-footer-kz {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.22);
}

/* ── Светлая тема: карточка входа ── */
body.luxury-light .auth-card.eta-card {
    background: rgba(255, 252, 245, 0.97);
    border-color: rgba(212, 175, 55, 0.35);
}
body.luxury-light .eta-name-ai {
    color: #8a7f68;
    -webkit-text-fill-color: #8a7f68;
}
body.luxury-light .eta-title {
    color: #2c2416;
    -webkit-text-fill-color: #2c2416;
}
body.luxury-light .eta-desc {
    color: #5e5340;
}
body.luxury-light .eta-chip {
    color: #5e5340;
    background: rgba(212,175,55,0.1);
    border-color: rgba(212,175,55,0.25);
}
body.luxury-light .eta-divider::before,
body.luxury-light .eta-divider::after {
    background: rgba(44, 36, 22, 0.15);
}
body.luxury-light .eta-divider span {
    color: #8a7f68;
}
body.luxury-light .eta-sec-btn {
    color: #2c2416;
    border-color: rgba(44, 36, 22, 0.18);
}
body.luxury-light .eta-github {
    background: rgba(22,27,34,0.9);
    color: rgba(255,255,255,0.88);
    border-color: rgba(22,27,34,0.9);
}
body.luxury-light .eta-trust {
    background: rgba(44, 36, 22, 0.03);
    border-color: rgba(44, 36, 22, 0.1);
}
body.luxury-light .eta-trust-item {
    color: #5e5340;
}
body.luxury-light .eta-footer {
    border-top-color: rgba(44, 36, 22, 0.1);
}
body.luxury-light .eta-footer-copy {
    color: #6b5f47;
}
body.luxury-light .eta-footer-dev,
body.luxury-light .eta-footer-kz {
    color: #8a7f68;
}
body.luxury-light .eta-footer-dblogo {
    opacity: 0.9;
    background: rgba(44, 36, 22, 0.08);
    border-radius: 50%;
    padding: 1px;
}

/* ── Mobile tweaks ── */
@media (max-width: 480px) {
    .auth-card.eta-card {
        width: 92vw;
        padding: 24px 18px 20px;
        border-radius: 20px;
    }
    .eta-ticker-outer {
        width: calc(100% + 36px);
        margin-left: -18px;
    }
    .eta-title { font-size: 1.7rem; }
}

/* ═══════════════════════════════════════════════
   ETA - Floating Icons Background
═══════════════════════════════════════════════ */

.eta-float-icons {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.eta-fi {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.12);
    backdrop-filter: blur(4px);
    color: rgba(212,175,55,0.45);
    font-size: 1.2rem;
    rotate: var(--r);
    animation:
        etaFiOrbit var(--dur) ease-in-out infinite var(--del),
        etaFiPulse 4s ease-in-out infinite var(--del);
    will-change: transform, opacity;
}

/* Орбитальное движение по эллипсу - у каждой своя траектория */
@keyframes etaFiOrbit {
    0%   { translate: 0px 0px;    rotate: var(--r); }
    25%  { translate: -40px -55px; rotate: calc(var(--r) + 8deg); }
    50%  { translate: 15px -90px;  rotate: calc(var(--r) - 5deg); }
    75%  { translate: 50px -40px;  rotate: calc(var(--r) + 12deg); }
    100% { translate: 0px 0px;    rotate: var(--r); }
}

@keyframes etaFiPulse {
    0%, 100% { opacity: 0.7; background: rgba(212,175,55,0.06); }
    50%       { opacity: 1;   background: rgba(212,175,55,0.11); }
}

/* Иконки слева - двигаются по другому маршруту */
.eta-fi:nth-child(odd) {
    animation-name: etaFiOrbitAlt, etaFiPulse;
}
@keyframes etaFiOrbitAlt {
    0%   { translate: 0px 0px; }
    25%  { translate: 35px -45px; }
    50%  { translate: -10px -80px; }
    75%  { translate: -45px -30px; }
    100% { translate: 0px 0px; }
}

/* На мобиле - чуть меньше */
@media (max-width: 600px) {
    .eta-fi {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
        border-radius: 10px;
    }
}

/* ========== SIDEBAR USER PROFILE CARD ========== */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 4px 8px 0;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.sidebar-user-card:hover {
    background: rgba(212,175,55,0.08);
    border-color: rgba(212,175,55,0.4);
}

.sidebar-user-card:active {
    transform: scale(0.98);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(212,175,55,0.4);
    flex-shrink: 0;
    background: #1a1a2e;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user-nick {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
}

.sidebar-user-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

.sidebar-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.6);
    flex-shrink: 0;
}

.sidebar-user-dots {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.sidebar-user-card:hover .sidebar-user-dots {
    color: var(--gold);
}

/* ========== SIDEBAR USER POPUP MENU ========== */
.sidebar-user-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 8px;
    right: 8px;
    background: #141420;
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 1000;
}

.sidebar-footer {
    position: relative;
}

.sidebar-user-menu.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 12px;
    background: rgba(212,175,55,0.05);
}

.user-menu-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(212,175,55,0.5);
    flex-shrink: 0;
    background: #1a1a2e;
}

.user-menu-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.user-menu-nick {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
}

.user-menu-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: 0.2px;
    text-align: left;
}

.user-menu-item i:first-child {
    width: 16px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 0;
}

.user-menu-item span {
    flex: 1;
}

.user-menu-arrow {
    font-size: 10px !important;
    color: var(--text-muted);
    width: auto !important;
    margin-right: 0 !important;
}

.user-menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.user-menu-item:hover .user-menu-arrow {
    color: var(--gold);
}

.user-menu-telegram {
    color: #29b6f6;
}

.user-menu-telegram:hover {
    background: rgba(0,136,204,0.1) !important;
    color: #4fc3f7 !important;
}

.user-menu-email-link {
    color: var(--gold);
}

.user-menu-email-link:hover {
    background: rgba(212,175,55,0.08) !important;
    color: var(--gold-bright) !important;
}

.user-menu-logout {
    color: #ef4444 !important;
}

.user-menu-logout:hover {
    background: rgba(239,68,68,0.1) !important;
    color: #f87171 !important;
}

/* Светлая тема */
body.luxury-light .sidebar-user-card {
    background: rgba(0,0,0,0.04);
    border-color: rgba(184,134,11,0.25);
}

body.luxury-light .sidebar-user-card:hover {
    background: rgba(184,134,11,0.07);
    border-color: rgba(184,134,11,0.4);
}

body.luxury-light .sidebar-user-nick {
    color: #2c2416;
}

body.luxury-light .sidebar-user-menu {
    background: #faf6ed;
    border-color: rgba(184,134,11,0.3);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
}

body.luxury-light .user-menu-header {
    background: rgba(184,134,11,0.06);
}

body.luxury-light .user-menu-nick {
    color: #2c2416;
}

body.luxury-light .user-menu-item {
    color: #5e5340;
}

body.luxury-light .user-menu-item:hover {
    background: rgba(0,0,0,0.04);
    color: #2c2416;
}

body.luxury-light .user-menu-divider {
    background: rgba(0,0,0,0.08);
}

/* ============================================================
   НАСТРОЙКИ — ПАНЕЛЬ (дизайн карточек-дашборда, поверх экрана)
   ============================================================ */
.settings-dashboard {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0a0a0f;
    overflow: hidden;
    isolation: isolate;
    z-index: 5000;
}

.sd-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sd-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sd-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    flex-shrink: 0;
}

.sd-close-btn:hover {
    border-color: var(--border-gold);
    color: var(--gold);
}

.sd-topbar-title {
    font-family: 'Playfair Display', serif;
    font-size: 21px;
    font-weight: 700;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sd-save-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    color: #0a0a0a;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 18px;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-gold);
    white-space: nowrap;
}

.sd-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.45);
}

.sd-save-btn.saved {
    background: linear-gradient(135deg, var(--success), #16a34a);
    color: #fff;
    box-shadow: none;
}

.sd-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 32px;
}

.sd-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    max-width: 980px;
    margin: 0 auto;
}

.sd-card {
    background: #14141f;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 20px 22px;
    transition: var(--transition);
    isolation: isolate;
}

.sd-card:hover {
    border-color: var(--border-gold);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

.sd-card--wide {
    grid-column: 1 / -1;
}

.sd-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14.5px;
    color: var(--gold);
    margin-bottom: 16px;
    letter-spacing: 0.2px;
}

.sd-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--gold);
}

.sd-card-icon i {
    font-size: 12.5px;
    line-height: 1;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* ===== FIX: иконки в круглых бейджиках/кнопках по всему приложению - центрирование ===== */
.sd-close-btn .fas,
.sd-close-btn .far,
.sd-close-btn i,
.avatar-upload-btn .fas,
.avatar-upload-btn .far,
.avatar-upload-btn i,
.magnifier-fab .fas,
.magnifier-fab .far,
.magnifier-fab i,
.pres-close .fas,
.pres-close .far,
.pres-close i {
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

.sd-profile-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sd-profile-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sd-profile-fields input {
    width: 100%;
}

.sd-wallpaper-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.sd-wallpaper-options .wallpaper-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 2px solid var(--border-subtle);
    background-color: var(--bg-primary, #0f0f18);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.sd-wallpaper-options .wallpaper-btn:hover {
    transform: scale(1.06);
}

.sd-profile-fields input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.sd-profile-fields input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.sd-wallpaper-upload {
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sd-file-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.25);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.sd-file-btn:hover {
    background: rgba(212, 175, 55, 0.16);
    border-color: var(--border-gold);
}

.sd-file-btn i {
    color: var(--gold);
}

.sd-file-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.sd-file-name {
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.sd-birthdate-content {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sd-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    transition: var(--transition);
    margin-bottom: 10px;
    text-decoration: none;
}

.sd-action-btn:last-of-type {
    margin-bottom: 0;
}

.sd-action-btn i {
    color: var(--gold);
    width: 16px;
    text-align: center;
}

.sd-action-btn:hover {
    background: rgba(212, 175, 55, 0.16);
    border-color: var(--border-gold);
    transform: translateX(2px);
}

.sd-action-btn--danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.sd-action-btn--danger i {
    color: #f87171;
}

.sd-action-btn--danger:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.45);
}

.sd-version {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 14px;
    letter-spacing: 0.3px;
}

body.luxury-light .sd-card {
    background: rgba(255, 252, 245, 0.75);
}

body.luxury-light .sd-topbar {
    border-color: rgba(212, 175, 55, 0.25);
}

body.luxury-light .settings-dashboard {
    background: #faf5eb;
}

/* Mobile: single column, tighter padding */
@media (max-width: 768px) {
    .sd-grid {
        grid-template-columns: 1fr;
    }
    .sd-scroll {
        padding: 18px 16px 28px;
    }
    .sd-topbar {
        padding: 14px 16px;
    }
    .sd-topbar-title {
        font-size: 16px;
    }
    .sd-save-btn span {
        display: none;
    }
    .sd-save-btn {
        padding: 10px 14px;
        justify-content: center;
    }
    .sd-save-btn .fas {
        margin: 0 !important;
    }
    .sd-close-btn {
        width: 36px;
        height: 36px;
    }
}


/* ==================== ELITETON AGENT: песочница ==================== */

.agent-pro-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #111;
    background: linear-gradient(135deg, var(--gold), #b8860b);
    padding: 3px 7px;
    border-radius: 6px;
}

/* Вариант бейджа для FREE-пользователей с ещё не потраченной бесплатной попыткой Agent */
.agent-pro-badge.agent-trial-badge {
    background: linear-gradient(135deg, #34d399, #059669);
    color: #06281c;
}

/* Мобильные табы Чат/Превью — скрыты по умолчанию, показываются только когда агент активен */
.agent-tabs-mobile {
    display: none;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.agent-tabs-mobile.agent-active {
    display: none; /* включаем только на мобиле, см. media query ниже */
}
.agent-tab-btn {
    flex: 1;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #9a9aa4;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.agent-tab-btn.active {
    background: linear-gradient(135deg, rgba(212,175,55,0.22), rgba(184,134,11,0.14));
    border-color: rgba(212,175,55,0.5);
    color: var(--gold);
}

/* Ряд-контейнер: по умолчанию просто обычный вертикальный layout (без изменений вне режима агента) */
.agent-workspace-row {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.agent-chat-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
}
.agent-preview-col {
    display: none; /* по умолчанию скрыт — виден только в режиме агента */
    flex-direction: column;
    min-width: 0;
    border-left: 1px solid rgba(255,255,255,0.08);
    background: #0c0c0f;
}

/* Режим агента на десктопе: 50/50 колонки */
.agent-workspace-row.agent-active {
    flex-direction: row;
}
.agent-workspace-row.agent-active .agent-chat-col {
    flex: 1 1 50%;
    max-width: 50%;
}
.agent-workspace-row.agent-active .agent-preview-col {
    display: flex;
    flex: 1 1 50%;
    max-width: 50%;
}

.agent-preview-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}
.agent-toolbar-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.05);
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.agent-toolbar-btn:hover { background: rgba(255,255,255,0.1); }
.agent-toolbar-btn--gold {
    width: auto;
    padding: 0 12px;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #111;
    background: linear-gradient(135deg, var(--gold), #b8860b);
    border: none;
}

.agent-compile-status {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 5px 10px;
    border-radius: 8px;
    text-transform: uppercase;
    flex-shrink: 0;
}
.agent-compile-idle       { background: rgba(255,255,255,0.06); color: #8a8a96; }
.agent-compile-compiling  { background: rgba(212,175,55,0.15); color: var(--gold); }
.agent-compile-ready      { background: rgba(34,197,94,0.15);  color: #4ade80; }
.agent-compile-error      { background: rgba(239,68,68,0.15);  color: #f87171; }

.agent-file-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.agent-file-badge {
    font-size: 10.5px;
    color: #b8b8c0;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 3px 8px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.agent-preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

/* Мобильная адаптация: табы вместо колонок, чтобы экран не сжимался */
@media (max-width: 768px) {
    .agent-tabs-mobile.agent-active {
        display: flex;
    }
    .agent-workspace-row.agent-active {
        flex-direction: column;
        position: relative;
    }
    .agent-workspace-row.agent-active .agent-chat-col,
    .agent-workspace-row.agent-active .agent-preview-col {
        max-width: 100%;
        display: none;
    }
    .agent-workspace-row.agent-active .agent-pane-active {
        display: flex;
        flex: 1;
    }
}
