*{box-sizing:border-box}body{margin:0;background:#eef1f5;color:#222;font:14px Arial,sans-serif}.app{max-width:1200px;margin:25px auto;background:#fff;border:1px solid #d7dce2;border-radius:8px;overflow:hidden;box-shadow:0 3px 16px #0001}header{height:52px;background:#26384d;color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 18px}.brand{font-size:20px;font-weight:bold}.top-user a{color:#fff;text-decoration:none;margin-left:15px}main{display:grid;grid-template-columns:235px 1fr;height:680px}aside{border-right:1px solid #ddd;background:#f7f8fa;overflow:auto}.side-title{font-weight:bold;padding:14px;border-bottom:1px solid #e0e3e7}.room,.member{padding:11px 14px;border-bottom:1px solid #e7e9ec;cursor:pointer}.room:hover,.member:hover{background:#e9eef5}.room.active{background:#dce9f8;font-weight:bold}.online{display:inline-block;width:8px;height:8px;background:#39a852;border-radius:50%;margin-right:7px}.chat{display:flex;flex-direction:column;min-width:0}.chat-head{height:48px;border-bottom:1px solid #ddd;padding:15px 18px}.chat-head span{float:right;color:#888;font-size:12px}.messages{flex:1;overflow:auto;padding:14px 18px;background:#fff}.msg{margin:0 0 12px}.msg .meta{font-size:12px;color:#718096;margin-bottom:3px}.msg .meta b{color:#2d5d91}.msg .body{white-space:pre-wrap;word-break:break-word;background:#f4f6f8;border-radius:7px;padding:8px 10px;display:inline-block;max-width:90%}.msg.me .body{background:#e7f1ff}.msg .actions{display:inline-block;margin-left:8px}.msg .actions button{font-size:11px;border:0;background:none;color:#b33;cursor:pointer}form#send{display:flex;border-top:1px solid #ddd;padding:10px;gap:8px}#body{flex:1;resize:none;height:58px;border:1px solid #ccd3dc;border-radius:6px;padding:10px;font:14px Arial}#send button{width:80px;border:0;border-radius:6px;background:#2d6da3;color:white;font-weight:bold}.admin{padding:20px}.admin table{width:100%;border-collapse:collapse}.admin th,.admin td{padding:9px;border:1px solid #ddd;text-align:left}.admin input,.admin select{padding:7px;border:1px solid #ccc;border-radius:4px}@media(max-width:700px){.app{margin:0;border-radius:0}main{grid-template-columns:145px;height:calc(100vh - 52px)}aside{font-size:12px}.messages{padding:10px}.msg .body{max-width:100%}}
/* Compact chat composer */
form#send{display:block;flex:0 0 auto;margin:0;padding:8px 10px 10px;border-top:1px solid #ddd;background:#fff}
.send-row{display:flex;align-items:flex-end;gap:8px}
.input-wrap{position:relative;flex:1;min-width:0;border:1px solid #ccd3dc;border-radius:7px;background:#fff}
.input-wrap #body{display:block;width:100%;height:58px;min-height:58px;max-height:120px;margin:0;border:0;outline:0;border-radius:7px;padding:9px 10px 32px;resize:vertical;font:14px Arial,sans-serif}
.chat-tools{position:absolute;left:5px;bottom:4px;display:flex;gap:2px;z-index:20}
.chat-tool{width:29px;height:25px;padding:0;border:0;border-radius:5px;background:transparent;color:#555;cursor:pointer;font-size:17px}
.chat-tool:hover{background:#eef2f6}
.smile-wrap{position:relative}
.emoji-panel{display:none;position:absolute;left:0;bottom:31px;width:290px;max-height:210px;overflow-y:auto;background:#fff;border:1px solid #ccd3dc;border-radius:7px;padding:7px;box-shadow:0 4px 18px rgba(0,0,0,.16);z-index:9999}
.emoji-panel.show{display:grid;grid-template-columns:repeat(8,1fr);gap:2px}
.emoji-btn{border:0;background:transparent;font-size:21px;line-height:29px;padding:2px;border-radius:5px;cursor:pointer}
.emoji-btn:hover{background:#eef2f6}
.send-btn{flex:0 0 72px;height:58px;border:0;border-radius:7px;background:#2d6da3;color:#fff;font-weight:bold;cursor:pointer}
.send-btn:hover{background:#255d8c}
.upload-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:20000;align-items:center;justify-content:center;padding:20px}
.upload-modal.show{display:flex}
.upload-box{position:relative;width:min(900px,96vw);height:min(700px,90vh);background:#fff;border-radius:9px;overflow:hidden;box-shadow:0 8px 35px rgba(0,0,0,.3)}
.upload-title{height:44px;line-height:44px;padding:0 45px 0 15px;font-weight:bold;border-bottom:1px solid #ddd}
.upload-box iframe{display:block;width:100%;height:calc(100% - 44px);border:0}
.upload-close{position:absolute;right:8px;top:7px;width:30px;height:30px;border:0;border-radius:5px;background:transparent;color:#555;font-size:25px;line-height:28px;cursor:pointer;z-index:2}
.upload-close:hover{background:#eee}
@media(max-width:700px){.send-btn{flex-basis:58px}.emoji-panel{width:270px}.upload-box{width:98vw;height:92vh}}

/* Fixed chat layout: messages scroll, composer always stays visible */
main{min-height:0}
.chat{min-width:0;min-height:0;height:100%;overflow:hidden}
.messages{min-height:0;overflow-y:auto;overflow-x:hidden;flex:1 1 auto}
form#send{display:block;flex:0 0 auto;height:auto;min-height:0;margin:0;padding:8px 10px 10px;border-top:1px solid #ddd;background:#fff}
.send-row{display:flex;align-items:flex-end;gap:8px;min-width:0}
.input-wrap{position:relative;flex:1 1 auto;min-width:0;border:1px solid #ccd3dc;border-radius:7px;background:#fff}
.input-wrap #body{display:block;width:100%;height:58px;min-height:58px;max-height:58px;margin:0;border:0;outline:0;border-radius:7px;padding:8px 10px 31px;resize:none;overflow-y:auto;font:14px Arial,sans-serif}
.chat-tools{position:absolute;left:5px;bottom:4px;display:flex;gap:2px;z-index:20}
.chat-tool{width:29px;height:25px;padding:0;border:0;border-radius:5px;background:transparent;color:#555;cursor:pointer;font-size:17px}
.chat-tool:hover{background:#eef2f6}
.smile-wrap{position:relative}
.emoji-panel{display:none;position:absolute;left:0;bottom:31px;width:290px;max-height:210px;overflow-y:auto;background:#fff;border:1px solid #ccd3dc;border-radius:7px;padding:7px;box-shadow:0 4px 18px rgba(0,0,0,.16);z-index:9999}
.emoji-panel.show{display:grid;grid-template-columns:repeat(8,1fr);gap:2px}
.emoji-btn{border:0;background:transparent;font-size:21px;line-height:29px;padding:2px;border-radius:5px;cursor:pointer}
.emoji-btn:hover{background:#eef2f6}
.send-btn{flex:0 0 72px;width:72px;height:58px;border:0;border-radius:7px;background:#2d6da3;color:#fff;font-weight:bold;cursor:pointer}
.send-btn:hover{background:#255d8c}
.upload-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:20000;align-items:center;justify-content:center;padding:20px}
.upload-modal.show{display:flex}
.upload-box{position:relative;width:min(900px,96vw);height:min(700px,90vh);background:#fff;border-radius:9px;overflow:hidden;box-shadow:0 8px 35px rgba(0,0,0,.3)}
.upload-title{height:44px;line-height:44px;padding:0 45px 0 15px;font-weight:bold;border-bottom:1px solid #ddd}
.upload-box iframe{display:block;width:100%;height:calc(100% - 44px);border:0}
.upload-close{position:absolute;right:8px;top:7px;width:30px;height:30px;border:0;border-radius:5px;background:transparent;color:#555;font-size:25px;line-height:28px;cursor:pointer;z-index:2}
.upload-close:hover{background:#eee}
@media(max-width:700px){
 main{grid-template-columns:145px;height:calc(100vh - 52px)}
 .chat{height:100%;min-height:0}
 .messages{min-height:0}
 .send-btn{flex-basis:58px;width:58px}
 .emoji-panel{width:270px}
 .upload-box{width:98vw;height:92vh}
}

/* Delete cross */
.msg .actions button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:16px;
    height:16px;
    margin-left:4px;
    padding:0;
    border:0;
    background:transparent;
    color:#d22;
    font:bold 16px/16px Arial,sans-serif;
    cursor:pointer;
    opacity:.85;
}
.msg .actions button:hover{color:#a00;opacity:1}

/* Tiny red delete cross */
.msg .actions button,
.msg .meta .delete-msg{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
    width:15px !important;
    height:15px !important;
    margin-left:5px !important;
    padding:0 !important;
    border:0 !important;
    background:transparent !important;
    color:#e00000 !important;
    font:bold 16px/15px Arial,sans-serif !important;
    cursor:pointer;
    vertical-align:middle;
    opacity:.9;
}
.msg .actions button:hover,
.msg .meta .delete-msg:hover{
    color:#a80000 !important;
    opacity:1;
}

.msg .meta .delete-msg{
 display:inline-flex!important;align-items:center;justify-content:center;
 width:15px!important;height:15px!important;margin-left:4px!important;
 padding:0!important;border:0!important;background:transparent!important;
 color:#e00000!important;font:bold 16px/15px Arial,sans-serif!important;
 cursor:pointer;vertical-align:middle;opacity:.9
}
.msg .meta .delete-msg:hover{color:#a00000!important;opacity:1}


.chat-link{color:#06c;text-decoration:underline;cursor:pointer;}
.chat-link:hover{text-decoration:underline;}
