:root{
    --wa-green:#00a884;
    --wa-green-hover:#06cf9c;
    --wa-dark:#111b21;
    --wa-panel:#202c33;
    --wa-bg:#0b141a;
    --wa-msg:#005c4b;
    --wa-msg2:#202c33;
    --wa-border:#26343d;
    --wa-muted:#b8c5cc;
    --gold:#b89b28;
}

*{
    box-sizing:border-box;
}

html,
body{
    height:100%;
}

body{
    margin:0;
    background:var(--wa-bg);
    color:#e9edef;
    font-family:Inter,system-ui,-apple-system,Segoe UI,Arial,sans-serif;
    overflow:hidden;
}

/* LOGIN */
.login-wrap{
    min-height:100vh;
    display:grid;
    place-items:center;
    background:
        radial-gradient(circle at top left,#00a88422,transparent 35%),
        radial-gradient(circle at bottom right,#b89b2822,transparent 35%),
        linear-gradient(135deg,#0b141a,#111b21);
}

.login-card{
    width:min(420px,92vw);
    background:#111b21;
    border:1px solid var(--wa-border);
    border-radius:22px;
    padding:30px;
    box-shadow:0 20px 60px #0008;
}

.brand{
    display:flex;
    gap:12px;
    align-items:center;
    font-weight:800;
}

.brand small{
    color:var(--wa-muted);
    font-weight:500;
}

.brand-badge{
    width:42px;
    height:42px;
    border-radius:14px;
    background:linear-gradient(135deg,var(--wa-green),var(--gold));
    display:grid;
    place-items:center;
    color:#fff;
    box-shadow:0 8px 22px #00a88433;
}

.form-control,
.form-select{
    background:#1f2c34;
    border:1px solid #33444f;
    color:#e9edef;
    border-radius:12px;
}

.form-control::placeholder{
    color:#7d8b92;
}

.form-control:focus,
.form-select:focus{
    background:#1f2c34;
    color:#fff;
    border-color:var(--wa-green);
    box-shadow:0 0 0 .2rem #00a88433;
}

.btn-wa{
    background:var(--wa-green);
    color:#001b12;
    border:0;
    font-weight:800;
    border-radius:12px;
}

.btn-wa:hover{
    background:var(--wa-green-hover);
    color:#001b12;
}

/* LAYOUT */
.app-shell{
    height:100vh;
    display:grid;
    grid-template-columns:380px 1fr;
    overflow:hidden;
}

/* SIDEBAR */
.sidebar{
    background:var(--wa-dark);
    border-right:1px solid var(--wa-border);
    display:flex;
    flex-direction:column;
    min-width:0;
}

.topbar{
    min-height:70px;
    background:var(--wa-panel);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 18px;
    border-bottom:1px solid #1f2c34;
}

.searchbox{
    padding:12px;
    background:var(--wa-dark);
    border-bottom:1px solid #1f2c34;
}

.searchbox-chat{
    background:#111b21;
}

.chat-list{
    flex:1;
    overflow-y:auto;
    padding-bottom:16px;
}

.chat-list::-webkit-scrollbar,
.messages::-webkit-scrollbar{
    width:7px;
}

.chat-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb{
    background:#2b3b44;
    border-radius:20px;
}

.chat-item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:14px 16px;
    border-bottom:1px solid #1f2c34;
    color:#e9edef;
    text-decoration:none;
    transition:.2s ease;
}

.chat-item:hover,
.chat-item.active{
    background:#202c33;
}

.chat-avatar{
    width:44px;
    height:44px;
    flex:0 0 44px;
    border-radius:50%;
    background:linear-gradient(135deg,var(--wa-green),#075e54);
    display:grid;
    place-items:center;
    font-weight:900;
    color:#fff;
}

.chat-info{
    min-width:0;
}

.chat-info b{
    display:block;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.chat-info small{
    color:var(--wa-muted);
}

/* CHAT */
.chat-main{
    background:var(--wa-bg);
    display:flex;
    flex-direction:column;
    height:100vh;
    min-width:0;
    position:relative;
}

.chat-header{
    min-height:70px;
    background:var(--wa-panel);
    display:flex;
    align-items:center;
    gap:14px;
    padding:0 20px;
    border-bottom:1px solid #1f2c34;
}

.avatar{
    width:44px;
    height:44px;
    flex:0 0 44px;
    border-radius:50%;
    background:linear-gradient(135deg,var(--wa-green),#075e54);
    display:grid;
    place-items:center;
    font-weight:900;
    color:#fff;
}

.chat-title{
    min-width:0;
}

.chat-title b{
    display:block;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.chat-title small{
    color:var(--wa-muted);
}

.mobile-menu{
    display:none;
    background:#1f2c34;
    border:1px solid #33444f;
    color:#e9edef;
    width:40px;
    height:40px;
    border-radius:12px;
}

/* FILTROS */
.filters{
    display:grid;
    grid-template-columns:1fr 170px auto auto;
    gap:10px;
    align-items:center;
}

/* MENSAGENS */
.messages{
    flex:1;
    overflow-y:auto;
    padding:28px;
    scroll-behavior:smooth;
    background-color:#0b141a;
    background-image:
        radial-gradient(#ffffff08 1px,transparent 1px),
        linear-gradient(135deg,#0b141a,#0f1b22);
    background-size:18px 18px,100% 100%;
}

.day-label{
    text-align:center;
    margin:18px 0;
    position:sticky;
    top:8px;
    z-index:2;
}

.day-label span{
    background:#182229;
    color:var(--wa-muted);
    border-radius:9px;
    padding:6px 12px;
    font-size:12px;
    box-shadow:0 6px 16px #0005;
}

.bubble{
    max-width:720px;
    width:fit-content;
    margin:8px 0;
    padding:10px 12px 8px;
    border-radius:12px;
    background:var(--wa-msg2);
    box-shadow:0 1px 2px #0005;
    white-space:pre-wrap;
    word-break:break-word;
    animation:fadeIn .18s ease;
    position:relative;
}

.bubble.me{
    margin-left:auto;
    background:var(--wa-msg);
}

.bubble .text{
    line-height:1.45;
    font-size:14.5px;
}

.sender{
    font-weight:800;
    color:#7ee3c3;
    margin-bottom:5px;
    font-size:13px;
}

.bubble.me .sender{
    color:#d7f8e8;
}

.bubble .meta{
    font-size:11px;
    color:#c8d3d8;
    text-align:right;
    margin-top:6px;
    opacity:.85;
}

mark{
    background:#ffe066;
    color:#111;
    padding:0 3px;
    border-radius:4px;
}

/* MÍDIAS */
.media{
    margin-top:8px;
}

.media img{
    max-width:330px;
    max-height:420px;
    border-radius:12px;
    display:block;
    object-fit:cover;
    border:1px solid #ffffff14;
}

.media video{
    max-width:380px;
    border-radius:12px;
    display:block;
    border:1px solid #ffffff14;
}

.media audio{
    width:280px;
    max-width:100%;
}

.audio-card{
    display:flex;
    align-items:center;
    gap:10px;
    background:#111b21;
    border:1px solid #344650;
    border-radius:14px;
    padding:10px;
}

.audio-icon{
    width:38px;
    height:38px;
    border-radius:50%;
    background:#00a88422;
    display:grid;
    place-items:center;
}

.file-pill{
    display:inline-flex;
    align-items:center;
    gap:10px;
    max-width:330px;
    padding:12px 14px;
    background:#111b21;
    border:1px solid #344650;
    border-radius:14px;
    color:#e9edef;
    text-decoration:none;
}

.file-pill:hover{
    background:#1a2830;
    color:#fff;
}

.file-pill strong{
    font-size:13px;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* BOTÃO VOLTAR AO FIM */
.go-bottom{
    position:absolute;
    right:24px;
    bottom:24px;
    width:46px;
    height:46px;
    border-radius:50%;
    border:1px solid #30434d;
    background:#202c33;
    color:#e9edef;
    font-size:24px;
    display:none;
    place-items:center;
    box-shadow:0 10px 25px #0008;
    z-index:5;
}

.go-bottom.show{
    display:grid;
}

.go-bottom:hover{
    background:#263842;
}

/* EMPTY */
.empty{
    display:grid;
    place-items:center;
    align-content:center;
    height:100%;
    color:var(--wa-muted);
    text-align:center;
    padding:40px;
}

.empty h3,
.empty h4{
    color:#fff;
}

/* DASH */
.stats{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:12px;
}

.stat{
    background:#111b21;
    border:1px solid var(--wa-border);
    border-radius:18px;
    padding:18px;
}

.stat b{
    font-size:28px;
    color:#fff;
}

/* RESPONSIVO */
@media(max-width:900px){
    .app-shell{
        grid-template-columns:1fr;
    }

    .sidebar{
        display:none;
    }

    .app-shell.show-list .sidebar{
        display:flex;
        height:100vh;
    }

    .app-shell.show-list .chat-main{
        display:none;
    }

    .mobile-menu{
        display:grid;
        place-items:center;
    }

    .filters{
        grid-template-columns:1fr;
    }

    .bubble{
        max-width:92%;
    }

    .media img,
    .media video{
        max-width:100%;
    }

    .stats{
        grid-template-columns:1fr 1fr;
    }
}

@media(max-width:520px){
    .messages{
        padding:18px 12px;
    }

    .chat-header{
        padding:0 12px;
    }

    .searchbox{
        padding:10px;
    }

    .bubble{
        max-width:96%;
    }
}

/* ANIMAÇÃO */
@keyframes fadeIn{
    from{
        opacity:0;
        transform:translateY(5px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}