.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--header-height);
    width: 100%;
    background: #1a1d21;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 72px 1fr 360px;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    z-index: 1000;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.site-logo__mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ff3b3b 0%, #c41414 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: -0.04em;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 8px 20px rgba(224, 36, 36, 0.28);
}

.header-nav {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    height: 100%;
}

.header-nav__item {
    position: relative;
    min-width: 92px;
    height: 100%;
    color: #b0b5bd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background 0.18s ease, color 0.18s ease;
}

.header-nav__item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #e5e7eb;
}

.header-nav__item svg {
    width: 26px;
    height: 26px;
    display: block;
}

.header-nav__item--active {
    color: var(--red);
}

.header-nav__item--active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: var(--red);
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.header-action,
.header-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    flex: 0 0 38px;
    border: 0;
    border-radius: 50%;
    background: #2b2f34;
    color: #e4e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.header-action:hover,
.header-avatar:hover {
    background: #353a40;
}

.header-action svg {
    width: 20px;
    height: 20px;
    display: block;
}

.header-avatar {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    overflow: hidden;
    position: relative;
}

.header-avatar span {
    color: #ffffff;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}

.header-avatar--profile {
    background: linear-gradient(180deg, #ff4d4d 0%, #c61b1b 100%);
}

.header-avatar--profile:hover {
    background: linear-gradient(180deg, #ff5b5b 0%, #d71f1f 100%);
}

.header-avatar--profile:has(img) {
    background: #2b2f34;
}

.header-auth-link {
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: #2b2f34;
    color: #e4e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-weight: 700;
    transition: background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.header-auth-link:hover {
    background: #353a40;
}

.header-auth-link--primary {
    background: var(--red);
    color: #ffffff;
}

.header-auth-link--primary:hover {
    background: var(--red-dark);
}

.header-auth-link--ghost {
    background: #2b2f34;
}

.header-auth-link--active {
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.4);
    color: #ffffff;
}

.header-notification-wrap,
.header-message-wrap {
    position: relative;
}

.header-action--notification,
.header-action--message {
    position: relative;
}

.header-notification-badge,
.header-message-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #1a1d21;
}

.header-notification-panel,
.header-message-panel {
    position: absolute;
    top: 48px;
    right: 0;
    width: 360px;
    background: #1c1f23;
    border: 1px solid #2b2f35;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
    overflow: hidden;
    z-index: 2000;
}

.header-notification-panel::before,
.header-message-panel::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 14px;
    width: 12px;
    height: 12px;
    background: #1c1f23;
    border-left: 1px solid #2b2f35;
    border-top: 1px solid #2b2f35;
    transform: rotate(45deg);
}

.header-notification-panel__header,
.header-message-panel__header {
    padding: 14px 16px;
    border-bottom: 1px solid #2f3338;
    color: #f3f4f6;
}

.header-notification-panel__body,
.header-message-panel__body {
    max-height: 420px;
    overflow-y: auto;
}

.header-notification-empty,
.header-message-empty {
    padding: 18px 16px;
    color: #b0b3b8;
}

.header-notification-section-label {
    padding: 12px 16px 6px;
    color: #9ca3af;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.header-notification-request {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #2a2e34;
}

.header-notification-request:last-child {
    border-bottom: 0;
}

.header-notification-request__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(180deg, #ff4d4d 0%, #c61b1b 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
}

.header-notification-request__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-notification-request__meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.header-notification-request__meta strong {
    color: #f3f4f6;
    font-size: 0.95rem;
}

.header-notification-request__meta span {
    color: #b0b3b8;
    font-size: 0.84rem;
}

.header-notification-request__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-notification-system {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border-bottom: 1px solid #2a2e34;
}

.header-notification-system--unread {
    background: rgba(239, 68, 68, 0.05);
}

.header-notification-system__icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.header-notification-system__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-notification-system__meta strong {
    color: #f3f4f6;
    font-size: 0.92rem;
}

.header-notification-system__meta p {
    margin: 0;
    color: #d1d5db;
    font-size: 0.84rem;
    line-height: 1.45;
}

.header-notification-system__meta span {
    color: #9ca3af;
    font-size: 0.76rem;
}

.notif-action {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
}

.notif-action--accept {
    background: #16a34a;
}

.notif-action--decline {
    background: #dc2626;
}

.notif-action:hover {
    filter: brightness(1.08);
}

.header-message-thread {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border-bottom: 1px solid #2a2e34;
    cursor: pointer;
    transition: background 0.18s ease;
}

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

.header-message-thread:hover {
    background: rgba(255, 255, 255, 0.03);
}

.header-message-thread--unread {
    background: rgba(239, 68, 68, 0.06);
}

.header-message-thread__avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(180deg, #ff4d4d 0%, #c61b1b 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    flex: 0 0 auto;
}

.header-message-thread__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-message-thread__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-message-thread__top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-message-thread__top strong {
    color: #f3f4f6;
    font-size: 0.94rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-message-thread__time {
    color: #9ca3af;
    font-size: 0.74rem;
    white-space: nowrap;
}

.header-message-thread__preview {
    color: #b0b3b8;
    font-size: 0.84rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-message-thread__side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 46px;
}

.header-message-thread__unread {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.message-chat-dock {
    position: fixed;
    right: 16px;
    bottom: 0;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 12px;
    z-index: 2200;
    pointer-events: none;
}

.message-chat-window {
    width: 320px;
    background: #1c1f23;
    border: 1px solid #2b2f35;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
    overflow: hidden;
    pointer-events: auto;
}

.message-chat-window--minimized {
    width: 220px;
}

.message-chat-window--minimized .message-chat-window__body {
    display: none;
}

.message-chat-window__header {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: #23262b;
    border-bottom: 1px solid #2f3338;
    cursor: default;
}

.message-chat-window__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(180deg, #ff4d4d 0%, #c61b1b 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    flex: 0 0 auto;
}

.message-chat-window__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.message-chat-window__title {
    min-width: 0;
    color: #f3f4f6;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-chat-window__controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-chat-window__control {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #f3f4f6;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.message-chat-window__control:hover {
    background: rgba(255, 255, 255, 0.08);
}

.message-chat-window__body {
    display: flex;
    flex-direction: column;
    height: 390px;
}

.message-chat-window__messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #1c1f23;
}

.message-chat-window__empty {
    color: #9ca3af;
    font-size: 0.88rem;
}

.message-chat-message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-chat-message--mine {
    align-self: flex-end;
    text-align: right;
}

.message-chat-message--theirs {
    align-self: flex-start;
    text-align: left;
}

.message-chat-message__bubble {
    padding: 10px 12px;
    border-radius: 16px;
    color: #f3f4f6;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    background: #2a2d31;
}

.message-chat-message--mine .message-chat-message__bubble {
    background: rgba(239, 68, 68, 0.18);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.24);
}

.message-chat-message__time {
    color: #9ca3af;
    font-size: 0.72rem;
}

.message-chat-window__form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #2f3338;
    background: #23262b;
}

