* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at 12% 18%, rgba(123, 75, 58, 0.18), transparent 22%),
        radial-gradient(circle at 84% 22%, rgba(217, 194, 172, 0.35), transparent 20%),
        radial-gradient(circle at 72% 78%, rgba(141, 103, 77, 0.18), transparent 24%),
        linear-gradient(135deg, #e8d8c5 0%, #efe4d7 48%, #e3d1be 100%);
    color: #2f241f;
    min-height: 100vh;
}

.page {
    width: min(calc(100vw - 150px), 2450px);
    max-width: 2450px;
    min-width: 0;
    margin: 16px auto;
}

.main-card {
    background: #f7efe4;
    border: 1px solid #cdbca9;
    border-radius: 14px;
    padding: 20px;
    min-height: 94vh;
}

.title {
    margin: 0 0 18px;
    font-size: 30px;
    color: #3f2f2a;
    text-align: center;
}

.forms {
    display: flex;
    gap: 24px;
}

.welcome-layout {
    display: block;
    min-height: calc(94vh - 120px);
}

.welcome-card {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    background:
        linear-gradient(135deg, rgba(255, 248, 240, 0.94), rgba(247, 236, 224, 0.92)),
        repeating-linear-gradient(
            135deg,
            rgba(123, 75, 58, 0.035) 0,
            rgba(123, 75, 58, 0.035) 10px,
            rgba(255, 255, 255, 0.02) 10px,
            rgba(255, 255, 255, 0.02) 20px
        );
    border: 1px solid #d6c1ad;
    border-radius: 22px;
    padding: 44px;
    box-shadow: 0 30px 80px rgba(74, 49, 37, 0.14);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    right: -100px;
    top: -110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(123, 75, 58, 0.18), rgba(123, 75, 58, 0));
}

.welcome-card::after {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    left: -90px;
    bottom: -110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(205, 177, 151, 0.26), rgba(205, 177, 151, 0));
}

.welcome-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: #7b4b3a;
    color: #fff8f1;
    font-size: 14px;
    margin-bottom: 18px;
}

.welcome-title {
    margin: 0 0 18px;
    font-size: 50px;
    line-height: 1.15;
    color: #3f2f2a;
    max-width: 980px;
}

.welcome-text {
    margin: 0 0 22px;
    font-size: 22px;
    line-height: 1.55;
    color: #4e3d34;
    max-width: 1060px;
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.welcome-feature {
    background: #fffaf2;
    border: 1px solid #dbc7b4;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    line-height: 1.4;
}

.welcome-actions-inline {
    position: relative;
    z-index: 1;
}

.welcome-actions-text {
    margin: 0 0 18px;
    font-size: 18px;
    line-height: 1.5;
    color: #4e3d34;
    max-width: 980px;
}

.welcome-buttons {
    display: flex;
    gap: 16px;
    width: 540px;
    max-width: 100%;
}

.welcome-action-button {
    display: block;
    width: 100%;
    height: 52px;
    line-height: 52px;
    text-align: center;
    border-radius: 10px;
    background: #7b4b3a;
    color: #fffaf5;
    text-decoration: none;
    font-size: 17px;
}

.welcome-action-button:hover {
    background: #6a3f30;
}

.secondary-action-button {
    background: #d9c2ac;
    color: #3f2f2a;
}

.secondary-action-button:hover {
    background: #cdb197;
}

.form-card {
    width: 50%;
    background: #fff8f0;
    border: 1px solid #d8c7b6;
    border-radius: 12px;
    padding: 18px;
}

.form-card h2 {
    margin: 0 0 14px;
    font-size: 23px;
    color: #4f3f37;
}

label {
    display: block;
    margin: 10px 0 6px;
    font-size: 14px;
}

input {
    width: 100%;
    height: 44px;
    border: 1px solid #bfa994;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 15px;
    background: #fffefc;
    color: #2f241f;
}

textarea {
    width: 100%;
    border: 1px solid #bfa994;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fffefc;
    color: #2f241f;
    resize: none;
    min-height: 72px;
    font-family: Arial, sans-serif;
}

select {
    width: 100%;
    height: 44px;
    border: 1px solid #bfa994;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 15px;
    background: #fffefc;
    color: #2f241f;
}

.custom-native-select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    margin-top: 0;
    width: 100%;
    min-height: 44px;
    height: auto;
    padding: 11px 42px 11px 12px;
    border: 1px solid #bfa994;
    border-radius: 8px;
    background: #fffefc;
    color: #2f241f;
    text-align: left;
    font-size: 15px;
    position: relative;
}

