*{box-sizing:border-box}
body{margin:0;font:15px system-ui,sans-serif;background:#edf1f5;color:#263238}
header{display:flex;align-items:center;gap:15px;padding:15px;background:#164c43;color:white}
header a{color:white;margin-left:auto}
main{display:flex;height:calc(100dvh - 65px)}
aside{width:270px;padding:12px;background:white;border-right:1px solid #ccc;overflow:auto}
section{flex:1;min-width:0;display:flex;flex-direction:column}
h2{font-size:18px;padding:12px;margin:0;background:white}
button{cursor:pointer;border:0;border-radius:6px;padding:10px;background:#187565;color:white;margin:3px}
button:disabled{opacity:.45;cursor:default}
#rooms button{display:block;width:100%;text-align:left;background:#e9f1ef;color:#222}
#messages{flex:1;overflow:auto;padding:15px}
.bubble{background:white;border-radius:12px;padding:10px;margin:8px 0;max-width:82%;white-space:pre-wrap;overflow-wrap:anywhere}
.mine{margin-left:auto;background:#d1ead9}
small{display:block;color:#687770;margin-bottom:5px}
form{display:flex;padding:12px;background:white;gap:8px}
textarea{flex:1;resize:none;padding:10px;border:1px solid #ccc;border-radius:7px}
@media(max-width:650px){
aside{width:135px}
header{flex-wrap:wrap}
header a{margin-left:0}
.bubble{max-width:95%}
}

#tools{padding:5px;background:white}
#replybar{padding:8px;background:#dce7ed}
#typing{min-height:20px;padding:0 12px;font-size:12px}
.actions{display:flex;flex-wrap:wrap;gap:3px;margin-top:7px}
.actions button{font-size:11px;padding:5px;background:#dce7ed;color:#263238}
#contacts button{display:block;width:100%;text-align:left}
#contacts button,#rooms button{overflow-wrap:anywhere}
#messages img,#messages video{max-width:100%;max-height:350px}
#messages audio{max-width:100%}
#messages a{color:#155b99}
#replybar[hidden]{display:none}

#callpanel{
    padding:12px;
    background:#233b45;
    color:white;
    border-radius:8px;
    margin:8px
}

#callpanel[hidden],
#callpanel button[hidden]{
    display:none
}

#callvideos{
    display:flex;
    gap:8px;
    align-items:center;
    justify-content:center;
    background:#10181d;
    border-radius:8px;
    margin:8px 0;
    overflow:hidden
}

#remotevideo{
    width:70%;
    max-height:300px
}

#localvideo{
    width:25%;
    max-height:130px
}

#rejectcall,#hangupcall{
    background:#b52e35
}

#answercall{
    background:#258341
}

#conversationtools{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    padding:8px;
    align-items:center
}

#messagesearch{
    flex:1;
    min-width:150px;
    padding:8px;
    border:1px solid #adb9c0;
    border-radius:5px
}

#presenceinfo{
    font-size:12px;
    font-weight:bold
}

#searchresult{
    font-size:12px
}

.bubble[hidden]{
    display:none
}

@media(max-width:700px){

    header{
        flex-wrap:wrap
    }

    main{
        flex-direction:column
    }

    aside{
        width:auto;
        max-height:32vh;
        overflow:auto
    }

    section{
        min-width:0;
        min-height:0
    }

    #tools button,
    #conversationtools button{
        font-size:12px
    }

}

#authscreen{
    display:none;
    position:fixed;
    inset:0;
    z-index:1000;
    overflow:auto;
    padding:24px;
    background:#edf4f4;
    font-family:system-ui,sans-serif;
    color:#20343a
}

body.auth-pending #authscreen{
    display:block
}

body.auth-pending > header,
body.auth-pending > main{
    display:none!important
}

#authcard{
    box-sizing:border-box;
    width:100%;
    max-width:420px;
    padding:28px;
    margin:4vh auto;
    border-radius:20px;
    background:white;
    box-shadow:0 6px 32px #0001
}

#authcard img{
    display:block;
    width:80px;
    height:80px;
    margin:auto;
    border-radius:20px
}

#authcard h1{
    text-align:center;
    font-size:27px;
    margin:18px 0 4px
}

#authcard h2{
    text-align:center;
    font-size:20px
}

#authcard p{
    text-align:center;
    font-size:14px
}

#authcard .authsubtitle{
    color:#62777d;
    margin-bottom:24px
}

#authcard label{
    display:block;
    margin:16px 0 7px;
    font-size:14px;
    font-weight:600
}

#authcard input{
    display:block;
    box-sizing:border-box;
    width:100%;
    padding:13px;
    font-size:16px;
    border:1px solid #b9cbce;
    border-radius:9px;
    background:white;
    color:#20343a
}

