:root{font-family:Arial,"PingFang SC","Microsoft YaHei",sans-serif;color:#18304b;background:#edf3fa}
*{box-sizing:border-box}body{margin:0;min-height:100vh}.hidden{display:none!important}
.ambient{position:fixed;inset:0;z-index:-1;background:radial-gradient(circle at 18% 12%,#cde6ff 0,transparent 36%),radial-gradient(circle at 85% 83%,#d7d2ff 0,transparent 40%),linear-gradient(145deg,#f8fbff,#edf3fa)}
.layout{width:min(100%,1100px);margin:auto;min-height:100vh;display:flex;align-items:center;justify-content:center;gap:clamp(30px,8vw,120px);padding:40px 24px}
.brand{min-width:230px}.brand-icon,.small-logo,.placeholder-glyph{display:grid;place-items:center;color:white;background:linear-gradient(145deg,#4099ff,#4f5bdd);box-shadow:0 12px 28px #376bd03d}
.brand-icon{width:78px;height:78px;border-radius:24px;font-size:38px;font-weight:700;margin-bottom:22px}.brand-name{font-size:38px;font-weight:750;letter-spacing:3px}.brand p{font-size:16px;color:#6d829b;letter-spacing:2px}
.card{width:min(100%,420px);background:#fff;border:1px solid #e5edf6;border-radius:22px;padding:34px;box-shadow:0 20px 55px #315c951c}.eyebrow{color:#4d83e2;font-size:13px;font-weight:700;letter-spacing:2px}.card h1{font-size:27px;margin:10px 0 8px}.card-subtitle{color:#7b8ca0;margin:0 0 25px;font-size:14px}.card form{display:flex;flex-direction:column;gap:10px}.card label{font-size:13px;font-weight:650;margin-top:8px}.card input{width:100%;border:1px solid #d8e2ef;background:#f9fbfe;border-radius:11px;padding:13px 14px;font:inherit;outline:none;transition:border .2s,box-shadow .2s}.card input:focus{border-color:#5799ed;box-shadow:0 0 0 4px #6faaff24}.card button{font:inherit;cursor:pointer}.primary{border:0;border-radius:12px;padding:14px 16px;margin-top:17px;color:#fff;font-weight:700;background:linear-gradient(110deg,#278df4,#526de6);box-shadow:0 8px 18px #2772df30}.primary:disabled{opacity:.58;cursor:wait}.secondary{width:100%;border:1px solid #edc3a2;background:#fff7ee;color:#965118;border-radius:10px;padding:12px;margin-top:12px}.divider{display:flex;align-items:center;gap:13px;color:#9aa8ba;font-size:12px;margin:24px 0 13px}.divider:before,.divider:after{content:"";height:1px;background:#e8edf4;flex:1}.text-button{display:block;width:100%;padding:6px;border:0;background:none;color:#397be3;font-weight:700;text-align:center;text-decoration:none}.message{min-height:1.4em;margin:13px 0 0;color:#bb453d;font-size:13px;line-height:1.5}.message.success{color:#157b5b}
.home{height:min(760px,calc(100vh - 60px));min-height:520px;width:min(100%,1040px);display:grid;grid-template-columns:320px 1fr;overflow:hidden;background:#fff;border:1px solid #dfe9f4;border-radius:20px;box-shadow:0 20px 55px #315c951c}.sidebar{background:#f8fbff;border-right:1px solid #e7eef8;overflow:auto}.sidebar-top{display:flex;align-items:center;gap:12px;padding:20px 18px;border-bottom:1px solid #e4ecf6}.small-logo{width:40px;height:40px;border-radius:13px;font-size:22px;font-weight:700;flex:none}.sidebar-top strong{font-size:17px}.sidebar-top small{display:block;color:#8295aa;font-size:12px;margin-top:3px}.logout{margin-left:auto;background:none;border:0;color:#5478aa;cursor:pointer}.search-title{padding:24px 20px 9px;color:#8a9bad;font-weight:700;font-size:12px;letter-spacing:1px}.users-list{list-style:none;margin:0;padding:0 8px 20px}.users-list li{display:flex;align-items:center;gap:12px;padding:12px;border-radius:12px}.users-list li:hover{background:#edf5ff}.avatar{position:relative;display:grid;place-items:center;flex:none;width:42px;height:42px;border-radius:15px;background:#dceafd;color:#3161a7;font-weight:700}.avatar:after{content:"";position:absolute;right:-2px;bottom:-2px;width:10px;height:10px;border:2px solid #fff;border-radius:50%;background:#c4cfda}.avatar.online:after{background:#37be83}.person{font-weight:650}.person small{display:block;font-weight:400;color:#8a9cad;font-size:12px;margin-top:4px}.placeholder{display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:30px}.placeholder-glyph{width:90px;height:90px;border-radius:30px;font-size:42px;font-weight:700;opacity:.78}.placeholder h1{font-size:23px;margin:24px 0 3px}.placeholder p{color:#71849b}.placeholder small{color:#99a8b9}
@media(max-width:760px){.layout{padding:22px 15px;flex-direction:column;gap:20px}.brand{min-width:unset;text-align:center}.brand-icon{width:56px;height:56px;margin:0 auto 8px;border-radius:18px;font-size:28px}.brand-name{font-size:26px}.brand p{font-size:13px;margin:7px 0}.card{padding:27px 23px}.home{height:calc(100vh - 30px);min-height:460px;grid-template-columns:45% 55%;border-radius:15px}.sidebar-top{padding:13px 9px;gap:6px}.sidebar-top strong{font-size:13px}.small-logo{width:32px;height:32px;border-radius:10px;font-size:19px}.search-title{padding:18px 9px 8px}.users-list{padding:0 3px}.users-list li{padding:9px 6px;gap:7px}.avatar{width:34px;height:34px;border-radius:11px}.person{font-size:12px}.logout{font-size:11px}.placeholder h1{font-size:17px}.placeholder p{font-size:12px}.placeholder-glyph{width:55px;height:55px;border-radius:18px;font-size:27px}}
.users-list li{cursor:pointer}.users-list li.active{background:#e4f0ff}
.chat-panel{display:flex;flex-direction:column;min-width:0;min-height:0;background:#f7faff}
.chat-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 22px;border-bottom:1px solid #e1ebf7;background:#fff}
.chat-head h1{font-size:15px;margin:0 0 4px}.chat-head p{font-size:13px;margin:0;color:#7890a7}.lock-label{flex:none;color:#287b68;font-size:12px}
.chat-alert{margin:10px 15px 0;padding:10px 12px;border-radius:9px;background:#fff2e8;color:#93451c;font-size:12px;line-height:1.5}
.chat-messages{flex:1;min-height:0;overflow:auto;list-style:none;margin:0;padding:20px;display:flex;flex-direction:column;gap:12px}
.bubble{max-width:85%;align-self:flex-start;padding:10px 12px;border-radius:14px;background:#fff;box-shadow:0 2px 8px #24436712;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px}
.bubble.mine{align-self:flex-end;color:#fff;background:#468cf0}.bubble small{display:block;text-align:right;font-size:10px;margin-top:5px;color:#8d9fb4}.bubble.mine small{color:#e3eeff}
.chat-compose{border-top:1px solid #e2eaf5;background:#fff;padding:12px 16px;display:flex;flex-direction:column;gap:7px}.chat-compose label{font-size:12px;color:#68809b}
.chat-compose textarea{width:100%;resize:none;border:1px solid #dbe6f3;border-radius:9px;padding:10px;font:inherit;outline:none}.chat-compose textarea:focus{border-color:#5799ed}
.chat-compose button{align-self:flex-end;margin:0;padding:9px 22px;font:inherit;cursor:pointer}.chat-compose button:disabled{opacity:.55;cursor:default}
.compose-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.chat-compose .compose-actions .image-pick{font-size:12px;max-width:100%}.compose-actions input[type=file]{font-size:12px;min-width:0;max-width:240px;color:#607995}.chat-compose .compose-actions button{border:1px solid #c9dbf4;border-radius:9px;background:#f5f9ff;color:#3168b6;padding:7px 11px;white-space:nowrap}.chat-image{display:block;max-width:min(320px,72vw);max-height:340px;width:auto;height:auto;border-radius:9px;object-fit:contain}.bubble:has(.chat-image){padding:6px}
@media(max-width:760px){.chat-head{padding:12px}.chat-head h1{font-size:12px}.chat-head p,.lock-label{font-size:10px}.chat-messages{padding:10px}.chat-compose{padding:8px}.chat-compose textarea{font-size:12px}.chat-alert{margin:6px;padding:7px;font-size:11px}}
.sidebar-form{padding:4px 15px 15px}.sidebar-form label,.group-tools label{display:block;font-size:12px;color:#68809b;margin:6px 0}
.sidebar-form input,.group-tools input,.group-tools select{width:100%;font:inherit;font-size:13px;border:1px solid #dbe6f3;border-radius:9px;padding:9px;background:#fff}
.sidebar-form button,.group-tools button,.invite-list button{font:inherit;font-size:12px;background:#e8f1ff;color:#2f69bf;border:0;border-radius:8px;padding:8px 12px;margin-top:8px;cursor:pointer}
.sidebar-form button:disabled,.group-tools button:disabled,.invite-list button:disabled{opacity:.5;cursor:default}
.sidebar-hint{color:#7a90a8;font-size:11px;padding:0 15px 18px;line-height:1.5;margin:0}
.invite-list{list-style:none;padding:0 15px;margin:0}.invite-list li{border:1px solid #deebfa;border-radius:10px;padding:10px;margin-bottom:8px;font-size:12px;background:white}
.invite-list small,.invite-list strong{display:block}.invite-list small{color:#8295aa;margin-top:4px}.invite-list button+button{margin-left:6px}
.group-tools{padding:15px 22px;overflow:auto;flex:1;color:#334e69;font-size:13px}
.group-tools p:first-child{margin:0 0 15px;color:#815926;background:#fff6e7;padding:11px;border-radius:9px;line-height:1.6}
.group-members{padding-left:20px;line-height:1.8}.group-tools form{margin:18px 0;max-width:430px}
.group-tools .message{margin-top:12px}.group-tools button{display:block}
@media(max-width:760px){.sidebar-form{padding:4px 7px 12px}.sidebar-hint{padding:0 7px 12px}.invite-list{padding:0 7px}.group-tools{padding:12px}.group-tools form{margin:12px 0}}

/* The authenticated workspace fills the viewport. Lists and group controls open as drawers. */
body.chat-active{height:100vh;height:100dvh;overflow:hidden}
body.chat-active .layout{width:100%;height:100%;min-height:0;padding:0;gap:0}
body.chat-active .brand{display:none}
.home{position:relative;display:block;width:100%;height:100%;min-height:0;max-width:none;border:0;border-radius:0;box-shadow:none}
.chat-panel{position:relative;width:100%;height:100%;min-height:0;overflow:hidden}
.chat-head{flex:none;min-height:68px;padding:12px 18px;padding-top:max(12px,env(safe-area-inset-top));gap:12px;box-shadow:0 2px 12px #224c7410;z-index:1}
.chat-title{flex:1;min-width:0}
.chat-title h1{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0 0 5px}
.lock-label{display:block;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.header-action{flex:none;border:1px solid #d8e5f5;border-radius:10px;padding:9px 12px;background:#f5f9ff;color:#376ab3;font:inherit;font-size:13px;font-weight:700;cursor:pointer;white-space:nowrap}
.header-action[aria-expanded="true"]{background:#e3f0ff;border-color:#97bfea}
.drawer-scrim,.group-tools-scrim{position:absolute;inset:0;z-index:19;width:100%;height:100%;border:0;background:#102c4d77;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s ease,visibility .18s ease;cursor:pointer}
.home.contacts-open .drawer-scrim{opacity:1;visibility:visible;pointer-events:auto}
.sidebar{position:absolute;z-index:20;inset:0 auto 0 0;width:min(86vw,360px);height:100%;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);background:#f8fbff;border:0;border-right:1px solid #d9e5f2;box-shadow:12px 0 38px #162e4b27;transform:translateX(-105%);visibility:hidden;pointer-events:none;transition:transform .22s ease,visibility .22s ease;overscroll-behavior:contain}
.home.contacts-open .sidebar{transform:translateX(0);visibility:visible;pointer-events:auto}
.sidebar-top{position:sticky;top:0;z-index:1;background:#f8fbff;justify-content:space-between;gap:8px}
.sidebar-top strong{font-size:16px}.sidebar-top small{font-size:12px;overflow-wrap:anywhere}
.drawer-close,.group-tools-head button{border:0;background:none;color:#59728c;font-size:27px;line-height:1;cursor:pointer;padding:6px}
.logout{margin-left:0;white-space:nowrap}
.sidebar-form button,.invite-list button{min-height:36px}
#mls-publish{margin:0 15px 12px;padding:9px 12px;min-height:36px;border:0;border-radius:9px;background:#e8f1ff;color:#2f69bf;font:inherit;font-size:12px;cursor:pointer}
.chat-messages{min-width:0;overflow-x:hidden;overscroll-behavior:contain}
.bubble{min-width:0;overflow-wrap:anywhere}
.bubble.image-bubble{max-width:min(90%,480px);width:fit-content;padding:6px}
.bubble.image-bubble .chat-image{display:block;width:auto;max-width:100%;max-height:min(55vh,560px);max-height:min(55dvh,560px);height:auto;border-radius:9px;object-fit:contain;cursor:zoom-in}
.chat-compose{flex:none;padding-bottom:max(12px,env(safe-area-inset-bottom));box-shadow:0 -3px 14px #224c7410;z-index:1}
.chat-compose textarea{max-height:120px}
.chat-panel.group-tools-open .group-tools-scrim{opacity:1;visibility:visible;pointer-events:auto}
.group-tools{position:absolute;z-index:21;inset:0 0 0 auto;width:min(90vw,400px);height:100%;padding:0 20px 28px;padding-bottom:max(28px,env(safe-area-inset-bottom));overflow:auto;flex:none;background:#fff;border:0;border-left:2px solid #c9dff5;box-shadow:-12px 0 38px #162e4b27;transform:translateX(105%);visibility:hidden;pointer-events:none;transition:transform .22s ease,visibility .22s ease;overscroll-behavior:contain}
.chat-panel.group-tools-open .group-tools{transform:translateX(0);visibility:visible;pointer-events:auto}
.group-tools-head{position:sticky;top:0;z-index:1;display:flex;justify-content:space-between;align-items:center;background:#fff;border-bottom:1px solid #e2ebf6;padding:17px 0;margin-bottom:15px}
.group-tools-head h2{font-size:17px;margin:0;color:#203b5a}
.group-tools p:first-of-type{margin:0 0 14px;color:#815926;background:#fff6e7;padding:11px;border-radius:9px;line-height:1.6}
.group-tools form{max-width:none;padding:14px 0;margin:18px 0;border-top:1px solid #e5edf6}
.group-tools #group-invite-form{padding:16px;border:1px solid #d6e5f6;border-radius:14px;background:#f6faff}
.group-tools form label{font-size:13px;font-weight:700;color:#344e6c}
.group-tools>button,.group-tools form button,.group-members button{min-height:36px}
.group-members{padding-left:22px;line-height:1.9}
.image-viewer{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;padding:60px 16px 24px;background:#061528ec}
.image-viewer img{display:block;max-width:100%;max-height:100%;object-fit:contain}
.image-viewer-close{position:absolute;top:max(12px,env(safe-area-inset-top));right:16px;width:42px;height:42px;border:0;border-radius:50%;background:#ffffff25;color:#fff;font-size:29px;cursor:pointer}
@media(max-width:760px){
  .home{height:100%;min-height:0;border-radius:0}
  .chat-head{padding:10px 12px;padding-top:max(10px,env(safe-area-inset-top));min-height:64px;gap:8px}
  .chat-title h1{font-size:15px}.lock-label{font-size:11px}
  .header-action{padding:9px 10px;font-size:12px}.header-action span{display:none}
  .chat-messages{padding:14px 12px;gap:12px}
  .bubble{max-width:86%;font-size:14px}
  .bubble.image-bubble{max-width:90%}
  .chat-compose{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"input send" "actions actions";align-items:stretch;gap:8px;padding:9px 12px;padding-bottom:max(10px,env(safe-area-inset-bottom))}
  .chat-compose>label{display:none}
  .chat-compose textarea{grid-area:input;min-height:58px;height:58px;font-size:14px}
  .chat-compose>.primary{grid-area:send;margin:0;align-self:stretch;padding:8px 16px;box-shadow:none}
  .compose-actions{grid-area:actions;min-width:0;gap:8px}
  .chat-compose .compose-actions .image-pick{font-size:12px}
  .compose-actions input[type=file]{max-width:160px;font-size:11px}
  .chat-compose .compose-actions button{margin:0;font-size:12px}
  .sidebar-top{padding:14px 12px}.sidebar-top strong{font-size:15px}
  .sidebar-form{padding:8px 15px 16px}.sidebar-hint{padding:0 15px 20px}.invite-list{padding:0 15px}
  .group-tools{padding:0 17px 24px;padding-bottom:max(24px,env(safe-area-inset-bottom))}
}
@media(prefers-reduced-motion:reduce){.sidebar,.group-tools,.drawer-scrim,.group-tools-scrim{transition:none}}
