/**
 * ============================================
 * ЦИФРОВОЙ-ЮРИСТ — СТИЛИ (v3.9.12 PRO)
 * ============================================
 */

/* ============================================
   БАЗОВЫЕ СТИЛИ
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --base-font-size: 15px;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #333333;
    --text-muted: #666666;
    --border: #e0e0e0;
    --primary: #28a745;
    --primary-hover: #20c997;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #667eea;
    --gradient-primary: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --gradient-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50%;
}

body.dark-mode {
    --bg: #1a1a2e;
    --card: #16213e;
    --text: #ffffff;
    --text-muted: #aaaaaa;
    --border: #333344;
}

.font-small { --base-font-size: 13px; }
.font-medium { --base-font-size: 15px; }
.font-large { --base-font-size: 18px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--base-font-size);
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   АНИМАЦИИ
============================================ */
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes messageSlide { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes recordPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* ============================================
   ВЕРХНЯЯ ПАНЕЛЬ
============================================ */
.top-bar {
    background: var(--gradient-primary);
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: slideDown 0.5s ease;
    flex-shrink: 0;
    height: 55px;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: var(--radius-full);
    background: var(--gradient-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: transform 0.3s;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar:hover {
    transform: scale(1.1);
}

.user-details {
    font-size: 0.8rem;
    min-width: 0;
}

.user-email {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-id {
    opacity: 0.8;
    font-size: 0.7rem;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.top-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.auth-btn, .logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 6px 16px;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.auth-btn:hover, .logout-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* ============================================
   БОКОВОЕ МЕНЮ
============================================ */
.sidebar {
    width: 260px;
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 80px 0 20px 0;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0);
}

.menu-search {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.menu-search input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 25px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.menu-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 0.95rem;
}

.menu-item:hover {
    background: rgba(0,0,0,0.05);
    color: var(--primary);
}

.menu-item.active {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    color: #333;
    font-weight: 600;
    border-left: 4px solid #ffc107;
}

.menu-icon {
    font-size: 1.3rem;
    width: 24px;
    text-align: center;
}

.badge-new {
    margin-left: auto;
    background: #ffc107;
    color: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* ============================================
   РЕЖИМЫ
============================================ */
.mode-tabs {
    padding: 10px 15px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    animation: fadeIn 0.7s ease;
    flex-shrink: 0;
}

.mode-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.mode-btn.active {
    color: white;
}

.mode-btn.fast {
    background: var(--gradient-primary);
}

.mode-btn.smart {
    background: linear-gradient(135deg, #e91e63 0%, #f06292 100%);
}

.mode-btn.mega {
    background: linear-gradient(135deg, #9c27b0 0%, #ba68c8 100%);
}

.mode-btn.contract {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mode-btn.statement {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

/* ============================================
   ОСНОВНАЯ ОБЛАСТЬ
============================================ */
.main-wrapper {
    display: flex;
    flex: 1;
    height: calc(100vh - 95px);
    overflow: hidden;
    position: relative;
}

/* ============================================
   ЧАТ
============================================ */
.chat-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 20px 20px 100px;
    overflow-y: auto;
    background: var(--bg);
}

.chat-wrapper {
    width: 100%;
    max-width: 900px;
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 85vh;
    animation: scaleIn 0.5s ease;
    position: relative;
    top: 0;
}

.chat-header {
    background: var(--gradient-purple);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    flex-shrink: 0;
}

.chat-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.chat-status {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg);
    scroll-behavior: smooth;
}

.welcome-box {
    background: rgba(0,0,0,0.03);
    padding: 25px;
    border-radius: var(--radius-md);
    animation: slideUp 0.5s ease;
}

.dark-mode .welcome-box {
    background: rgba(255,255,255,0.05);
}

.welcome-box h3 {
    margin-bottom: 15px;
    color: var(--text);
    font-size: 1.1rem;
}

.welcome-box ul {
    margin: 15px 0;
    padding-left: 25px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.welcome-box li {
    margin: 8px 0;
    line-height: 1.5;
}

.welcome-box p {
    color: var(--text-muted);
    margin-top: 15px;
    font-size: 0.9rem;
}

.message {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    max-width: 80%;
    animation: messageSlide 0.4s ease;
    word-wrap: break-word;
    font-size: 0.95rem;
}

.message.user {
    background: var(--gradient-purple);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.message.bot {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    margin-right: auto;
    line-height: 1.6;
    border-bottom-left-radius: 5px;
}

.message.bot p {
    margin: 8px 0;
}

.message.bot strong {
    color: var(--text);
    font-weight: 700;
}

/* ============================================
   ПОЛЕ ВВОДА
============================================ */
.chat-input-wrapper {
    padding: 15px 20px;
    background: var(--card);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    flex-shrink: 0;
    position: relative;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 25px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: all 0.3s;
    background: var(--card);
    color: var(--text);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(40,167,69,0.1);
}

.send-btn {
    width: 45px;
    height: 45px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: scale(1.1);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.voice-btn {
    width: 45px;
    height: 45px;
    background: none;
    border: 2px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-btn:hover {
    border-color: var(--primary);
    background: rgba(40,167,69,0.1);
}

.voice-btn.recording {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    animation: recordPulse 1s infinite;
}

.recording-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #856404;
    margin-bottom: 10px;
    animation: fadeIn 0.3s;
}

.recording-indicator.active {
    display: flex;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: #dc3545;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.icon-btn {
    width: 32px;
    height: 32px;
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    line-height: 1;
}

.icon-btn:hover {
    border-color: var(--primary);
    background: rgba(40,167,69,0.1);
    transform: scale(1.1);
}

/* ============================================
   СПИСОК ЧАТОВ
============================================ */
.chat-list-panel {
    width: 320px;
    background: var(--card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 90;
}

.chat-list-header {
    padding: 15px 20px;
    background: var(--gradient-purple);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-list-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.new-chat-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.chat-list-search {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-list-search input {
    width: 100%;
    padding: 9px 14px;
    border: 2px solid var(--border);
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.chat-list-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.chat-item:hover {
    background: rgba(0,0,0,0.05);
}

.dark-mode .chat-item:hover {
    background: rgba(255,255,255,0.05);
}

.chat-item.active {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border-left: 4px solid #ffc107;
}

.chat-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.chat-item-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.chat-item-meta {
    text-align: right;
    flex-shrink: 0;
    margin-left: 6px;
}

.chat-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.chat-item-unread {
    background: var(--danger);
    color: white;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.chat-item-pinned {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid var(--info);
    border-radius: 10px;
    margin-bottom: 10px;
    position: relative;
}

.chat-item-pinned::before {
    content: '📌';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.chat-item-pinned:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
}

/* ============================================
   СТАТУС
============================================ */
.status-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 1000;
    transition: all 0.3s;
}

.status-online {
    background: #4caf50;
    color: white;
}

.status-offline {
    background: var(--danger);
    color: white;
}

.status-loading {
    background: var(--warning);
    color: #333;
}

/* ============================================
   УВЕДОМЛЕНИЯ
============================================ */
.notification-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    background: var(--card);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideInRight 0.4s ease;
    border-left: 4px solid var(--primary);
    pointer-events: auto;
    font-size: 0.9rem;
}

.notification.success {
    border-left-color: var(--primary);
}

.notification.error {
    border-left-color: var(--danger);
}

.notification.warning {
    border-left-color: var(--warning);
}

.notification.info {
    border-left-color: var(--info);
}

.notification-icon {
    font-size: 1.3rem;
}

.notification-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text);
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all 0.2s;
}

.notification-close:hover {
    background: rgba(0,0,0,0.1);
    color: var(--text);
}

/* ============================================
   МОДАЛЬНЫЕ ОКНА
============================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: var(--gradient-purple);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* ============================================
   НАСТРОЙКИ
============================================ */
.modal.settings-modal .modal-dialog {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: white;
}

.modal.settings-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal.settings-modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal.settings-modal .modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal.settings-modal .modal-close:hover {
    background: rgba(255,255,255,0.3);
}

.modal.settings-modal .modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.settings-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.settings-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 12px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    border: 3px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar span {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
}

.profile-info {
    flex: 1;
}

.user-id {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.btn-avatar {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-avatar:hover {
    background: #5568d3;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    flex: 1;
}

.setting-label span {
    font-size: 15px;
    color: #333;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

.setting-label small {
    font-size: 12px;
    color: #999;
}

.setting-row select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 140px;
}

.setting-row select:focus {
    outline: none;
    border-color: #667eea;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #28a745;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102,126,234,0.3);
}

.btn-save {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 8px;
}

body.dark-mode .modal.settings-modal .modal-dialog {
    background: #1e1e1e;
}

body.dark-mode .modal.settings-modal .modal-body {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark-mode .profile-header {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
}

body.dark-mode .profile-avatar {
    background: #2a2a2a;
}

body.dark-mode .setting-row {
    border-bottom-color: #333;
}

body.dark-mode .setting-label span {
    color: #e0e0e0;
}

body.dark-mode .setting-row select {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #444;
}

/* ============================================
   ПРОВЕРКА ДОГОВОРА
============================================ */
/* Компактный вывод проверки договоров */
/* ============================================
   AI-ЮРИСТ — Улучшенные стили (Modern UI)
   ============================================ */

.contract-review-doc {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px;
    max-width: 900px;
    margin: 20px auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    color: #334155;
    line-height: 1.6;
}

/* Заголовок */
.doc-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 16px 0;
    letter-spacing: -0.5px;
}

/* Мета-информация */
.doc-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.doc-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Сводка */
.doc-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 12px;
    flex-wrap: wrap;
}

/* Бейдж вердикта */
.summary-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.summary-stats {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* Разделы */
.doc-section {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 28px 0 16px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

/* Проблемы */
.doc-item {
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.doc-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.item-line {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.item-marker {
    color: #ef4444;
    font-weight: bold;
    font-size: 16px;
    margin-top: 2px;
    min-width: 20px;
}

.item-text {
    font-weight: 700;
    color: #1e293b;
    font-size: 15px;
}

.item-desc {
    color: #64748b;
    font-size: 14px;
    margin-left: 32px;
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Рекомендации */
.item-rec {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 32px;
    border-left: 4px solid #22c55e;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
}

/* Вердикт */
.doc-verdict.danger {
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
    border: 2px solid #f43f5e;
    border-radius: 12px;
    padding: 20px;
    margin-top: 28px;
    color: #9f1239;
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.15);
}

.verdict-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.verdict-marker {
    font-size: 20px;
}

.verdict-title {
    font-weight: 800;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verdict-desc {
    font-size: 14px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.verdict-rec {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px dashed #fda4af;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Адаптивность */
@media (max-width: 600px) {
    .contract-review-doc {
        padding: 20px;
        margin: 10px;
    }
    
    .doc-title {
        font-size: 18px;
    }
    
    .doc-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .item-desc,
    .item-rec {
        margin-left: 0;
    }
    
    .item-line {
        flex-direction: column;
        gap: 6px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contract-review-doc {
    animation: fadeIn 0.5s ease-out;
}

.doc-item {
    animation: fadeIn 0.3s ease-out backwards;
}

.doc-item:nth-child(1) { animation-delay: 0.1s; }
.doc-item:nth-child(2) { animation-delay: 0.2s; }
.doc-item:nth-child(3) { animation-delay: 0.3s; }
/* ============================================
   COOKIE BANNER
============================================ */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 3px solid var(--primary);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    padding: 20px;
    z-index: 10000;
    display: none;
    animation: slideUp 0.3s ease;
}

.cookie-banner.active {
    display: block;
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-banner-text {
    flex: 1;
    min-width: 300px;
}

.cookie-banner-text h3 {
    margin-bottom: 10px;
    color: var(--text);
    font-size: 1.1rem;
}

.cookie-banner-text p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.cookie-banner-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.cookie-btn.accept {
    background: var(--primary);
    color: white;
}

.cookie-btn.accept:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.cookie-btn.decline {
    background: var(--border);
    color: var(--text);
}

.cookie-btn.decline:hover {
    background: #d0d0d0;
}

/* ============================================
   EMOJI PANEL
============================================ */
.emoji-panel {
    position: fixed;
    bottom: 80px;
    left: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: none;
    flex-direction: column;
    width: 320px;
    max-height: 400px;
    animation: popIn 0.3s ease;
}

.emoji-panel.active {
    display: flex;
}

.emoji-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

.emoji-search {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
}

.emoji-search:focus {
    outline: none;
    border-color: var(--primary);
}

.emoji-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.emoji-section {
    margin-bottom: 20px;
}

.emoji-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
}

.emoji-item {
    font-size: 1.5rem;
    padding: 5px;
    text-align: center;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background: rgba(0,0,0,0.05);
    transform: scale(1.2);
}

.emoji-categories {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    border-top: 1px solid var(--border);
    overflow-x: auto;
}

.emoji-category {
    padding: 6px 12px;
    border-radius: 15px;
    background: var(--bg);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.emoji-category:hover {
    background: rgba(0,0,0,0.1);
}

.emoji-category.active {
    background: var(--primary);
    color: white;
}

.emoji-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1999;
    display: none;
}

.emoji-overlay.active {
    display: block;
}

/* ============================================
   📱 ПОЛНАЯ МОБИЛЬНАЯ ОПТИМИЗАЦИЯ
   ============================================ */

@media (max-width: 768px) {
    /* ВЕРХНЯЯ ПАНЕЛЬ */
    .top-bar {
        height: 45px !important;
        padding: 5px 8px !important;
        position: sticky !important;
    }
    
    .menu-toggle {
        width: 32px !important;
        height: 32px !important;
        font-size: 1.2rem !important;
        margin-right: 5px !important;
    }
    
    .app-title {
        font-size: 0.85rem !important;
    }
    
    .user-avatar {
        width: 28px !important;
        height: 28px !important;
    }
    
    .user-email,
    .user-id {
        display: none !important;
    }
    
    .auth-btn, .logout-btn {
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
    }
    
    /* КНОПКИ РЕЖИМОВ — ОДНА СТРОКА= */
    .mode-tabs {
        padding: 4px 4px !important;
        gap: 3px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        height: 40px !important;
        flex-shrink: 0 !important;
        margin-bottom: 0 !important;
    }
    
    .mode-btn {
        flex: 1 !important;
        min-width: 20% !important;
        padding: 6px 3px !important;
        font-size: 0.62rem !important;
        white-space: nowrap !important;
        height: 34px !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /*  ОСНОВНАЯ ОБЛАСТЬ */
    .main-wrapper {
        height: calc(100vh - 85px) !important;
        overflow: hidden !important;
    }
    
    /* Поднять чат выше
    0 мало 1 мало 2 мало попробовать на 5 */
    .chat-area {
        padding: 3px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .chat-wrapper {
        height: 100% !important;
        max-height: none !important;
        border-radius: 6px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .chat-header {
        padding: 6px 10px !important;
        min-height: 38px !important;
        flex-shrink: 0 !important;
    }
    
    .chat-title {
        font-size: 0.85rem !important;
    }
    
    .chat-status {
        font-size: 0.65rem !important;
    }
    
    /* СООБЩЕНИЯ  */
    .chat-messages {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        padding: 6px !important;
        min-height: 0 !important;
    }
    
    .welcome-box {
        padding: 8px !important;
        font-size: 0.8rem !important;
    }
    
    .welcome-box h3 {
        font-size: 0.85rem !important;
        margin-bottom: 6px !important;
    }
    
    .welcome-box ul {
        margin: 6px 0 !important;
        padding-left: 16px !important;
        font-size: 0.75rem !important;
    }
    
    .welcome-box li {
        margin: 3px 0 !important;
    }
    
    .message {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
        margin: 4px 0 !important;
        max-width: 85% !important;
    }
    
    /* ========== ПОЛЕ ВВОДА (сделать меньше его нет) */
    .chat-input-wrapper {
        padding: 6px 8px !important;
        flex-shrink: 0 !important;
    }
    
    .chat-input-container {
        gap: 5px !important;
    }
    
    .chat-input {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
        min-height: 32px !important;
        max-height: 60px !important;
    }
    
    .send-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
    }
    
    .voice-btn, .icon-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.85rem !important;
    }
    
    /*БОКОВОЕ МЕНЮ  */
    .sidebar {
        width: 260px !important;
        transform: translateX(-100%) !important;
        z-index: 1000 !important;
        transition: transform 0.3s ease !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    .menu-search {
        padding: 10px 15px !important;
    }
    
    .menu-search input {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .menu-item {
        padding: 10px 15px !important;
        font-size: 0.9rem !important;
    }
    
    .menu-icon {
        font-size: 1.1rem !important;
    }
    
    /* СПИСОК ЧАТОВ  */
    .chat-list-panel {
        width: 100% !important;
        position: fixed !important;
        top: 85px !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 999 !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease !important;
    }
    
    .chat-list-panel.active {
        transform: translateX(0) !important;
    }
    
    .chat-list-header {
        padding: 10px 15px !important;
        min-height: 40px !important;
    }
    
    .chat-list-search {
        padding: 8px 12px !important;
    }
    
    .chat-list-search input {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
    }
    
    .chat-item {
        padding: 8px 10px !important;
    }
    
    .chat-item-avatar {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }
    
    .chat-item-name {
        font-size: 0.85rem !important;
    }
    
    .chat-item-message {
        font-size: 0.75rem !important;
    }
    
    /* ========== УВЕДОМЛЕНИЯ ========== */
    .notification {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
    }
    
    .notification-container {
        top: 50px !important;
        right: 10px !important;
        left: 10px !important;
    }
    
    /* ========== МОДАЛЬНЫЕ ОКНА ========== */
    .modal-content {
        margin: 10px !important;
        max-height: calc(100vh - 20px) !important;
        width: calc(100% - 20px) !important;
    }
    
    .modal-header {
        padding: 12px 15px !important;
    }
    
    .modal-body {
        padding: 15px !important;
    }
}

/* ============================================
   📱 ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 480px)
   ============================================ */

@media (max-width: 480px) {
    .mode-btn {
        font-size: 0.6rem !important;
        height: 32px !important;
        padding: 5px 2px !important;
    }
    
    .mode-tabs {
        height: 38px !important;
        padding: 3px 3px !important;
        gap: 2px !important;
    }
    
    .main-wrapper {
        height: calc(100vh - 83px) !important;
    }
    
    .chat-input {
        min-height: 30px !important;
        padding: 5px 8px !important;
    }
    
    .send-btn {
        width: 30px !important;
        height: 30px !important;
    }
    
    .voice-btn, .icon-btn {
        width: 26px !important;
        height: 26px !important;
    }
    
    .message {
        padding: 5px 8px !important;
        font-size: 0.75rem !important;
    }
    
    .welcome-box {
        padding: 6px !important;
    }
}

/* ============================================
   📱 IPHONE С NOTCH (Safe Area)
   ============================================ */
/*поднять чат вверх */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .top-bar {
            padding-left: max(5px, env(safe-area-inset-left)) !important;
            padding-right: max(5px, env(safe-area-inset-right)) !important;
        }
        
        .chat-input-wrapper {
            padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
        }
        
        .mode-tabs {
            padding-left: max(4px, env(safe-area-inset-left)) !important;
            padding-right: max(4px, env(safe-area-inset-right)) !important;
        }
    }
}