.custom-select-trigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-70%) rotate(45deg);
}

.custom-select.open .custom-select-trigger::after {
    transform: translateY(-20%) rotate(-135deg);
}

.custom-select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    display: none;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #d8c7b6;
    border-radius: 10px;
    background: #fff8f0;
    box-shadow: 0 18px 40px rgba(47, 36, 31, 0.16);
    z-index: 20;
    padding: 6px;
}

.custom-select.open .custom-select-menu {
    display: block;
}

.custom-select-option {
    margin-top: 0;
    width: 100%;
    min-height: 38px;
    height: auto;
    padding: 8px 10px;
    border-radius: 8px;
    background: transparent;
    color: #2f241f;
    text-align: left;
    font-size: 14px;
}

.custom-select-option:hover,
.custom-select-option.selected {
    background: #efe1d3;
}

.custom-select.disabled .custom-select-trigger {
    opacity: 0.65;
    cursor: default;
}

button {
    margin-top: 14px;
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: #7b4b3a;
    color: #fffaf5;
    font-size: 16px;
    cursor: pointer;
}

button:hover {
    background: #6a3f30;
}

.error {
    margin: 0 0 10px;
    color: #a23525;
    font-size: 14px;
}

.ok {
    margin: 0 0 10px;
    color: #1f6a42;
    font-size: 14px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.top-user {
    font-size: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.tag {
    color: #6b5950;
}

.current-avatar-link {
    display: inline-flex;
    text-decoration: none;
}

.current-user-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #cdb197;
    background: #fffefc;
}

.logout {
    color: #7b4b3a;
    text-decoration: none;
    font-size: 15px;
}

.logout:hover {
    text-decoration: underline;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.top-link {
    color: #7b4b3a;
    text-decoration: none;
    font-size: 15px;
}

.top-link:hover {
    text-decoration: underline;
}

.messenger {
    display: flex;
    gap: 14px;
    height: calc(94vh - 95px);
}

.left-panel,
.center-panel {
    background: #fff8f0;
    border: 1px solid #d8c7b6;
    border-radius: 12px;
    padding: 14px;
}

.left-panel {
    width: 520px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.left-panel h3,
.profile-info-card h2,
.profile-form-card h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #4f3f37;
}

.panel-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.panel-action-button {
    margin-top: 0;
    height: 42px;
    font-size: 14px;
}

.secondary-panel-button {
    background: #d9c2ac;
    color: #3f2f2a;
}

.secondary-panel-button:hover {
    background: #cdb197;
}

.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.search-form input {
    height: 40px;
}

.search-form button {
    width: 110px;
    margin-top: 0;
    height: 40px;
    font-size: 14px;
}

.search-result {
    min-height: 70px;
    border: 1px solid #ddccbb;
    border-radius: 10px;
    background: #fffefc;
    padding: 10px;
    margin-bottom: 14px;
}

.group-create-form {
    margin-bottom: 14px;
}

.group-create-form input {
    height: 40px;
    margin-bottom: 8px;
}

.group-create-form textarea {
    margin-bottom: 8px;
}

.group-create-form button {
    margin-top: 0;
    height: 40px;
    font-size: 14px;
}

.search-user {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.search-name {
    font-weight: 700;
}

.search-user-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 6px;
    background: #fffefc;
}

.search-tag {
    color: #6e5a50;
    margin-bottom: 6px;
}

.search-user button {
    margin-top: 0;
    width: 140px;
    height: 36px;
    font-size: 14px;
}

.chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid #ddccbb;
    border-radius: 10px;
    padding: 8px;
    background: #fffefc;
}

.chat-item {
    width: 100%;
    text-align: left;
    margin-top: 0;
    margin-bottom: 8px;
    height: auto;
    padding: 10px 12px;
    background: #efe1d3;
    color: #2f241f;
}

.chat-item:last-child {
    margin-bottom: 0;
}

.chat-item.active {
    background: #d7b99f;
}

.chat-item-name {
    font-weight: 700;
}

.chat-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-item-texts {
    min-width: 0;
}

.chat-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: #fffefc;
}

