/* Chat-only layout: no changes to other pages or access rules. */
body:has(#hgChat.active){padding-bottom:0}
body:has(#hgChat.active)>header,body:has(#hgChat.active)>.deployProof{display:none}
body:has(#hgChat.active)>main{padding:0 10px;max-width:960px}
body:has(#hgChat.active)>nav.hgNav{height:calc(62px + env(safe-area-inset-bottom));min-height:0;padding:3px 6px calc(3px + env(safe-area-inset-bottom))}
body:has(#hgChat.active)>nav.hgNav button{min-height:50px;height:50px;padding:2px;font-size:14px;gap:0}
body:has(#hgChat.active)>nav.hgNav button i{font-size:23px;line-height:25px}
body:has(#hgChat.active)>nav.hgNav button span{font-size:14px;line-height:20px}
#hgChat.active{display:flex;flex-direction:column;height:calc(100vh - 62px - env(safe-area-inset-bottom));height:calc(100dvh - 62px - env(safe-area-inset-bottom));min-height:360px;padding:6px 0 0}
#hgChat .hgChatTop{display:flex;align-items:center;gap:6px;flex:none}
#hgChat .hgChatTop>button{padding:6px 8px;min-height:44px;white-space:nowrap}
#hgChat #hgChatTitle{flex:1;min-width:0;font-size:18px;line-height:1.3;margin:0;overflow-wrap:anywhere;font-family:inherit}
#hgChat .hgChatTools{position:relative;flex:none}
#hgChat .hgChatTools>summary{list-style:none;cursor:pointer;font-size:26px;line-height:44px;width:44px;text-align:center}
#hgChat .hgChatTools>summary::-webkit-details-marker{display:none}
#hgChat .hgChatTools>div{position:absolute;right:0;top:44px;z-index:12;width:205px;padding:10px;background:#fffdf7;border:1px solid #d5d8dd;border-radius:10px;box-shadow:0 5px 20px #10294f22}
#hgChat .hgChatTools button{display:block;width:100%;margin-top:6px}
#hgChat .hgChatTools small{font-size:14px;line-height:1.5}
#hgChat #hgChatStatus{font-size:14px;line-height:1.4;min-height:0;margin:3px 0}
#hgChat #hgChatStatus:empty{display:none}
#hgChat>.hgGroupActions{display:flex;flex-wrap:wrap;gap:4px;margin:2px 0}
#hgChat>.hgGroupActions button{min-height:36px;font-size:14px;padding:4px 8px}
#hgChat .hgChatRows{flex:1;min-height:120px;height:auto;max-height:none;padding:6px;border-radius:10px;scrollbar-gutter:auto}
#hgChat .hgChatMessage{max-width:96%;padding:3px 9px 6px;margin-bottom:5px;border-radius:10px}
#hgChat .hgChatMeta{display:flex;flex-wrap:nowrap;align-items:center;gap:6px;min-height:34px;line-height:1.3;font-size:14px}
#hgChat .hgChatMeta strong{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
#hgChat .hgChatMeta time{font-size:12px;white-space:nowrap;margin-left:auto}
#hgChat button.hgChatMore{flex:none;min-height:34px;min-width:38px;padding:0 5px;border:0;background:transparent;font-size:24px;line-height:1}
#hgChat .hgChatBody{font-size:17px;line-height:1.45;margin:0}
#hgChat .hgChatMessage>.hgGroupMuted{margin:2px 0;font-size:14px}
#hgChat .hgChatMessage blockquote{font-size:14px;line-height:1.4;margin:0 0 4px;padding:3px 7px}
#hgChat .hgChatAttachment{font-size:15px;min-height:36px;padding:5px 8px}
#hgChat .hgChatComposer{flex:none;padding:5px 0 0;margin:0}
#hgChat .hgChatComposer textarea{display:block;min-height:42px;max-height:100px;line-height:1.4;padding:8px 10px;font-size:17px;resize:vertical}
#hgChat .hgChatComposeActions{gap:4px;margin-top:3px;align-items:center}
#hgChat .hgChatComposeActions>button,#hgChat .hgChatComposeActions>details>summary{min-height:40px;padding:6px 10px;font-size:15px}
#hgChat .hgChatDraft{max-height:82px;overflow:auto;font-size:14px;gap:3px;line-height:1.4}
#hgChat .hgChatDraft button{min-height:36px;padding:3px 6px;font-size:14px}
#hgChat #hgChatMute{font-size:14px;line-height:1.4;margin:3px 0}
.hgChatSrOnly{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:360px){#hgChat .hgChatMeta{font-size:13px;gap:3px}#hgChat .hgChatMeta time{font-size:11px}#hgChat #hgChatTitle{font-size:16px}}

/* Dense rows; reset inherited details spacing that inflated header and composer. */
#hgChat.active{min-height:0;margin:0;gap:0;overflow:hidden}
#hgChat .hgChatTop{margin:0;padding:0;min-height:44px}
#hgChat .hgChatTools,#hgChat .hgChatComposeActions>details{margin:0;padding:0;border:0}
#hgChat .hgChatTools>summary{margin:0;padding:0;border:0;min-height:44px}
#hgChat>.hgGroupActions:not(:has(button:not([hidden]))){display:none}
#hgChat .hgChatRows{padding:2px 0;border:0;border-radius:0;background:transparent;min-height:0}
#hgChat .hgChatDay{font-size:12px;line-height:24px;text-align:center;color:#657080;margin:3px 0;background:#efece3;border-radius:4px}
#hgChat .hgChatMessage{display:grid;grid-template-columns:35px 5em minmax(0,1fr) 30px;align-items:center;gap:5px;width:100%;max-width:100%;min-height:44px;margin:0;padding:0 4px;border:0;border-bottom:1px solid #e5e2d8;border-radius:0;font-size:14px;background:#fffdf8}
#hgChat .hgChatMessage.hgChatMine{margin:0;background:#fff5d3}
#hgChat .hgChatTime{font-size:11px;color:#657080;white-space:nowrap;font-variant-numeric:tabular-nums}
#hgChat .hgChatName{min-width:0;font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#hgChat .hgChatContent{display:flex;align-items:center;gap:4px;min-width:0;overflow:hidden}
#hgChat button.hgChatBody{display:block;flex:1;min-width:0;min-height:44px;padding:7px 0;margin:0;border:0;border-radius:0;background:transparent;color:inherit;text-align:left;font-size:16px;font-weight:400;line-height:1.4;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
#hgChat button.hgChatBody:empty{display:none}
#hgChat .hgChatAttachment{flex:0 1 auto;max-width:55%;min-height:40px;padding:4px 5px;font-size:13px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;border:0;background:#eaf0f2}
#hgChat .hgChatBody:empty+.hgChatAttachment{max-width:100%}
#hgChat button.hgChatMore{min-height:44px;min-width:30px;width:30px;padding:0;font-size:22px}
#hgChat .hgChatRemoved{font-size:13px;color:#657080;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#hgChat .hgChatComposer{padding:4px 0 0;margin:0;border:0}
#hgChat .hgChatInputLine{display:flex;gap:5px;align-items:flex-end}
#hgChat .hgChatInputLine textarea{flex:1;min-width:0;width:0;height:44px;min-height:44px;max-height:100px;margin:0;padding:9px;font-size:16px;border-radius:6px}
#hgChat #hgChatSend{flex:none;min-height:44px;margin:0;padding:6px 10px;font-size:15px}
#hgChat .hgChatComposeActions{margin:0;padding:0;gap:4px;flex-wrap:nowrap}
#hgChat .hgChatComposeActions>button,#hgChat .hgChatComposeActions>details>summary{min-height:40px;margin:0;padding:4px 8px;font-size:14px;border:0}
#hgChat .hgChatComposeActions>details{position:relative}
#hgChat .hgChatEmoji{position:absolute;bottom:100%;left:0;z-index:12;width:220px;padding:8px;background:#fffdf8;border:1px solid #d5d8dd;border-radius:6px;box-shadow:0 5px 20px #10294f22}
#hgChat .hgChatEmoji button{min-width:44px;min-height:44px;padding:4px;font-size:20px}
#hgChatActions #hgChatActionContent{max-height:55dvh;overflow:auto;overflow-wrap:anywhere}
#hgChatActionContent time{font-size:13px;color:#657080}
#hgChatActionContent p,#hgChatActionContent blockquote{white-space:pre-wrap;font-size:17px;line-height:1.5;margin:8px 0}
#hgChatActionContent blockquote{border-left:3px solid #d8b855;padding-left:8px;color:#657080;font-size:14px}
#hgChatActionContent button{max-width:100%;white-space:normal;overflow-wrap:anywhere}
@media(max-width:350px){#hgChat .hgChatMessage{grid-template-columns:32px 5em minmax(0,1fr) 28px;gap:3px;font-size:13px}#hgChat .hgChatName{font-size:13px}#hgChat button.hgChatMore{width:28px;min-width:28px}}

/* v10.13.14: readable text and a composer inside the visible phone viewport. */
body:has(#hgChat.active){overflow:hidden;min-height:0;height:100dvh}
body:has(#hgChat.active)>main{position:fixed;top:var(--hg-chat-top,0px);left:0;right:0;width:100%;height:calc(var(--hg-chat-height,100dvh) - 62px - env(safe-area-inset-bottom));overflow:hidden;padding:0 10px}
body:has(#hgChat.active)>nav.hgNav{top:calc(var(--hg-chat-top,0px) + var(--hg-chat-height,100dvh) - 62px - env(safe-area-inset-bottom));bottom:auto}
#hgChat.active{height:100%;min-height:0;padding-top:6px}
#hgChat .hgChatRows{flex:1 1 0;min-height:0;overflow:auto;scroll-padding-block:8px}
#hgChat .hgChatTop,#hgChat>.hgGroupActions,#hgChatStatus{flex-shrink:0}
#hgChat #hgChatTitle{font-size:20px}
#hgChat .hgChatMessage{grid-template-columns:42px 80px minmax(0,1fr) 44px;gap:6px;min-height:52px;padding:2px 4px}
#hgChat .hgChatTime{font-size:14px;color:#526071}
#hgChat .hgChatName{font-size:16px;letter-spacing:0}
#hgChat button.hgChatBody{font-size:20px;line-height:1.5;min-height:48px;padding:8px 0;color:#132846}
#hgChat button.hgChatMore{width:44px;min-width:44px;min-height:48px;font-size:26px}
#hgChat .hgChatDay{font-size:15px;line-height:30px;color:#526071}
#hgChat .hgChatAttachment{font-size:17px;min-height:44px}
#hgChat .hgChatRemoved{font-size:16px}
#hgChat .hgChatComposer{position:relative;flex:0 0 auto;min-width:0;display:flex;flex-direction:column;gap:8px;padding:10px 0 8px;border-top:1px solid #d5d8dd;background:#fffdf6}
#hgChat .hgChatInputLine{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:8px;min-width:0}
#hgChat .hgChatInputLine textarea{box-sizing:border-box;width:100%;min-width:0;height:54px;min-height:54px;max-height:110px;padding:11px 12px;font-size:18px;line-height:30px;resize:none;overflow:auto;color:#132846;background:#fff;border:1px solid #9daabb;border-radius:8px}
#hgChat .hgChatInputLine textarea::placeholder{color:#657080;opacity:1}
#hgChat #hgChatSend{height:54px;min-height:54px;padding:8px 12px;font-size:18px;line-height:1.5;white-space:nowrap}
/* Anchor the emoji popup to the whole composer, above the input and send key. */
#hgChat .hgChatComposeActions{position:static;display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0;padding:0}
#hgChat .hgChatComposeActions>button,#hgChat .hgChatComposeActions>details>summary{display:flex;align-items:center;min-height:44px;padding:6px 10px;font-size:17px;line-height:1.5;border-radius:6px}
#hgChat .hgChatComposeActions>details{position:static;align-self:center}
#hgChat .hgChatComposeActions>details>summary{list-style:none;cursor:pointer}
#hgChat .hgChatComposeActions>details>summary::-webkit-details-marker{display:none}
#hgChat .hgChatEmoji{left:auto;right:0;bottom:calc(100% + 8px);box-sizing:border-box;width:min(280px,100%);display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
#hgChat .hgChatEmoji button{width:100%;min-width:44px;margin:0;font-size:24px}
#hgChat .hgChatDraft,#hgChat #hgChatMute{font-size:16px;line-height:1.5}
#hgChatActionContent p{font-size:20px;line-height:1.6}
#hgChatActionContent blockquote{font-size:18px}
body.hgChatKeyboard:has(#hgChat.active)>main{height:var(--hg-chat-height,100dvh)}
body.hgChatKeyboard:has(#hgChat.active)>nav.hgNav{display:none}
@media(max-width:350px){
 #hgChat .hgChatMessage{grid-template-columns:40px 80px minmax(0,1fr) 44px;gap:3px;padding-inline:0}
 body:has(#hgChat.active)>main{padding-inline:6px}
}

/* Small, fixed-size media previews keep message rows compact. */
#hgChat button.hgChatThumb{position:relative;flex:0 0 76px;width:76px;max-width:76px;height:56px;min-height:56px;padding:0;margin:3px 0;overflow:hidden;border:1px solid #d6dce2;border-radius:6px;background:#eaf0f2;isolation:isolate}
#hgChat .hgChatThumb img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;z-index:1}
#hgChat .hgChatThumbLabel{font-size:13px;color:#425774;white-space:normal;line-height:1.25}
#hgChat .hgChatThumbPlay{position:absolute;z-index:2;inset:auto 4px 4px auto;background:#10294fd9;color:white;border-radius:50%;font-size:16px;width:26px;height:26px;line-height:26px;text-align:center}
#hgChat .hgChatDraft{align-items:center;flex-wrap:nowrap;max-height:90px}
#hgChat .hgChatDraft>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#hgChat .hgChatDraft>button:not(.hgChatThumb){flex-shrink:0}
#hgChatPreview{max-width:min(94vw,960px)}
#hgChatPreview #hgChatPhoto{display:block;width:auto;max-width:100%;max-height:76dvh;margin:auto;object-fit:contain}

/* Persistent delivery feedback next to the composer. */
#hgChat #hgChatSendStatus{font-size:16px;line-height:1.5;margin:0;padding:6px 8px;border-radius:6px;background:#edf3f6;color:#213c59;overflow-wrap:anywhere}
#hgChat #hgChatSendStatus:empty{display:none}
#hgChat #hgChatSendStatus[data-kind="success"]{background:#e7f4e9;color:#225933}
#hgChat #hgChatSendStatus[data-kind="error"]{background:#fff0e6;color:#873c17}
