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

:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B83FF;
    --bg: #F4F7FC;
    --white: #FFFFFF;
    --text: #1A1A2E;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --online: #22C55E;
    --offline: #EF4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
}

input, textarea {
    font-family: inherit;
    outline: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s;
}

input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 500;
    transition: all 0.2s;
}
.btn-outline:hover {
    background: var(--bg);
    border-color: var(--text-light);
}

.btn-icon {
    background: transparent;
    color: var(--text-light);
    padding: 8px;
    border-radius: 8px;
    font-size: 20px;
    transition: all 0.2s;
    line-height: 1;
}
.btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-send {
    background: var(--primary);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 20px;
    transition: all 0.2s;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.error-message {
    color: var(--offline);
    font-size: 14px;
    margin-top: 8px;
    padding: 8px;
    border-radius: 6px;
    background: #FEE2E2;
    display: none;
}

.loading {
    text-align: center;
    color: var(--text-light);
    padding: 40px 0;
    font-size: 14px;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 480px;
    width: 90%;
    padding: 24px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalFadeIn 0.25s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 8px;
}
.modal-close:hover {
    color: var(--text);
}

.modal-body .form-group {
    margin-bottom: 16px;
}
.modal-body label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text);
}
.modal-body input,
.modal-body select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
}
.modal-body input:focus,
.modal-body select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background: #e8ecf0;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: 0.15s;
    color: var(--text);
}
.menu-item:hover {
    background: var(--bg);
}

/* Подсветка ошибок */
.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Текст ошибки под полем */
.error-text {
    color: #ef4444;
    font-size: 13px;
    margin-top: 4px;
    display: block;
}

.field-error {
    margin-bottom: 0;
}
.field-error input {
    border-color: #ef4444;
}
.field-error .error-text {
    display: block;
}

.chat-list,
.chat-messages {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}

.chat-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 8px;
}

.chat-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.chat-layout {
    overflow: hidden;
}

.chat-sidebar,
.chat-window {
    min-height: 0;
}

.chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}