#authcard button{
    display:block;
    width:100%;
    padding:13px;
    margin:14px 0 0;
    border:0;
    border-radius:9px;
    background:#166970;
    color:white;
    font-size:15px;
    font-weight:600;
    cursor:pointer
}

#authcard .authsecondary{
    background:#eaf2f2;
    color:#166970
}

#authcard button:disabled{
    opacity:.5
}

#authcard form[hidden]{
    display:none!important
}

#authstatus{
    overflow-wrap:anywhere
}

@media(max-width:480px){

    #authscreen{
        padding:14px
    }

    #authcard{
        margin:10px auto;
        padding:22px
    }

}



/* MEIN MESSENGER AUTH DESIGN V2 */

#authscreen,
#authscreen * {
    box-sizing:border-box;
}

#authscreen {
    position:fixed;
    inset:0;
    width:100%;
    overflow-x:hidden;
    overflow-y:auto;
    padding:24px 16px;
    background:linear-gradient(
        155deg,#e4f0f0,#f7fafb
    );
}

body.auth-pending #authscreen {
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:safe center!important;
}

#authcard {
    display:block!important;
    flex-shrink:0!important;
    width:100%!important;
    max-width:420px!important;
    min-width:0!important;
    margin:auto!important;
    padding:30px 24px!important;
    border-radius:24px;
    background:#fff;
    box-shadow:0 10px 40px #173c4510;
}

#authcard form:not([hidden]) {
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    justify-content:flex-start!important;
    flex-wrap:nowrap!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    gap:0!important;
    margin:0!important;
    padding:0!important;
    background:transparent!important;
    border:none!important;
}

#authcard form[hidden] {
    display:none!important;
}

#authcard img {
    display:block!important;
    width:82px!important;
    height:82px!important;
    margin:0 auto 22px!important;
    border-radius:22px;
}

#authcard h1 {
    font-size:28px;
    line-height:1.2;
    text-align:center;
    margin:0 0 10px;
    color:#20343a;
}

#authcard h2 {
    font-size:21px;
    margin:12px 0 8px;
}

#authcard p {
    display:block!important;
    width:100%!important;
    text-align:center;
    line-height:1.5;
    margin:18px 0 8px;
}

#authcard .authsubtitle {
    font-size:14px;
    color:#70858a;
    margin:0 0 24px;
}

#authcard label {
    display:block!important;
    width:100%!important;
    margin:16px 0 7px!important;
    text-align:left!important;
    font-size:14px;
    font-weight:600;
}

#authcard input {
    display:block!important;
    flex:none!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:52px!important;
    margin:0!important;
    padding:12px 15px!important;
    background:#f8fbfb;
    border:1px solid #cad9dc;
    border-radius:11px;
    font-size:16px!important;
    color:#20343a;
    outline:none;
}

#authcard input:focus {
    border-color:#166970;
    box-shadow:0 0 0 3px #16697018;
}

#authcard button {
    display:block!important;
    flex:none!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:49px;
    height:auto!important;
    white-space:normal!important;
    padding:14px 12px!important;
    margin:14px 0 0!important;
    border:0;
    border-radius:11px;
    font-size:15px;
    font-weight:600;
    text-align:center;
    background:#166970;
    color:white;
}

#authcard button[hidden] {
    display:none!important;
}

#authcard #loginbutton,
#authcard #registerbutton {
    margin-top:24px!important;
}

#authcard .authsecondary {
    background:#edf4f4!important;
    color:#166970!important;
}

#authcard #authinstall {
    background:transparent!important;
    border:1px solid #d3e1e2!important;
    color:#166970!important;
    margin-top:22px!important;
}

#authstatus:empty {
    display:none!important;
}

#authstatus:not(:empty) {
    padding:10px;
    background:#eef5f5;
    border-radius:8px;
    overflow-wrap:anywhere;
}

@media(max-width:480px) {
    #authscreen {
        padding:18px 14px!important;
    }

    #authcard {
        max-width:100%!important;
        padding:26px 22px!important;
    }
}

@media(max-height:650px) {
    body.auth-pending #authscreen {
        justify-content:flex-start!important;
    }

    #authcard {
        margin:0 auto!important;
    }
}



/* MEIN MESSENGER MODERN */

.mm-modern {
    --mm-accent:#166970;
    --mm-dark:#123f3d;
    --mm-border:#dce7e5;
    font-family:system-ui,sans-serif;
}

.mm-modern [hidden] {
    display:none!important;
}

.mm-modern header {
    background:var(--mm-dark);
    color:white;
    gap:8px;
    padding:12px;
    flex-wrap:wrap;
}

.mm-modern button {
    border-radius:10px;
    padding:10px 13px;
    font-size:14px;
    cursor:pointer;
}

.mm-modern button:disabled {
    cursor:default;
    opacity:.45;
}

