:root{
    --brand-red:#cd0606;
    --brand-gray:#cccccc;
    --brand-black:#000000;
    --card-bg:rgba(10,10,10,.88);
    --muted:rgba(255,255,255,.65);
}

html,body{
    height:100%;
}

body{
    margin:0;
    background:radial-gradient(circle at 15% 10%, rgba(205,6,6,.12), transparent 32%),
               radial-gradient(circle at 90% 90%, rgba(255,255,255,.05), transparent 35%),
               var(--brand-black);
    color:#fff;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

.brand-accent{
    color:var(--brand-red);
}

.sidebar-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.55);
    opacity:0;
    visibility:hidden;
    transition:opacity .2s ease;
    z-index:1000;
}
.sidebar-overlay.show{
    opacity:1;
    visibility:visible;
}

.app-shell{
    height:100vh;
    padding:18px 0;
}

.sidebar-card{
    background:var(--card-bg);
    border:1px solid rgba(255,255,255,.08);
    border-radius:16px;
    height:100%;
    overflow:hidden;
}

.sidebar-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 14px 10px 14px;
    border-bottom:1px solid rgba(255,255,255,.08);
}

.logout-btn{
    border:0;
    background:rgba(255,255,255,.08);
    color:#fff;
    border-radius:12px;
    padding:10px 12px;
    cursor:pointer;
}

.sidebar-body{
    padding:12px 14px 14px 14px;
    height:calc(100% - 58px);
    overflow:auto;
}

.groups-list{
    padding:0;
    margin:0 0 14px 0;
    list-style:none;
}

.group-item{
    padding:10px 10px;
    border-radius:14px;
    margin-bottom:10px;
    cursor:pointer;
    border:1px solid rgba(255,255,255,.08);
    background:rgba(255,255,255,.03);
}
.group-item:hover{
    background:rgba(255,255,255,.08);
}
.group-item.active{
    border-color:rgba(205,6,6,.7);
    box-shadow:0 0 0 2px rgba(205,6,6,.18);
    background:rgba(205,6,6,.10);
}

.group-item-row{
    display:flex;
    gap:10px;
    align-items:flex-start;
}
.group-avatar{
    width:38px;
    height:38px;
    border-radius:50%;
    background:rgba(205,6,6,.24);
    border:1px solid rgba(205,6,6,.5);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:900;
}
.group-item-main{
    min-width:0;
    flex:1;
}
.group-item-title{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
}
.group-item-name{
    font-weight:800;
    line-height:1.1;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.group-pill{
    font-size:11px;
    padding:3px 8px;
    border-radius:999px;
    background:rgba(255,255,255,.08);
    color:var(--brand-gray);
    border:1px solid rgba(255,255,255,.10);
    white-space:nowrap;
}
.group-item-meta{
    margin-top:4px;
    font-size:12px;
    color:rgba(255,255,255,.55);
    font-weight:700;
}

.topics-title{
    font-weight:800;
    margin:6px 0 10px 0;
    color:var(--brand-gray);
}

.topics-list{
    padding:0;
    margin:0;
    list-style:none;
}

.topic-item{
    padding:9px 10px;
    border-radius:14px;
    margin-bottom:10px;
    cursor:pointer;
    border:1px solid rgba(255,255,255,.08);
    background:rgba(255,255,255,.03);
    display:flex;
    gap:8px;
    align-items:center;
}
.topic-item:hover{background:rgba(255,255,255,.08);}
.topic-item.active{
    border-color:rgba(205,6,6,.7);
    box-shadow:0 0 0 2px rgba(205,6,6,.18);
    background:rgba(205,6,6,.10);
}
.topic-hash{
    color:var(--brand-red);
    font-weight:900;
}
.topic-label{
    font-weight:700;
}

.chat-card{
    background:var(--card-bg);
    border:1px solid rgba(255,255,255,.08);
    border-radius:16px;
    height:100%;
    display:flex;
    flex-direction:column;
    overflow:hidden;
}

.chat-header{
    padding:14px 16px;
    border-bottom:1px solid rgba(255,255,255,.08);
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}

.mobile-menu-btn{
    display:none;
    border:0;
    border-radius:10px;
    background:rgba(255,255,255,.1);
    color:#fff;
    width:38px;
    height:34px;
    margin-bottom:10px;
    cursor:pointer;
}

.group-name{
    font-weight:900;
    font-size:18px;
}
.topic-name{
    margin-top:6px;
    color:var(--muted);
    font-weight:700;
}

.messages-area{
    flex:1;
    overflow:auto;
    padding:16px 16px 8px 16px;
    background:rgba(255,255,255,.02);
}

.message-row{
    display:flex;
    margin-bottom:14px;
}
.message-row.left{justify-content:flex-start;}
.message-row.right{justify-content:flex-end;}

.message-bubble{
    max-width:min(720px, 100%);
    border-radius:18px;
    padding:10px 12px;
    border:1px solid rgba(255,255,255,.08);
}
.message-bubble.left{
    background:rgba(255,255,255,.08);
}
.message-bubble.right{
    background:rgba(205,6,6,.25);
    border-color:rgba(205,6,6,.30);
}

.message-meta{
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:6px;
    color:#fff;
}

.role-icon{
    width:18px;
    display:inline-flex;
    justify-content:center;
}

.message-content{
    white-space:pre-wrap;
    line-height:1.35;
}
.message-time{
    color:rgba(255,255,255,.55);
    font-size:11px;
    margin-top:6px;
}
.empty-chat-state{
    min-height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:10px;
    color:rgba(255,255,255,.45);
    text-align:center;
    font-weight:700;
}
.empty-chat-state i{
    font-size:28px;
    color:rgba(255,255,255,.35);
}
.sidebar-empty{
    list-style:none;
    color:rgba(255,255,255,.5);
    font-weight:700;
    padding:6px 2px;
}

.chat-footer{
    padding:14px 16px;
    border-top:1px solid rgba(255,255,255,.08);
}

.chat-input-row{
    display:flex;
    gap:10px;
    align-items:flex-end;
}

.message-input{
    flex:1;
    min-height:52px;
    max-height:140px;
    resize:none;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.10);
    background:rgba(255,255,255,.06);
    color:#fff;
    padding:10px 12px;
}
.message-input:focus{
    outline:none;
    border-color:rgba(205,6,6,.60);
    box-shadow:0 0 0 2px rgba(205,6,6,.16);
}