.chat-item-group-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #7b4b3a;
    color: #fff8f1;
    font-weight: 700;
    font-size: 18px;
}

.chat-item-tag {
    font-size: 13px;
    color: #5d4c42;
    margin-top: 4px;
}

.chat-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: #7b4b3a;
    color: #fffaf5;
    font-size: 13px;
    font-weight: 700;
    margin-top: 8px;
}

.active-chat-title {
    font-size: 18px;
    font-weight: 700;
    color: #3f2f2a;
    text-decoration: none;
    text-align: center;
}

.active-chat-title:hover {
    text-decoration: underline;
}

.active-chat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.active-chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.active-chat-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    background: #fffefc;
}

.active-chat-group-badge {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #7b4b3a;
    color: #fff8f1;
    font-size: 20px;
    font-weight: 700;
}

.disabled-chat-title,
.disabled-chat-title:hover {
    color: #6e5a50;
    text-decoration: none;
    cursor: default;
}

.leave-chat-button {
    width: 150px;
    height: 40px;
    margin-top: 0;
    font-size: 14px;
    background: #d9c2ac;
    color: #3f2f2a;
}

.leave-chat-button:hover {
    background: #cdb197;
}

.hidden {
    display: none;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #c9b7a4;
    border-radius: 10px;
    background: #fffaf2;
    padding: 12px;
}

.chat-workspace {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-workspace.hidden {
    display: none;
}

.empty-chat-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.empty-chat-state.hidden {
    display: none;
}

.empty-chat-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #3f2f2a;
}

.empty-chat-text {
    max-width: 760px;
    font-size: 18px;
    line-height: 1.5;
    color: #5d4c42;
}

.message-row {
    border-bottom: 1px solid #e2d4c5;
    padding: 10px 0;
    transition: background 0.25s ease;
}

.message-row.own-message {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-row-highlight {
    background: rgba(123, 75, 58, 0.12);
}

.message-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.message-row.own-message .message-head {
    justify-content: flex-end;
}

.message-author-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #fffefc;
}

.message-row:last-child {
    border-bottom: 0;
}

.message-author {
    font-weight: 700;
    color: #3f2f2a;
    margin-bottom: 4px;
}

.message-row.own-message .message-author,
.message-row.own-message .message-time {
    text-align: right;
}

.message-row.own-message .message-text,
.message-row.own-message .message-parent,
.message-row.own-message .message-parent-text {
    text-align: left;
}

.message-text {
    font-size: 15px;
    line-height: 1.35;
    margin-bottom: 5px;
    word-break: break-word;
    max-width: 82%;
}

.message-parent {
    display: block;
    width: min(100%, 82%);
    height: auto;
    margin-top: 0;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-left: 4px solid #7b4b3a;
    border-radius: 8px;
    background: #f0e3d6;
    color: #2f241f;
    text-align: left;
}

.message-parent:hover {
    background: #e6d6c7;
}

.message-parent-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.message-parent-text {
    font-size: 14px;
    line-height: 1.35;
    color: #5d4c42;
    word-break: break-word;
}

.message-time {
    font-size: 12px;
    color: #7f6b61;
    max-width: 82%;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 82%;
}

.message-row.own-message .message-meta {
    justify-content: flex-end;
}

.message-read-status {
    font-size: 12px;
    color: #6e5a50;
}

.message-read-status-button {
    margin-top: 0;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    color: #7b4b3a;
    text-decoration: underline;
    border-radius: 0;
}

