:root {
    --card: #131b26;
    --primary: #005BA7;
    --accent: #ff9e00;
    --text: #e0e6ed;
    --brick-fallback: #0a1a3a;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image: url('brick-wall.jpg');
    background-color: var(--brick-fallback);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    position: relative;
}

body::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

body.app-active {
    display: block;
    justify-content: initial;
    align-items: initial;
}

/* === Экран входа === */
.container {
    position: relative;
    z-index: 2;
    max-width: 420px;
    width: 100%;
    background: rgba(19, 27, 38, 0.2);
    backdrop-filter: blur(4px);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin: 2rem;
}

.logo-wrapper { 
    text-align: center; 
    margin-bottom: 1.5rem; 
}
.logo-wrapper img {
    max-width: 130px;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    opacity: 0.95;
}

h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid #333;
    color: white;
    box-sizing: border-box;
    border-radius: 6px;
    font-size: 1rem;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.15);
}

button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
}

button:hover { background: #00447f; }
button:active { transform: scale(0.98); }

.hidden { display: none !important; }

.role-badge {
    padding: 4px 10px;
    background: var(--accent);
    color: #000;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* === Общие таблицы === */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #2a3645;
}

th {
    color: #888;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.status-new { color: #f4a261; }
.status-done { color: #2a9d8f; }

/* === Layout с сайдбаром === */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

.sidebar {
    width: 240px;
    background: rgba(0,0,0,0.6);
    border-right: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-menu li {
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-menu li:hover {
    background: rgba(255,255,255,0.05);
}

.sidebar-menu li.active {
    background: rgba(255,255,255,0.1);
    border-left: 3px solid var(--accent);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: .85rem;
}

.logout-btn {
    width: 100%;
    background: #555;
    border: none;
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
}

.logout-btn:hover { background: #e63946; }

.sidebar-toggle { display: none; }

/* === Основная область === */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 20px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.content-section { display: none; }
.content-section.active { display: block; }

/* === Шапка с лого === */
.top-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0 25px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 25px;
    position: relative;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header-logo img {
    max-width: 40px;
    height: auto;
}

.mobile-menu-btn {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    width: auto;
}

/* Затемнение */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9;
}

.sidebar-overlay.show { display: block; }

/* === Новости и информация === */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.news-item, .info-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 20px;
}

.news-item h3, .info-item h3 { margin: 0 0 5px 0; }

.news-date {
    font-size: .8rem;
    color: #888;
    margin: 0 0 10px 0;
}

.news-content, .info-content {
    color: #ccc;
    line-height: 1.5;
}

/* === Админ-формы === */
.admin-form {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.admin-form h3 { margin: 0 0 15px 0; font-size: 1rem; }

textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid #333;
    color: white;
    box-sizing: border-box;
    border-radius: 6px;
    font-size: 1rem;
    resize: vertical;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.15);
}

/* === Карточка рабочего === */
.worker-card {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    max-width: 450px;
    margin: 0 auto;
}

.worker-icon { font-size: 4rem; margin-bottom: 10px; }
.worker-card h3 { margin: 0 0 20px 0; font-size: 1.3rem; }

.worker-info { text-align: left; max-width: 350px; margin: 0 auto; }

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.info-label { color: #888; }
.info-value { font-weight: bold; }

/* === Инпуты в таблице === */
.tab-input, .spec-select {
    background: rgba(0,0,0,0.3);
    border: 1px solid #444;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: .85rem;
    width: 100%;
    box-sizing: border-box;
}

select option { background: #1a1a1a; color: #fff; }

.action-block { margin-top: 25px; padding-top: 20px; border-top: 1px solid #333; }

/* === Футер === */
.footer {
    margin-top: auto;
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: .85rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer p { margin: 0; }

/* === Мобилки === */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0 !important;
        padding: 15px;
    }

    .mobile-menu-btn { display: block; }

    .top-header {
        position: sticky;
        top: 0;
        z-index: 8;
        background: rgba(19, 27, 38, 0.95);
        backdrop-filter: blur(8px);
        padding: 12px 15px;
        margin: -15px -15px 20px -15px;
    }

    #section-chat.active {
        left: 0;
    }

    .chat-reply-btn { opacity: 0.4; }
}

@media (max-width: 480px) {
    .container { margin: 1rem; padding: 1.5rem; }
}

/* === Профиль === */
.profile-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.profile-tab {
    background: rgba(255,255,255,0.05);
    border: 1px solid #1c2a3a;
    color: #b0b8c4;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
    transition: .2s;
}
.profile-tab:hover { background: rgba(255,255,255,0.1); }
.profile-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; }

/* === ЧАТ (общий) === */
.chat-box {
    background: var(--card);
    border: 1px solid #1c2a3a;
    border-radius: 12px;
    margin-bottom: 25px;
    overflow: hidden;
}
.chat-header {
    padding: 10px 15px;
    font-weight: bold;
    font-size: .9rem;
    background: rgba(0,91,167,0.15);
    border-bottom: 1px solid #1c2a3a;
}
.chat-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
}
.chat-message {
    margin-bottom: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    word-wrap: break-word;
}
.chat-author { font-weight: bold; }
.chat-text { margin-left: 6px; }
.chat-time {
    font-size: .7rem;
    color: #888;
    margin-left: 8px;
}
.chat-message img {
    max-width: 250px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 6px;
    display: block;
    cursor: pointer;
}
.chat-file-btn:hover { background: #2a3a4a; }
.chat-input-row {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid #1c2a3a;
}


/* === Строка ввода чата === */
.chat-input-row input {
    flex: 1;
    min-width: 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 6px;
    box-sizing: border-box;
}

.chat-send-btn {
    flex-shrink: 0;
    width: auto;
    padding: 10px 20px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}
/* === Кнопка "Назад" === */
.chat-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.chat-back-btn svg {
    display: block;
}

.chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.chat-back-btn:active {
    transform: scale(0.92);
}
/* === Личный кабинет === */
.profile-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 25px;
    max-width: 500px;
}
.profile-row {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.profile-row:last-child { border-bottom: none; }
.profile-label {
    min-width: 140px;
    color: #888;
    flex-shrink: 0;
}
.profile-value { font-weight: bold; }

/* === APPLE-СКРОЛЛ НОВОСТЕЙ === */
.news-scroll-outer {
    position: relative;
    margin-bottom: 25px;
}
.news-scroll-wrap {
    height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y proximity;
    border-radius: 14px;
    border: 1px solid #1c2a3a;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.news-scroll-wrap::-webkit-scrollbar { width: 6px; }
.news-scroll-wrap::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
.news-scroll-wrap::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

.news-scroll-slide {
    height: 400px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.news-scroll-bg {
    position: absolute;
    top: -60px;
    left: -60px;
    right: -60px;
    bottom: -60px;
    background-size: cover;
    background-position: center;
    will-change: transform;
    transition: transform 0.05s linear;
}
.news-scroll-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.65) 100%);
}
.news-scroll-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 500px;
    max-height: 100%;
    overflow-y: auto;
    padding: 30px;
    will-change: transform, opacity;
    transition: opacity 0.1s linear, transform 0.1s linear;
}

.news-scroll-content .news-date-tag {
    color: var(--accent);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    display: block;
}
.news-scroll-content h3 {
    color: #fff;
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}
.news-scroll-content p {
    color: #d0d8e0;
    font-size: 1.05rem;
    line-height: 1.6;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.news-scroll-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}
.news-scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: .3s;
}
.news-scroll-dot.active {
    background: var(--accent);
    width: 24px;
    border-radius: 4px;
}
.news-scroll-bg { pointer-events: none; }
.news-scroll-overlay { pointer-events: none; }