.message-chat-window__input {
    flex: 1 1 auto;
    height: 40px;
    border: 0;
    outline: 0;
    border-radius: 999px;
    background: #2f3237;
    color: #f3f4f6;
    padding: 0 14px;
}

.message-chat-window__input::placeholder {
    color: #9ca3af;
}

.message-chat-window__send {
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    padding: 0 16px;
    cursor: pointer;
}

.message-chat-window__send:hover {
    background: var(--red-dark);
}

.message-chat-window__send:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.server-submit-modal {
    position: fixed;
    inset: 0;
    z-index: 3200;
}

.server-submit-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.server-submit-modal__dialog {
    position: relative;
    width: min(100% - 24px, 820px);
    max-height: 90vh;
    overflow: auto;
    margin: 5vh auto 0;
    background: #1c1f23;
    border: 1px solid #2b2f35;
    border-radius: 22px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
}

.server-submit-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 22px 14px;
    border-bottom: 1px solid #2f3338;
}

.server-submit-modal__header h2 {
    margin: 0;
    color: #f3f4f6;
    font-size: 1.4rem;
}

.server-submit-modal__close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #2b2f34;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
}

.server-submit-form {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.server-submit-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.server-submit-form__grid--media {
    align-items: start;
}

.server-submit-form__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.server-submit-form__field label {
    color: #f3f4f6;
    font-weight: 700;
    font-size: 0.92rem;
}

.server-submit-form__field input[type="text"],
.server-submit-form__field input[type="url"],
.server-submit-form__field textarea,
.server-submit-form__field input[type="file"] {
    width: 100%;
    border: 0;
    outline: 0;
    border-radius: 14px;
    background: #2f3237;
    color: #f3f4f6;
    padding: 12px 14px;
}

.server-submit-form__field textarea {
    resize: vertical;
    min-height: 160px;
}

.server-submit-form__field input::placeholder,
.server-submit-form__field textarea::placeholder {
    color: #9ca3af;
}

.server-submit-form__count,
.server-submit-form__hint {
    color: #9ca3af;
    font-size: 0.8rem;
}

.server-submit-form__icon-preview {
    width: 140px;
    height: 140px;
    border-radius: 26px;
    overflow: hidden;
    background: #20242a;
    border: 1px solid #2b2f35;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.84rem;
}

.server-submit-form__icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.server-submit-form__media-preview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.server-submit-form__media-item {
    border-radius: 14px;
    overflow: hidden;
    background: #20242a;
    border: 1px solid #2b2f35;
}

.server-submit-form__media-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.server-submit-form__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.server-submit-btn {
    height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.server-submit-btn--primary {
    background: var(--red);
    color: #fff;
}

.server-submit-btn--primary:hover {
    background: var(--red-dark);
}

.server-submit-btn--secondary {
    background: #2f3237;
    color: #f3f4f6;
}

.server-submit-btn--secondary:hover {
    background: #3a3f45;
}

.server-submit-form__message {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.45;
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 1100px) {
    .site-header {
        grid-template-columns: 72px 1fr auto;
    }
}

@media (max-width: 720px) {
    .site-header {
        padding: 0 10px;
        grid-template-columns: 52px 1fr auto;
    }

    .header-right {
        gap: 6px;
    }

    .header-auth-link,
    .header-auth-link--ghost {
        display: none;
    }

    .header-action,
    .header-avatar {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
        flex: 0 0 34px;
    }

    .header-nav__item {
        min-width: 64px;
    }

    .header-nav__item svg {
        width: 22px;
        height: 22px;
    }

    .header-notification-panel,
    .header-message-panel {
        width: 320px;
        right: -40px;
    }

    .message-chat-dock {
        right: 8px;
        left: 8px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .message-chat-window,
    .message-chat-window--minimized {
        width: 100%;
    }

    .server-submit-form__grid {
        grid-template-columns: 1fr;
    }

    .server-submit-form__media-preview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}