:root{
	--bg:#ffffff;
	--sent-bg:#0078d4; /* blue for sender */
	--sent-color:#fff;
	--recv-bg:#f0f0f0; /* greyish for receiver */
	--recv-color:#111;
	--muted:#6b6b6b;
	--max-width:900px;
}

*{box-sizing:border-box;font-family:Segoe UI, Roboto, Helvetica, Arial, sans-serif}
body{margin:0;background:var(--bg);display:flex;flex-direction:column;min-height:100vh}
.chat-header{background:#101820;color:#fff;padding:12px 16px;font-size:16px;display:flex;align-items:center;justify-content:space-between}
.chat-header .header-left{display:flex;align-items:flex-start;gap:12px}
.chat-header .brand{font-size:20px;font-weight:800}
.chat-header .header-date{font-size:13px;color:var(--recv-color);margin-top:4px}
.header-right{display:flex;align-items:center;gap:8px}
.header-right button{padding:8px 10px;border-radius:6px;border:none;background:#0a84ff;color:#fff;cursor:pointer}
.header-right button[title]{width:36px;height:36px;padding:0;display:inline-flex;align-items:center;justify-content:center}

/* maximized chat */
.chat-app.maximized{position:fixed;inset:0;max-width:none;margin:0;padding:18px;background:#fff;z-index:9999;border-radius:0}
.chat-app.maximized .chat-window{min-height:0;height:calc(100vh - 240px)}
.chat-app.maximized .dump textarea{min-height:120px}
.chat-app{max-width:var(--max-width);margin:18px auto;padding:12px;flex:1;display:flex;flex-direction:column;gap:12px}
.chat-title{font-weight:700;font-size:18px;color:#222}
.chat-window{border:1px solid #e6e6e6;border-radius:8px;padding:12px;overflow:auto;background:#fafafa;display:flex;flex-direction:column;gap:8px;flex:1;min-height:320px}
.message{max-width:75%;margin:0;padding:10px;border-radius:12px;display:flex;flex-direction:column}
.message .meta{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:12px;color:var(--muted);gap:8px}
.message .meta .username{font-weight:600;color:inherit}
.message .meta .ts{font-size:11px;color:var(--muted)}
.message .body{white-space:pre-wrap}
.message.sent{background:var(--sent-bg);color:var(--sent-color);align-self:flex-end;border-bottom-right-radius:2px;border-bottom-left-radius:12px}
.message.received{background:var(--recv-bg);color:var(--recv-color);align-self:flex-start;border-bottom-left-radius:2px;border-bottom-right-radius:12px}

.message-form{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.message-form input,.message-form textarea,.message-form select{padding:8px;border:1px solid #ddd;border-radius:6px}
.message-form textarea{min-width:240px;min-height:60px;flex:1}
.message-form button{padding:10px 14px;background:#0a84ff;color:#fff;border:none;border-radius:6px;cursor:pointer}

.dump{display:flex;flex-direction:column;gap:8px}
.dump textarea{min-height:80px;padding:8px;border:1px solid #e0e0e0;border-radius:6px}
.dump-actions{display:flex;gap:8px}
.dump-actions button{padding:8px 12px;border-radius:6px;border:1px solid #ccc;background:#fff;cursor:pointer}

.chat-footer{text-align:center;padding:12px 8px;color:var(--muted);font-size:14px;border-top:1px solid #eee}

@media (max-width:600px){
	.message{max-width:90%}
	.chat-window{height:320px}
	.message-form textarea{min-width:160px}
}

/* accessibility focus styles */
button:focus, input:focus, textarea:focus, select:focus{outline:2px solid rgba(10,132,255,0.25);outline-offset:2px}