/* === FAQ === */
.faq-answer { display: none; }
.faq-item.open .faq-answer { display: block; }
.faq-arrow {
    transition: transform 0.2s;
    font-size: 1.2rem;
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }

/* === ДАШБОРД === */
.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.dash-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform .2s, border-color .2s;
}
.dash-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}
.dash-card-icon { font-size: 2rem; margin-bottom: 8px; }
.dash-card-value { font-size: 2rem; font-weight: bold; color: #fff; }
.dash-card-label { color: #888; font-size: .85rem; margin-top: 4px; }
.dash-card-sub { color: var(--accent); font-size: .8rem; margin-top: 2px; }

.dash-alert {
    background: rgba(255,158,0,0.1);
    border: 1px solid rgba(255,158,0,0.3);
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 12px;
    color: #e0e6ed;
    font-size: .9rem;
    transition: background .2s;
    cursor: pointer;
}
.dash-alert:hover { background: rgba(255,158,0,0.15); }
.dash-alert-red {
    background: rgba(230,57,70,0.1);
    border-color: rgba(230,57,70,0.3);
    cursor: default;
}
.dash-alert-red:hover { background: rgba(230,57,70,0.15); }
.dash-alert-yellow {
    background: rgba(244,162,97,0.1);
    border-color: rgba(244,162,97,0.3);
    cursor: default;
}
.dash-alert-yellow:hover { background: rgba(244,162,97,0.15); }

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .dash-grid { grid-template-columns: 1fr; }
    .dash-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .dash-cards { grid-template-columns: 1fr; }
}

.dash-panel {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px;
}
.dash-panel-title {
    margin: 0 0 15px 0;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dash-badge-open {
    background: #e63946;
    color: #fff;
    font-size: .75rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: bold;
}

.dash-spec-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.dash-spec-label { min-width: 120px; font-size: .85rem; }
.dash-spec-bar-wrap {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
}
.dash-spec-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .5s;
}
.dash-spec-count {
    min-width: 30px;
    text-align: right;
    font-weight: bold;
    font-size: .85rem;
}

.dash-orders-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.dash-order-badge {
    font-size: .85rem;
    padding: 4px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
}
.dash-order-row {
    display: grid;
    grid-template-columns: 40px 1fr 1fr auto;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: .85rem;
    align-items: center;
}
.dash-order-id { color: #888; }
.dash-order-client { font-weight: bold; }
.dash-order-object { color: #aaa; }
.dash-order-status { font-size: .8rem; white-space: nowrap; }

.dash-ticket-row {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: .85rem;
    align-items: center;
    transition: background .2s;
    cursor: pointer;
}
.dash-ticket-row:hover { background: rgba(255,255,255,0.03); }
.dash-ticket-subject { flex: 1; }
.dash-ticket-user { color: #888; font-size: .8rem; }

.dash-refresh-btn {
    background: var(--accent);
    color: #000;
    width: auto;
    padding: 8px 16px;
    margin-bottom: 20px;
    font-weight: bold;
}

/* === Мессенджер-чат (полноэкранный) === */
.chat-box-large {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.chat-messages,
.chat-messages-large {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
    box-sizing: border-box;
    position: relative;
}

.chat-bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    position: relative;
}

.chat-bubble.own {
    align-self: flex-end;
    background: linear-gradient(135deg, #005BA7, #0077cc);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

.chat-bubble.other {
    align-self: flex-start;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px 16px 16px 4px;
}

.chat-bubble .chat-author {
    font-size: .78rem;
    font-weight: bold;
    margin-bottom: 2px;
    display: block;
}

.chat-bubble .chat-text {
    font-size: .95rem;
    line-height: 1.4;
    display: inline;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.chat-bubble .chat-time {
    font-size: .68rem;
    margin-top: 4px;
    display: block;
    opacity: .6;
}

.chat-bubble.own .chat-time { text-align: right; }
.chat-bubble .chat-time,
.chat-bubble.other .chat-time {
    color: #fff;
    opacity: .75;
}


.chat-bubble img {
    max-width: 250px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 6px;
    display: block;
    cursor: pointer;
}

/* === Полноэкранный режим чата === */
#section-chat.active {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: var(--card);
}

#section-chat.active .chat-box-large {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
}

#section-chat.active .chat-header {
    flex-shrink: 0;
    padding: 12px 20px;
}

#section-chat.active .chat-messages-large {
    flex: 1;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    padding: 15px;
    box-sizing: border-box;
}

#section-chat.active .chat-input-row {
    flex-shrink: 0;
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
    background: var(--card);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (min-width: 769px) {
    #section-chat.active {
        left: 240px;
    }
}

/* === Сообщения чата === */
.chat-msg-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 6px;
}

.chat-msg-row.own {
    justify-content: flex-end;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}

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

.chat-avatar-spacer {
    width: 36px;
    flex-shrink: 0;
}

.chat-date-sep {
    text-align: center;
    margin: 15px 0 10px;
}

.chat-date-sep span {
    background: rgba(0,0,0,0.4);
    color: #aab;
    font-size: .75rem;
    padding: 4px 14px;
    border-radius: 12px;
}

.chat-bubble.grouped { margin-top: 2px; }
.chat-bubble.other.grouped { border-radius: 6px 16px 16px 6px; }
.chat-bubble.own.grouped { border-radius: 16px 6px 6px 16px; }

/* === Кнопка скролла вниз === */
.chat-scroll-btn {
    position: absolute;
    bottom: 90px;
    right: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chat-scroll-btn:hover { background: rgba(0, 0, 0, 0.8); }
.chat-scroll-btn.visible { display: flex; }

.chat-scroll-btn .unread-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e63946;
    color: #fff;
    font-size: .65rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    padding: 0 4px;
}

/* === Бейдж непрочитанных в сайдбаре === */
.chat-badge {
    display: inline-block;
    background: #e63946;
    color: #fff;
    font-size: .7rem;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    padding: 0 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.chat-sound-btn { transition: opacity .2s; }
.chat-sound-btn:hover { opacity: .7; }

/* === Ответы на сообщения === */
.chat-reply {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
}

.chat-reply-line {
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

.chat-reply-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.chat-reply-name {
    font-size: .75rem;
    color: var(--accent);
    font-weight: bold;
}

.chat-reply-text {
    font-size: .75rem;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.chat-bubble.own .chat-reply-text { color: rgba(255,255,255,0.6); }

.chat-reply-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: .75rem;
    cursor: pointer;
    width: auto;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}
.chat-bubble:hover .chat-reply-btn { opacity: 1; }
.chat-reply-btn:hover { color: var(--accent); }
/* === ФИКС: чат на весь экран === */
@media (max-width: 768px) {
    #section-chat.active {
        left: 0 !important;
    }
    #section-chat.active .chat-input-row {
        margin-bottom: 50px !important;
    }
}
@media (max-width: 768px) {
    .chat-scroll-btn {
        bottom: 160px !important;
    }
}
/* Кнопка "Отправить" — серая по умолчанию, зелёная при наборе */
.chat-send-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: #2a9d8f;      /* зелёный */
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.chat-send-btn.active { display: flex; }
.chat-send-btn:hover { background: #25877c; }
.chat-send-btn:active { transform: scale(0.92); }
.chat-send-btn svg { display: block; }
/* 2. Кнопка цитаты ↩ — всегда видна */
.chat-reply-btn {
    opacity: 0.7 !important;
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    padding: 3px 6px;
    font-size: .8rem;
}
.chat-reply-btn:hover {
    opacity: 1 !important;
    background: rgba(0,0,0,0.4);
}

/* 3. Время отправки — белым цветом */
.chat-bubble .chat-time {
    color: #fff;
    opacity: .75;
}
#chat-input {
    flex: 1;
    min-width: 0;
    width: auto;
    margin-bottom: 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: inherit;
}
/* === ТИПИНГ === */
.typing-dots {
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
}
.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing-bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* === РЕДАКТИРОВАНИЕ === */
.chat-edited {
    font-size: .62rem;
    opacity: .55;
    margin-left: 2px;
}
.chat-edit-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}
.chat-edit-textarea {
    width: 100% !important;
    min-height: 50px;
    padding: 8px !important;
    background: rgba(0,0,0,0.3) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-size: .9rem !important;
    font-family: inherit;
    resize: none;
    box-sizing: border-box;
    margin: 0 !important;
}
.chat-edit-buttons {
    display: flex;
    gap: 6px;
}
.chat-edit-save, .chat-edit-cancel {
    width: auto !important;
    padding: 5px 12px !important;
    font-size: .8rem !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.chat-edit-save {
    background: #2a9d8f;
    color: #fff;
}
.chat-edit-cancel {
    background: #555;
    color: #fff;
}

/* === КНОПКИ ДЕЙСТВИЙ === */
.chat-action-btn {
    position: absolute;
    background: rgba(0,0,0,0.25);
    border: none;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: .75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    width: auto;
}
.chat-edit-btn { top: 4px; right: 28px; }
.chat-delete-btn { top: 4px; right: 52px; }
.chat-bubble:hover .chat-action-btn { opacity: 0.7; }
.chat-action-btn:hover { opacity: 1 !important; background: rgba(0,0,0,0.4); }

@media (max-width: 768px) {
    .chat-action-btn { opacity: 0.6; }
    .chat-edit-btn { right: 28px; }
    .chat-delete-btn { right: 52px; }
}

/* === ГОЛОСОВАЯ ЗАПИСЬ === */
@keyframes pulse-rec {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}
.chat-mic-btn {
    transition: background 0.2s;
}
.chat-mic-btn:hover { background: #2a3a4a; }
.chat-mic-btn.recording { background: #e63946; }

/* === АУДИО ПЛЕЕР === */
.chat-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 8px 12px;
    margin-top: 6px;
    min-width: 180px;
    max-width: 260px;
}
.audio-play-btn {
    width: 36px !important;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    flex-shrink: 0;
}
.audio-play-btn:hover { background: #ffb733; }
.audio-wave-bars {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    height: 28px;
    min-width: 0;
}
.audio-wave-bars span {
    flex: 1;
    min-width: 2px;
    max-width: 5px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    transition: background 0.2s;
}
.chat-audio-player.playing .audio-wave-bars span {
    background: var(--accent);
    animation: wave-anim 0.6s infinite alternate;
}
.chat-audio-player.playing .audio-wave-bars span:nth-child(odd) { animation-delay: 0.1s; }
.chat-audio-player.playing .audio-wave-bars span:nth-child(3n) { animation-delay: 0.2s; }
.chat-audio-player.playing .audio-wave-bars span:nth-child(4n) { animation-delay: 0.3s; }
@keyframes wave-anim {
    from { transform: scaleY(0.6); }
    to { transform: scaleY(1.2); }
}
.audio-time {
    font-size: .72rem;
    color: #888;
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}
.chat-bubble.own .audio-time { color: rgba(255,255,255,0.7); }
/* === READ RECEIPTS === */
.chat-read-tick {
    display: inline-flex;
    align-items: center;
    margin-left: 3px;
    color: rgba(255,255,255,0.45);
    transition: color 0.3s, filter 0.3s;
    vertical-align: middle;
}
.chat-read-tick svg {
    display: block;
}
.chat-read-tick.pending {
    color: rgba(255,255,255,0.45);
}
.chat-read-tick.read {
    color: #ffffff;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
    animation: tick-pop 0.35s ease;
}
@keyframes tick-pop {
    0%   { transform: scale(0.6); opacity: 0.4; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
/* === SWIPE TO REPLY === */
.chat-bubble.swiping {
    opacity: 0.85;
}
.chat-msg-row .chat-bubble {
    position: relative;
}
.chat-msg-row::before {
    content: '↩';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    font-size: 1.2rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 5;
}
.chat-msg-row.own::before {
    left: auto;
    right: 8px;
}
.chat-msg-row.swipe-active::before {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}
/* ═══ ФИКС ДЛЯ IPHONE 16 PRO MAX (430px) ═══ */

@media (max-width: 480px) {

    /* 1. Вкладки — сетка 3 в ряд */
    .profile-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .profile-tab {
        text-align: center;
        padding: 8px 4px;
        font-size: .75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 2. Таблицы — остаются таблицами, скролл через обёртку */
    .admin-table,
    .orders-table {
        min-width: 560px;
    }
    .admin-table th,
    .admin-table td,
    .orders-table th,
    .orders-table td {
        white-space: nowrap;
        font-size: .8rem;
        padding: 8px 12px;
    }

    /* 3. Поля в админке — в колонку */
    .action-block input,
    .action-block select,
    .action-block textarea {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 10px;
        box-sizing: border-box;
    }
    .action-block button {
        width: auto;
        padding: 10px 24px;
    }

    /* 4. Карточки — на всю ширину */
    .profile-card,
    .news-item,
    .info-item,
    .admin-form {
        width: 100%;
        max-width: 100%;
        margin: 10px 0;
        padding: 16px;
        box-sizing: border-box;
    }

    /* 5. Дашборд */
    .dash-cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .dash-grid {
        grid-template-columns: 1fr;
    }
    .dash-order-row {
        grid-template-columns: 30px 1fr auto;
        font-size: .78rem;
        gap: 6px;
    }
    .dash-order-row .dash-order-object {
        display: none;
    }

    /* 6. Поиск — в колонку */
    #tab-admin-search .action-block > div[style*="display:flex"] {
        flex-direction: column;
    }
    #tab-admin-search .action-block button {
        width: 100%;
    }

    /* 7. Смена пароля — компактная кнопка */
    #tab-profile-data form button[type="submit"] {
        width: auto;
        padding: 10px 24px;
    }

    /* 8. Гасим горизонтальный скролл страницы */
    .main-content {
        overflow-x: hidden;
        padding: 12px;
    }
    body {
        overflow-x: hidden;
    }
}
/* Тёмно‑синяя шапка */
.top-header {
    background-color: var(--primary); /* #005BA7 — твой основной цвет */
    color: #fff;
}

.mobile-menu-btn {
    color: #fff; /* чтобы значок ☰ был белым */
}

/* Тёмно‑синий футер */
.footer {
    background-color: #052a50; /* чуть темнее --primary, чтобы был контраст с контентом */
    color: var(--text);        /* белый/светлый текст из твоих переменных */
    padding: 16px 0;           /* небольшой отступ сверху/снизу */
    text-align: center;        /* центрируем копирайт */
    border-top: none;           /* убираем любые полупрозрачные линии, если были */
}
/* Центрирование логотипа */
.top-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.header-logo img {
    width: 64px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0;
}

.header-logo span {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dash-refresh-btn {
    margin-top: 20px;          /* отступ сверху */
    margin-bottom: 0 !important; /* отменяем старый отступ, если был */
    display: block;             /* гарантия блочного поведения */
    width: auto;
}

/* Если кнопка всё равно лезет на меню — принудительно отодвинем панель */
.dash-panel {
    margin-top: 10px;
}
/* === СКРЫТИЕ КНОПОК (показ только при долгом нажатии) === */
.chat-action-btn,
.chat-reply-btn {
    opacity: 0 !important;
    pointer-events: none !important;
}

.chat-bubble.show-actions .chat-action-btn,
.chat-bubble.show-actions .chat-reply-btn {
    opacity: 0.8 !important;
    pointer-events: auto !important;
}

.chat-bubble.show-actions .chat-action-btn:hover,
.chat-bubble.show-actions .chat-reply-btn:hover {
    opacity: 1 !important;
}

/* Гасим старые hover-правила */
.chat-bubble:hover .chat-action-btn,
.chat-bubble:hover .chat-reply-btn {
    opacity: 0 !important;
}

@media (max-width: 768px) {
    .chat-action-btn,
    .chat-reply-btn {
        opacity: 0 !important;
    }
}
.chat-context-menu {
  position: fixed;
  background: #1a2a3a;
  border: 1px solid #2a3a4a;
  border-radius: 12px;
  padding: 6px 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10000;
  min-width: 180px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.chat-context-menu.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.chat-ctx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  color: #ccc;
  cursor: pointer;
  font-size: 0.92rem;
  user-select: none;
}
.chat-ctx-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.chat-ctx-item.danger {
  color: #e63946;
}
.chat-ctx-item.danger:hover {
  background: rgba(230,57,70,0.12);
}
.chat-ctx-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: transparent;
}
/* === Иконки меню в стиле MAX === */
.sidebar-menu li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
}

.sidebar-menu li .menu-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.sidebar-menu li:hover .menu-icon {
    opacity: 0.75;
}

.sidebar-menu li.active .menu-icon {
    opacity: 1;
}

.sidebar-menu li span:not(.chat-badge) {
    flex: 1;
}

.sidebar-menu li .chat-badge {
    margin-left: 0;
    flex-shrink: 0;
}
/* === Иконки вкладок в стиле MAX === */
.profile-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.profile-tab .tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.profile-tab.active .tab-icon {
    opacity: 1;
}

@media (max-width: 768px) {
    .profile-tab .tab-icon {
        width: 16px;
        height: 16px;
    }
}
/* фон стекла */
.top-header {
    background: rgba(0, 91, 167, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
/* Кнопки в прифиле */
.profile-tab.active {
    background: rgba(0, 91, 167, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: rgba(0, 91, 167, 0.3);
}
/*Спец иконка */
#online-users-list .spec-svg {
    width: 14px;
    height: 14px;
}
/* Кнопка обновить */
.dash-refresh-btn {
    margin-top: 15px;
}
/* Кнопка микрофона */
.chat-mic-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Печатает сверху над полем ввода */
#chat-typing-indicator {
    position: absolute;
    bottom: 65px;
    right: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 3px 12px !important;
    z-index: 10;
    backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
    #chat-typing-indicator {
        bottom: 115px;
    }
}
/* Вкладка Пароль */
@media (max-width: 768px) {
    .profile-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .profile-tab {
        width: 100%;
        padding: 12px 0;
    }
}
/* Переносы для Админа */
.chat-message .chat-text {
    white-space: pre-wrap;
    word-break: break-word;
}
/* Буква @ в чате */
.mention-dropdown {
    position: absolute;
    bottom: 60px;
    left: 12px;
    right: 12px;
    max-height: 200px;
    overflow-y: auto;
    background: #1a2a3a;
    border: 1px solid #2a3a4a;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 50;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: .9rem;
    color: #ccc;
}
.mention-item:hover,
.mention-item.active {
    background: rgba(0,91,167,0.3);
    color: #fff;
}
.mention-item .mention-role {
    font-size: .72rem;
    color: #888;
    margin-left: auto;
}
.chat-text .mention {
    color: #fff;
    font-weight: 600;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.55);
}
/*  ИКОНКИ ЗВУК и МИРОФОН */
.chat-file-btn svg,
.chat-mic-btn svg,
.chat-sound-btn svg,
.chat-send-btn svg {
    display: block;
}
.chat-file-btn,
.chat-mic-btn,
.chat-sound-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}
/* СВЕЧЕНИЕ КНОПОК В ЦЕНТРЕ*/
.chat-title {
    flex: 1;
    text-align: center;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .5px;
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Текст исчезает в Шапке */
#section-chat.active .chat-messages-large {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 20px), transparent 100%);
}
/* Кнопка микрофона — на месте кнопки отправки */
.chat-mic-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1c2a3a;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.chat-mic-btn:hover { background: #2a3a4a; }
.chat-mic-btn:active { transform: scale(0.92); }
.chat-mic-btn svg { display: block; }
/* Подпись "прочитано" рядом с галочками */
.chat-read-label {
    font-size: .68rem;
    color: #4fc3f7;
    margin-left: 2px;
}
/* === РЕАКЦИИ === */
.chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}
.chat-reaction {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: .78rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, transform 0.1s;
}
.chat-reaction:hover { background: rgba(0,0,0,0.4); }
.chat-reaction:active { transform: scale(0.95); }
.chat-reaction.mine { background: rgba(0,91,167,0.55); }
.chat-ctx-reactions {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.chat-ctx-reactions span {
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.15s;
}
.chat-ctx-reactions span:hover { transform: scale(1.25); }
/* === КОМНАТЫ === */
.chat-layout { display: flex; flex: 1; min-height: 0; }
.chat-rooms {
  width: 260px; flex-shrink: 0;
  border-right: 1px solid #1c2a3a;
  display: flex; flex-direction: column;
  background: var(--card); overflow-y: auto;
}
.chat-rooms-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid #1c2a3a; font-weight: bold;
}
.chat-rooms-header span { flex: 1; text-align: center; font-size: .95rem; }