.message-read-status-button:hover {
    background: transparent;
    color: #6a3f30;
}

.message-image {
    display: block;
    max-width: 420px;
    max-height: 420px;
    border-radius: 12px;
    margin: 8px 0;
    object-fit: cover;
    border: 1px solid #d8c7b6;
    cursor: zoom-in;
}

.message-form {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    align-items: center;
}

.message-form input {
    height: 48px;
}

.message-form button {
    margin-top: 0;
    height: 48px;
}

.message-image-button {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.icon-button {
    width: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.message-send-button {
    flex-shrink: 0;
}

.message-delete-button {
    margin-top: 0;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    color: #a23525;
    text-decoration: underline;
    border-radius: 0;
    font-size: 12px;
}

.message-delete-button:hover {
    background: transparent;
    color: #8f2d20;
}

.message-image-status {
    margin-top: 8px;
    font-size: 14px;
    color: #6e5a50;
}

.message-image-preview-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 8px;
}

.reply-preview {
    margin-top: 12px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-left: 4px solid #7b4b3a;
    border-radius: 8px;
    background: #f0e3d6;
}

.reply-preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.reply-preview-title {
    font-size: 13px;
    font-weight: 700;
    color: #3f2f2a;
}

.reply-preview-text {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.35;
    color: #5d4c42;
    word-break: break-word;
}

.reply-preview-close {
    width: 36px;
    height: 36px;
    margin-top: 0;
    flex-shrink: 0;
    border-radius: 50%;
    background: #d9c2ac;
    color: #3f2f2a;
    font-size: 22px;
    line-height: 1;
}

.reply-preview-close:hover {
    background: #cdb197;
}

.message-image-preview {
    max-width: 220px;
    max-height: 220px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #d8c7b6;
}

.clear-image-button {
    width: 110px;
    height: 40px;
    margin-top: 0;
    background: #d9c2ac;
    color: #3f2f2a;
}

.clear-image-button:hover {
    background: #cdb197;
}

.profile-form input {
    margin-bottom: 8px;
}

.group-manage-block {
    margin-top: 14px;
    border-top: 1px solid #d8c7b6;
    padding-top: 12px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(47, 36, 31, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.image-viewer-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(20, 16, 14, 0.88);
    z-index: 1200;
    cursor: zoom-out;
}

.image-viewer-overlay.hidden {
    display: none;
}

.image-viewer-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.42);
}

.modal-card {
    width: 760px;
    max-width: 100%;
    background: #f7efe4;
    border: 1px solid #cdbca9;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 24px 70px rgba(47, 36, 31, 0.24);
}

.modal-overlay.hidden {
    display: none;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.modal-head h3 {
    margin: 0;
    font-size: 24px;
    color: #3f2f2a;
}

.modal-close-button {
    width: 42px;
    height: 42px;
    margin-top: 0;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
}

.modal-search-form {
    margin-bottom: 12px;
}

.modal-select {
    margin-bottom: 8px;
}

.modal-select[multiple] {
    height: 190px;
    padding: 10px 12px;
}

.modal-avatar-button {
    width: 100%;
}

.group-avatar-preview-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.group-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #d8c7b6;
    background: #fffefc;
}