.mm-navigation {
    display:flex;
    background:white;
    border-bottom:1px solid var(--mm-border);
    gap:4px;
    padding:6px;
}

.mm-navigation button {
    flex:1;
    min-width:0;
    background:#e6f1ef;
    color:var(--mm-accent);
    border:0;
}

.mm-sidebar {
    background:#fff;
    overflow-y:auto;
    padding:14px;
    min-width:0;
}

.mm-contactbox {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:8px;
    padding:12px;
    margin-bottom:16px;
    background:#edf5f3;
    border-radius:14px;
}

.mm-contactbox input {
    box-sizing:border-box;
    width:100%;
    min-width:0;
    padding:12px;
    border:1px solid #c9d8d6;
    border-radius:10px;
    font-size:16px;
}

.mm-contact-result {
    color:#345b58;
    font-size:13px;
    overflow-wrap:anywhere;
}

.mm-settings,.mm-more {
    margin-top:12px;
    border:1px solid var(--mm-border);
    background:#f8fbfa;
    border-radius:12px;
    padding:10px;
}

.mm-settings summary,.mm-more summary {
    color:var(--mm-accent);
    font-weight:600;
    cursor:pointer;
    padding:5px;
}

.mm-settings button,.mm-more button {
    margin:5px 3px;
}

.mm-chat {
    min-width:0;
    background:#edf3f0;
}

.mm-modern #messages {
    background:#edf3f0;
    padding:14px;
    overflow-y:auto;
    min-height:0;
}

.mm-modern #composer {
    display:flex;
    flex-direction:row;
    align-items:center;
    gap:8px;
    padding:10px;
    background:white;
    border-top:1px solid var(--mm-border);
}

.mm-modern #message {
    flex:1;
    width:0;
    min-width:0;
    font-family:inherit;
    font-size:16px;
    border:1px solid #cbdad7;
    border-radius:20px;
    padding:12px;
    resize:none;
}

.mm-modern #tools,
.mm-modern #conversationtools {
    padding:6px;
    gap:5px;
    background:#fff;
    flex-wrap:wrap;
}

.mm-modern #tools button,
.mm-modern #conversationtools button {
    font-size:12px;
    padding:8px;
}

@media(max-width:760px){

    body.mm-modern:not(.auth-pending) {
        height:100dvh;
        overflow:hidden;
        display:flex!important;
        flex-direction:column!important;
    }

    .mm-modern .mm-sidebar {
        width:100%!important;
        max-width:100%!important;
        max-height:none!important;
        box-sizing:border-box;
        flex:1;
        overflow:auto;
    }

    .mm-modern:not(.mm-conversation) .mm-chat {
        display:none!important;
    }

    .mm-modern.mm-conversation .mm-sidebar {
        display:none!important;
    }

    .mm-modern.mm-conversation .mm-chat {
        display:flex!important;
        flex-direction:column!important;
        width:100%!important;
        max-width:100%!important;
        flex:1;
        min-height:0;
        overflow:hidden;
    }

    .mm-modern #messages {
        flex:1;
        min-height:0;
    }

    .mm-modern #conversationtools {
        display:none;
    }

    .mm-modern #composer {
        flex-shrink:0;
    }

    .mm-modern #tools {
        flex-shrink:0;
    }

    .mm-modern .mm-navigation button {
        font-size:12px;
        padding:9px 4px;
    }
}



/* AUTOMATISCHE KONTAKTE */

#mm-directory {
    display:grid;
    gap:16px;
    padding-bottom:16px;
}

.mm-directory-section h3 {
    color:#166970;
    margin:8px 0 12px;
    font-size:16px;
}

.mm-directory-section p {
    font-size:13px;
    color:#687b79;
    line-height:1.5;
}

.mm-directory-row {
    display:flex!important;
    align-items:center;
    gap:12px;
    width:100%;
    text-align:left;
    padding:12px 8px!important;
    background:#fff!important;
    color:#183d3b!important;
    border:0!important;
    border-bottom:1px solid #e6efed!important;
}

.mm-directory-row:hover {
    background:#edf6f3!important;
}

.mm-directory-avatar {
    display:grid;
    place-items:center;
    flex:0 0 44px;
    height:44px;
    border-radius:50%;
    background:#dcefeb;
    color:#166970;
    font-size:20px;
    font-weight:600;
}

.mm-directory-info {
    display:flex;
    flex-direction:column;
    gap:4px;
    flex:1;
    min-width:0;
    overflow-wrap:anywhere;
}

.mm-directory-info small {
    font-size:12px;
    color:#72827e;
}

.mm-online-dot {
    width:10px;
    height:10px;
    border-radius:50%;
    background:#b5c0be;
    flex:none;
}

.mm-online-dot.online {
    background:#20b961;
    box-shadow:0 0 0 3px #dbf5e5;
}

.mm-directory-status {
    color:#81918d;
    font-size:11px;
}