/* Кнопка «＋» — как кнопки в чате: тёмный круг, белая иконка */
.chat-rooms-add {
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: #1c2a3a;
  border: none; border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.chat-rooms-add:hover { background: #2a3a4a; }
.chat-rooms-add:active { transform: scale(0.92); }
.chat-rooms-add svg { display: block; }

/* Кнопка «назад» — только на мобильном */
.chat-rooms-back { display: none !important; }

.chat-room-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.chat-room-item:hover { background: rgba(255,255,255,0.05); }
.chat-room-item.active { background: rgba(0,91,167,0.25); }

.chat-room-avatar {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; overflow: hidden;
}
.chat-room-avatar img { width: 100%; height: 100%; object-fit: cover; }

.chat-room-body { flex: 1; min-width: 0; }
.chat-room-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.chat-room-name {
  font-weight: 600; font-size: .92rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-room-time { font-size: .72rem; color: #888; flex-shrink: 0; }
.chat-room-last {
  font-size: .82rem; color: #8a97a5; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-room-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 2px;
}
.chat-room-bottom .chat-room-last { flex: 1; min-width: 0; }
.chat-room-badge {
  flex-shrink: 0;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: #e63946; color: #fff;
  font-size: .72rem; font-weight: bold; line-height: 20px;
  text-align: center; border-radius: 10px;
}
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.modal-box { background: #1a2a3a; border-radius: 12px; padding: 20px; width: 320px; max-width: 90%; }
.new-dialog-user { padding: 10px; cursor: pointer; border-radius: 6px; }
.new-dialog-user:hover { background: rgba(255,255,255,0.08); }
.modal-cancel { margin-top: 12px; background: #555; width: 100%; }

@media (max-width: 768px) {
  .chat-rooms { width: 100%; }
  .chat-rooms-back { display: inline-flex !important; }
  .chat-layout .chat-box-large { display: none; }
  .chat-layout.room-open .chat-rooms { display: none; }
  .chat-layout.room-open .chat-box-large { display: flex; }
}
/* === Запрет масштабирования в чате (как в MAX) === */
#section-chat,
#section-chat .chat-layout,
#section-chat .chat-rooms,
#section-chat .chat-box-large,
#section-chat .chat-messages-large {
  touch-action: pan-y;              /* только вертикальный скролл, без пинч-зума */
  -webkit-text-size-adjust: 100%;   /* не раздувать текст при повороте/зуме */
  -webkit-touch-callout: none;      /* без меню «сохранить/копировать» по долгому тапу на iOS */
}

/* Поля ввода и кнопки — без зума по двойному тапу */
#section-chat input,
#section-chat textarea,
#section-chat button {
  touch-action: manipulation;
}
/* === Карточка пользователя в чате (как в MAX) === */
.user-info-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.user-info-card {
  background: #1a2a3a;
  border: 1px solid #2a3a4a;
  border-radius: 14px;
  padding: 18px;
  width: 260px; max-width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.user-info-head {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: 14px;
}
.user-info-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; overflow: hidden;
}
.user-info-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info-name {
  color: #fff; font-size: .95rem; font-weight: 600;
  text-align: center; word-break: break-word;
}
.user-info-rows {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.user-info-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: .82rem; color: #ccc;
}
.user-info-row span { color: #888; }
.user-info-row b { font-weight: 600; color: #e0e6ed; text-align: right; }

.user-info-actions {
  display: flex; gap: 8px;
}
.user-info-btn {
  flex: 1;
  padding: 9px 12px;
  background: #1c2a3a;
  border: 1px solid #2a3a4a;
  border-radius: 8px;
  color: #e0e6ed;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.user-info-btn:hover { background: #2a3a4a; }
.user-info-btn:active { transform: scale(0.97); }
.user-info-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.user-info-btn.primary:hover { background: #00447f; }