.group-manage-avatar-block {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-actions button {
    margin-top: 0;
}

.modal-hint {
    margin: 0 0 10px;
    font-size: 14px;
    color: #6e5a50;
}

.group-members-list {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #ddccbb;
    border-radius: 8px;
    background: #fffefc;
    padding: 8px;
    margin-bottom: 10px;
}

.group-member-row {
    font-size: 14px;
    padding: 5px 0;
    border-bottom: 1px solid #ebdfd2;
}

.group-member-row:last-child {
    border-bottom: 0;
}

.group-manage-form {
    margin-bottom: 8px;
}

.group-manage-form input {
    height: 40px;
}

.group-manage-form button {
    margin-top: 6px;
    height: 36px;
    font-size: 14px;
}

.danger-button {
    margin-top: 14px;
    background: #a23525;
}

.danger-button:hover {
    background: #8f2d20;
}

.search-profile-link {
    display: inline-block;
    width: fit-content;
    color: #7b4b3a;
    text-decoration: none;
    margin-bottom: 6px;
    font-size: 14px;
}

.search-profile-link:hover {
    text-decoration: underline;
}

.profile-page-wrap {
    width: 900px;
    min-width: 900px;
}

.profile-page-wide {
    width: 98vw;
    max-width: 2200px;
    min-width: 1500px;
}

.auth-page-wrap {
    width: 1100px;
    min-width: 1100px;
}

.profile-card {
    background: #f7efe4;
    border: 1px solid #cdbca9;
    border-radius: 14px;
    padding: 24px;
    min-height: 420px;
}

.own-profile-card {
    min-height: 92vh;
}

.profile-top-bar {
    margin-bottom: 26px;
}

.profile-page-avatar {
    width: 72px;
    height: 72px;
}

.profile-title {
    text-align: left;
    margin-bottom: 20px;
}

.own-profile-layout {
    display: flex;
    gap: 24px;
}

.profile-info-card,
.profile-form-card {
    background: #fff8f0;
    border: 1px solid #d8c7b6;
    border-radius: 14px;
    padding: 20px;
}

.profile-info-card {
    width: 46%;
}

.profile-form-card {
    width: 54%;
}

.profile-bottom-actions {
    margin-top: 28px;
    display: flex;
    justify-content: flex-end;
}

.profile-avatar-section {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.profile-large-avatar {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #cdb197;
    background: #fffefc;
}

.avatar-upload-button {
    margin-top: 0;
    width: 220px;
}

.avatar-upload-name {
    margin-top: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #6e5a50;
}

.logout-bottom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 46px;
    border-radius: 10px;
    background: #7b4b3a;
    color: #fffaf5;
}

.logout-bottom:hover {
    background: #6a3f30;
    text-decoration: none;
}

.auth-card {
    max-width: 720px;
    margin: 60px auto;
    min-height: auto;
}

.auth-form {
    max-width: 100%;
}

.profile-view-row {
    border: 1px solid #ddccbb;
    background: #fffefc;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.profile-view-label {
    font-size: 13px;
    color: #6e5a50;
    margin-bottom: 6px;
}

.profile-view-value {
    font-size: 18px;
    color: #2f241f;
    word-break: break-word;
}

.profile-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.profile-actions form {
    margin: 0;
}

.profile-actions button {
    margin-top: 0;
    width: 190px;
}

.secondary-link {
    display: inline-block;
    height: 44px;
    line-height: 44px;
    padding: 0 18px;
    border-radius: 8px;
    border: 1px solid #7b4b3a;
    color: #7b4b3a;
    text-decoration: none;
    background: #fffaf2;
}

body.theme-dark {
    background:
        radial-gradient(circle at 12% 18%, rgba(119, 88, 214, 0.18), transparent 24%),
        radial-gradient(circle at 84% 22%, rgba(68, 123, 193, 0.22), transparent 22%),
        radial-gradient(circle at 72% 78%, rgba(89, 140, 115, 0.18), transparent 24%),
        linear-gradient(135deg, #171922 0%, #1d2230 48%, #141823 100%);
    color: #e9edf7;
}

body.theme-dark .main-card,
body.theme-dark .profile-card,
body.theme-dark .modal-card,
body.theme-dark .left-panel,
body.theme-dark .center-panel,
body.theme-dark .profile-info-card,
body.theme-dark .profile-form-card,
body.theme-dark .welcome-card,
body.theme-dark .form-card {
    background: rgba(29, 34, 48, 0.92);
    border-color: #384155;
    color: #e9edf7;
}

body.theme-dark .welcome-card {
    background:
        linear-gradient(135deg, rgba(29, 34, 48, 0.96), rgba(21, 25, 35, 0.94)),
        repeating-linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.02) 0,
            rgba(255, 255, 255, 0.02) 10px,
            rgba(0, 0, 0, 0.02) 10px,
            rgba(0, 0, 0, 0.02) 20px
        );
}