.send-btn{
    border:0;
    background:var(--brand-red);
    color:#fff;
    font-weight:800;
    border-radius:14px;
    padding:12px 14px;
    cursor:pointer;
}
.send-btn:disabled{
    opacity:.6;
    cursor:not-allowed;
}

.invite-list{
    max-height:260px;
    overflow:auto;
    padding:6px 0;
}

.invite-user{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:10px 10px;
    border:1px solid rgba(255,255,255,.08);
    background:rgba(255,255,255,.03);
    border-radius:14px;
    margin-bottom:10px;
}

.invite-user-left{
    display:flex;
    align-items:center;
    gap:10px;
}
.invite-user-avatar{
    width:34px;
    height:34px;
    border-radius:50%;
    border:1.5px solid rgba(255,255,255,.18);
    object-fit:cover;
}

.invite-user-name{
    display:flex;
    align-items:center;
    gap:8px;
    font-weight:800;
}

@media (max-width: 767.98px){
    body.drawer-open{
        overflow:hidden;
    }

    .sidebar-overlay{
        display:block;
    }

    .app-shell{
        height:100vh;
        min-height:100vh;
        padding:0;
    }

    .app-shell > .row{
        height:100vh !important;
    }

    .chat-column{
        flex:0 0 100%;
        max-width:100%;
        width:100%;
        padding:0;
    }

    .sidebar-column{
        position:fixed;
        left:0;
        top:0;
        bottom:0;
        width:84vw;
        max-width:330px;
        z-index:1001;
        transform:translateX(-100%);
        transition:transform .22s ease;
        padding:0;
    }
    .sidebar-column.sidebar-open{
        transform:translateX(0);
    }

    .sidebar-card{
        height:100%;
        border-radius:0 16px 16px 0;
    }

    .sidebar-body{
        height:calc(100% - 58px);
        max-height:none;
        overflow:auto;
    }

    .chat-card{
        height:100vh;
        min-height:100vh;
        border-radius:0;
        border-left:0;
        border-right:0;
    }

    .chat-header{
        flex-direction:row;
        align-items:flex-start;
        padding:12px 12px 10px;
    }

    .mobile-menu-btn{
        display:inline-flex;
        align-items:center;
        justify-content:center;
    }

    .messages-area{
        padding:10px 12px 8px 12px;
    }

    .message-bubble{
        border-radius:16px;
    }

    .chat-input-row{
        gap:8px;
    }

    .send-btn{
        padding:12px 12px;
        min-width:48px;
    }
}