body.theme-dark .title,
body.theme-dark .welcome-title,
body.theme-dark .active-chat-title,
body.theme-dark .top-link,
body.theme-dark .logout,
body.theme-dark .profile-view-value,
body.theme-dark .chat-item-name,
body.theme-dark .message-author,
body.theme-dark .modal-head h3,
body.theme-dark .top-user,
body.theme-dark .secondary-link,
body.theme-dark .empty-chat-title {
    color: #f4f7ff;
}

body.theme-dark .welcome-text,
body.theme-dark .welcome-actions-text,
body.theme-dark .welcome-feature,
body.theme-dark .profile-view-label,
body.theme-dark .chat-item-tag,
body.theme-dark .message-time,
body.theme-dark .message-read-status,
body.theme-dark .empty-chat-text,
body.theme-dark .message-image-status,
body.theme-dark .modal-hint {
    color: #b9c3d9;
}

body.theme-dark label,
body.theme-dark .search-name,
body.theme-dark .group-member-row,
body.theme-dark .avatar-upload-name,
body.theme-dark .profile-title,
body.theme-dark .message-parent-title,
body.theme-dark .reply-preview-title,
body.theme-dark .left-panel h3,
body.theme-dark .profile-info-card h2,
body.theme-dark .profile-form-card h2 {
    color: #f4f7ff;
}

body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select,
body.theme-dark .custom-select-trigger,
body.theme-dark .chat-list,
body.theme-dark .chat-box,
body.theme-dark .search-result,
body.theme-dark .group-members-list,
body.theme-dark .profile-view-row {
    background: #202636;
    border-color: #3a445b;
    color: #f4f7ff;
}

body.theme-dark .chat-item {
    background: #252c3d;
    color: #f4f7ff;
}

body.theme-dark .custom-select-menu {
    background: #202636;
    border-color: #3a445b;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

body.theme-dark .custom-select-option {
    color: #f4f7ff;
}

body.theme-dark .custom-select-option:hover,
body.theme-dark .custom-select-option.selected {
    background: #313b52;
}

body.theme-dark .chat-item.active {
    background: #34405a;
}

body.theme-dark .secondary-panel-button,
body.theme-dark .leave-chat-button,
body.theme-dark .secondary-action-button,
body.theme-dark .secondary-link,
body.theme-dark .reply-preview-close,
body.theme-dark .clear-image-button {
    background: #313b52;
    color: #f4f7ff;
    border-color: #4c5771;
}

body.theme-dark .danger-button {
    background: #b94a3b;
    color: #fff7f6;
}

body.theme-dark .danger-button:hover {
    background: #9f3d31;
}

body.theme-dark .secondary-panel-button:hover,
body.theme-dark .leave-chat-button:hover,
body.theme-dark .secondary-action-button:hover {
    background: #3a4761;
}

body.theme-dark .chat-item-group-badge,
body.theme-dark .active-chat-group-badge,
body.theme-dark .chat-unread-badge,
body.theme-dark .welcome-badge,
body.theme-dark .logout-bottom,
body.theme-dark button,
body.theme-dark .welcome-action-button {
    background: #5569d8;
    color: #f8fbff;
}

body.theme-dark button:hover,
body.theme-dark .welcome-action-button:hover,
body.theme-dark .logout-bottom:hover {
    background: #4659c4;
}

body.theme-dark .custom-select-trigger,
body.theme-dark .custom-select-trigger:hover {
    background: #202636;
    color: #f4f7ff;
}

body.theme-dark .message-row,
body.theme-dark .group-member-row {
    border-color: #3a445b;
}

body.theme-dark .message-row-highlight {
    background: rgba(85, 105, 216, 0.16);
}

body.theme-dark .message-parent,
body.theme-dark .reply-preview {
    background: #283146;
    color: #f4f7ff;
    border-left-color: #5569d8;
}

body.theme-dark .message-parent:hover,
body.theme-dark .reply-preview-close:hover {
    background: #33405a;
}

body.theme-dark .message-read-status-button,
body.theme-dark .message-read-status-button:hover {
    background: transparent;
    color: #9fb0ff;
}

body.theme-dark .message-parent-text,
body.theme-dark .reply-preview-text {
    color: #b9c3d9;
}

body.theme-dark .image-viewer-overlay {
    background: rgba(7, 9, 14, 0.92);
}

body.theme-dark .reply-preview-title {
    color: #f4f7ff;
}

body.theme-dark .current-user-avatar,
body.theme-dark .chat-item-avatar,
body.theme-dark .active-chat-avatar,
body.theme-dark .message-author-avatar,
body.theme-dark .search-user-avatar,
body.theme-dark .message-image,
body.theme-dark .message-image-preview,
body.theme-dark .profile-large-avatar,
body.theme-dark .group-avatar-preview {
    border-color: #3a445b;
    background: #202636;
}

@media (max-width: 900px) {
    .page,
    .profile-page-wrap,
    .profile-page-wide,
    .auth-page-wrap {
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    .main-card,
    .profile-card {
        min-height: 100vh;
        border-radius: 0;
        padding: 14px;
    }

    .title {
        font-size: 24px;
        margin-bottom: 14px;
    }

    .top-bar {
        margin-bottom: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .messenger {
        flex-direction: column;
        height: auto;
    }

    .left-panel,
    .center-panel,
    .profile-info-card,
    .profile-form-card {
        width: 100%;
    }

    .center-panel {
        min-height: 60vh;
    }

    body:not(.mobile-chat-open) .center-panel {
        display: none;
    }

    body.mobile-chat-open .left-panel {
        display: none;
    }

    body.mobile-chat-open .center-panel {
        display: flex;
    }

    .chat-list {
        max-height: 60vh;
    }

    .panel-actions,
    .welcome-buttons,
    .own-profile-layout,
    .forms,
    .confirm-actions,
    .profile-bottom-actions {
        flex-direction: column;
    }

    .message-form {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .message-form input#messageInput {
        width: auto;
        flex: 1;
        min-width: 0;
    }

    .message-form #messageImageButton,
    .message-form #messageDocumentButton,
    .message-form #messageSendButton {
        width: 44px;
        min-width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .message-text,
    .message-time,
    .message-parent {
        max-width: 100%;
        width: 100%;
    }

    .active-chat-head {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 15;
        background: #fff8f0;
        padding: 6px 0 10px;
        margin-top: -6px;
    }

    .leave-chat-button {
        width: 100%;
    }

    .welcome-card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .welcome-title {
        font-size: 32px;
    }

    .welcome-text,
    .welcome-actions-text {
        font-size: 17px;
    }

    .welcome-features {
        grid-template-columns: 1fr;
    }

    .profile-large-avatar {
        width: 170px;
        height: 170px;
    }

    .profile-title {
        text-align: left;
    }

    .top-actions,
    .profile-bottom-actions {
        width: 100%;
    }

    .top-link,
    .logout-bottom {
        display: inline-flex;
        justify-content: center;
    }

    .avatar-upload-button,
    .logout-bottom {
        width: 100%;
    }
}

@media (max-width: 900px) {
    body.theme-dark .active-chat-head {
        background: rgba(29, 34, 48, 0.95);
    }
}

@media (max-width: 480px) {
    .main-card,
    .profile-card {
        padding: 10px;
    }

    .left-panel,
    .center-panel,
    .profile-info-card,
    .profile-form-card,
    .modal-card {
        padding: 12px;
    }

    .chat-box {
        padding: 10px;
    }

    .group-avatar-preview {
        width: 78px;
        height: 78px;
    }

    .current-user-avatar,
    .active-chat-avatar {
        width: 44px;
        height: 44px;
    }

    .chat-item-avatar,
    .chat-item-group-badge {
        width: 42px;
        height: 42px;
    }

    .message-image {
        max-width: 100%;
        max-height: 280px;
    }

    .message-image-preview {
        max-width: 100%;
        max-height: 180px;
    }

    .modal-overlay {
        padding: 10px;
    }

    .confirm-actions button {
        width: 100%;
    }
}
