/* HG AI Assistant · 1.0.0 UI patch. No !important declarations. */
.hgai-client,.hgai-floating,.hgai-client *,.hgai-floating *{box-sizing:border-box}
.hgai-client{--hg-navy:#001D6E;--hg-blue:#7FB5FF;--hg-paleblue:#C4DDFF;--hg-peach:#FEE2C5;font-family:system-ui,-apple-system,'Segoe UI',sans-serif;background:#fff;color:#11254c;border:1px solid #d7e2f5;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 14px 46px rgba(0,29,110,.18);font-size:14px;isolation:isolate;max-width:100%}
.hgai-embedded{width:100%;height:auto;min-height:0;border-radius:19px}
.hgai-popup{width:100%;height:100%;border-radius:20px;box-shadow:0 20px 65px rgba(0,23,86,.3)}
.hgai-chat-head{background:linear-gradient(115deg,#001D6E,#123D9B);color:#fff;padding:12px 14px;display:flex;align-items:center;gap:11px;flex:0 0 auto;min-height:73px;position:relative;z-index:4}
.hgai-avatar{width:41px;height:41px;flex:0 0 41px;background:#7FB5FF;color:#001D6E;display:grid;place-items:center;border-radius:14px;font-size:24px}
.hgai-chat-brand{min-width:0;display:flex;flex-direction:column;gap:4px;flex:1}.hgai-chat-brand strong{font-size:16px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.hgai-chat-brand small{font-size:11px;color:#dce9ff;display:flex;align-items:center;gap:6px}
.hgai-dot{height:8px;width:8px;flex:0 0 8px;border-radius:50%;background:#e5a6a6;display:inline-block}.hgai-dot.hgai-on{background:#5bf2a2}
.hgai-menu-toggle{height:40px;width:40px;flex:0 0 40px;border:1px solid #ffffff35;background:#ffffff13;border-radius:11px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;color:#fff;cursor:pointer;padding:0}
.hgai-menu-toggle span{height:2px;width:19px;border-radius:2px;background:#fff;display:block}.hgai-menu-toggle:hover,.hgai-menu-toggle[aria-expanded="true"]{background:#ffffff30}
.hgai-close,.hgai-side-x{background:transparent;border:0;color:inherit;font-size:29px;cursor:pointer;line-height:1;padding:5px 9px;border-radius:9px}.hgai-close:hover,.hgai-side-x:hover{background:#ffffff24}
.hgai-chat-layout{display:flex;position:relative;flex:1;min-height:0;min-width:0;overflow:hidden}
.hgai-chat-side{position:absolute;z-index:3;inset:0 auto 0 0;width:min(276px,calc(100% - 38px));background:#f4f7fe;border-right:1px solid #dae4f4;padding:16px 12px;overflow-y:auto;transform:translateX(-102%);transition:transform .23s ease;visibility:hidden;display:flex;flex-direction:column;box-shadow:5px 4px 22px rgba(0,29,110,.1);overscroll-behavior:contain}
.hgai-client.hgai-sidebar-open .hgai-chat-side{transform:translateX(0);visibility:visible}
.hgai-side-top{display:flex;align-items:center;justify-content:space-between;color:#001D6E;margin-bottom:15px;font-size:15px}
.hgai-side-x{color:#001D6E;background:#e3edff;font-size:22px;line-height:1}
.hgai-side-backdrop{position:absolute;inset:0;z-index:2;width:100%;height:100%;background:#001d6e44;border:0;cursor:pointer}
.hgai-side-backdrop[hidden]{display:none}
.hgai-new{width:100%;border:0;border-radius:12px;background:#001D6E;color:#fff;font-size:13px;font-weight:650;padding:13px 8px;cursor:pointer}
.hgai-conversation-items{display:flex;flex-direction:column;gap:6px;margin-top:14px}
.hgai-history-item{width:100%;text-align:left;border:1px solid transparent;background:transparent;font-size:13px;padding:12px 9px;color:#213762;border-radius:9px;cursor:pointer}.hgai-history-item:hover,.hgai-history-item.hgai-selected{background:#d9e7ff;border-color:#7FB5FF}
.hgai-chat-main{min-width:0;min-height:0;flex:1;display:flex;flex-direction:column;background:#fff}
.hgai-thread{flex:1;overflow-y:auto;overflow-x:hidden;min-height:0;min-width:0;display:flex;flex-direction:column;gap:13px;padding:20px;scroll-behavior:smooth;overscroll-behavior:contain}
.hgai-intro{margin:auto;max-width:320px;text-align:center;color:#233b63}.hgai-intro strong{display:block;font-size:22px;color:#001D6E;margin-bottom:8px}.hgai-intro p{font-size:15px;margin:5px 0 9px}.hgai-intro small{color:#677b9d}
.hgai-intro-icon{display:grid;place-items:center;width:70px;height:70px;background:#e4efff;border-radius:23px;color:#001D6E;font-size:36px;margin:0 auto 17px}
.hgai-msg{max-width:min(88%,520px);align-self:flex-start;min-width:0;flex:0 0 auto}.hgai-msg b{display:block;font-size:11px;color:#577098;margin-bottom:5px;margin-left:7px}
.hgai-msg-text{background:#eef4ff;border-radius:17px 17px 17px 5px;padding:11px 14px;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6;color:#19325c}
.hgai-msg-user{align-self:flex-end}.hgai-msg-user b{text-align:right;margin-right:6px}.hgai-msg-user .hgai-msg-text{background:#001D6E;color:#fff;border-radius:17px 17px 5px 17px}
.hgai-msg-manager .hgai-msg-text{background:#fff4e7;border:1px solid #fee2c5}.hgai-msg-pending{opacity:.82}.hgai-msg-pending .hgai-msg-text{outline:1px dashed #7fb5ff}.hgai-msg-failed .hgai-msg-text{outline:2px solid #d16868}
.hgai-chat-status{flex:0 0 auto;padding:0 16px;font-size:12px;color:#536a89;min-height:0;overflow-wrap:anywhere}.hgai-chat-status:not(:empty){padding-top:7px;padding-bottom:5px}
.hgai-footnote{flex:0 0 auto;font-size:10px;color:#8291aa;text-align:center;padding:9px 5px 10px}
.hgai-floating{position:fixed;right:22px;bottom:22px;z-index:2147480000;pointer-events:none}
.hgai-bubble{pointer-events:auto;display:flex;align-items:center;justify-content:center;width:65px;height:65px;background:#001D6E;border:3px solid #fff;border-radius:50%;box-shadow:0 9px 28px #001d6e55;cursor:grab;touch-action:none;user-select:none;padding:0;overflow:hidden}
.hgai-bubble:active{cursor:grabbing}.hgai-bubble:focus-visible{outline:3px solid #7fb5ff;outline-offset:2px}.hgai-bubble img{width:100%;height:100%;object-fit:cover;pointer-events:none}
.hgai-widget-panel{position:fixed;z-index:2147480001;width:min(510px,calc(100vw - 19px));height:calc(100dvh - 19px);pointer-events:auto;max-width:calc(100vw - 19px);max-height:calc(100dvh - 19px)}
.hgai-widget-panel[hidden]{display:none}
.hgai-public-wrap{width:min(990px,calc(100% - 30px));margin:28px auto 55px}.hgai-public-lead{margin:0 0 19px;font-family:system-ui,sans-serif;color:#18305c}.hgai-public-lead h1{margin:12px 0 6px;font-size:27px;color:#001D6E}.hgai-public-lead p{margin:5px 0 8px}.hgai-public-lead small{color:#667991}
.hgai-request-shell{max-width:990px;margin:30px auto;padding:22px;border-radius:18px;background:#fff;border:1px solid #d7e2f5;color:#1b335a;font-family:system-ui,sans-serif}.hgai-request-shell h2,.hgai-request-shell h3{color:#001D6E}.hgai-request-shell .hgai-field{display:flex;flex-direction:column;gap:5px;margin:15px 0;font-weight:600}.hgai-request-shell .hgai-field input,.hgai-request-shell .hgai-field select,.hgai-request-shell .hgai-field textarea{width:100%;max-width:100%;padding:10px;border:1px solid #d0dcee;border-radius:9px;font:inherit;color:#182b53;background:#fff;font-weight:400}.hgai-request-form{margin-top:18px;padding-top:10px;border-top:1px solid #e1e8f4}.hgai-request-shell .hgai-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.hgai-request-row{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:13px 5px;border-bottom:1px solid #e3eafa;flex-wrap:wrap}.hgai-request-row small{display:block;color:#61789a}.hgai-request-row input[readonly]{max-width:min(420px,80vw);padding:6px;border:1px solid #d9e3f4}.hgai-request-notice{padding:12px;background:#e0f5e9;border-radius:9px}
.hgai-client button:focus-visible,.hgai-client textarea:focus-visible{outline:2px solid #7FB5FF;outline-offset:2px}
@media(max-width:650px){
 .hgai-widget-panel{width:calc(100vw - 19px);height:calc(100dvh - 19px);max-width:calc(100vw - 19px);max-height:calc(100dvh - 19px)}
 .hgai-popup{border-radius:16px}
 .hgai-embedded{height:auto;min-height:0;border-radius:15px}
 .hgai-chat-head{min-height:67px;padding:10px 11px;gap:8px}.hgai-avatar{height:36px;width:36px;flex-basis:36px;font-size:21px}.hgai-chat-brand strong{font-size:14px}
 .hgai-thread{padding:14px 12px}.hgai-msg{max-width:94%}.hgai-floating{right:10px;bottom:11px}.hgai-bubble{height:58px;width:58px}
 .hgai-request-shell{padding:15px}.hgai-request-shell .hgai-two{grid-template-columns:1fr;gap:0}.hgai-public-wrap{width:calc(100vw - 19px);margin:10px 9.5px 32px}
}
@media(max-height:560px){.hgai-chat-head{min-height:55px;padding-top:5px;padding-bottom:5px}.hgai-avatar{height:33px;width:33px;flex-basis:33px}.hgai-footnote{padding:4px}.hgai-thread{padding:9px}}
@media(prefers-reduced-motion:reduce){.hgai-thread{scroll-behavior:auto}.hgai-chat-side{transition:none}}

/* PATCH 02: two contacts, not unlimited new threads */
.hgai-side-tip{font-size:12px;color:#7182a0;margin:2px 0 0}
.hgai-two-channel{display:flex;gap:10px;align-items:center;min-height:66px;padding:11px}
.hgai-channel-icon{flex:0 0 34px;width:34px;height:34px;border-radius:11px;background:#dce9ff;display:grid;place-items:center;color:#001D6E;font-size:20px}
.hgai-channel-label{display:flex;flex-direction:column;gap:3px;min-width:0}
.hgai-channel-label strong{font-size:13px;overflow-wrap:anywhere;color:#001D6E}
.hgai-channel-label small{font-size:11px;color:#617b9e}
.hgai-auth-cta{margin:8px 12px 0;padding:12px;border:1px solid #7FB5FF;background:#eaf3ff;border-radius:12px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;font-size:12px;color:#001D6E}
.hgai-auth-cta[hidden]{display:none}
.hgai-auth-cta a{display:inline-block;background:#001D6E;color:#fff;border-radius:9px;padding:9px 15px;text-decoration:none;font-size:13px}

.hgai-owner-inbox{display:grid;grid-template-columns:minmax(160px,250px) minmax(0,1fr);gap:16px;margin-top:16px}
.hgai-owner-inbox nav{max-height:650px;overflow-y:auto;border-right:1px solid #d8e5f6;padding-right:10px}
.hgai-owner-chat-link{display:block;text-decoration:none;color:#001D6E;border:1px solid #d6e3f6;border-radius:10px;padding:10px;margin-bottom:8px}
.hgai-owner-chat-link small{display:block;color:#657ea1;font-size:11px}
.hgai-owner-inbox .hgai-admin-chat{display:flex;flex-direction:column;gap:8px;max-height:480px;overflow:auto;background:#eff5ff;padding:12px;border-radius:10px}
.hgai-owner-inbox .hgai-admin-msg{background:white;padding:11px;border-radius:10px;max-width:90%;overflow-wrap:anywhere}
.hgai-owner-inbox .hgai-admin-msg-user{align-self:flex-end;background:#001D6E;color:white}
.hgai-owner-inbox .hgai-admin-msg-manager{background:#fff0df}
.hgai-owner-inbox .hgai-admin-msg p{white-space:normal;line-height:1.5;margin:6px 0 0}
@media(max-width:650px){.hgai-owner-inbox{grid-template-columns:1fr}.hgai-owner-inbox nav{border-right:0;border-bottom:1px solid #d8e5f6;max-height:230px;padding-bottom:12px}}
/* Unified secretary chat — 1.0.0 full rebuild. Overrides old split-thread presentation. */
.hgai-client{position:relative;min-width:0}
.hgai-client [hidden],.hgai-connect-panel[hidden]{display:none}
.hgai-popup{height:100%}
.hgai-more{color:#fff;border:1px solid #ffffff3a;background:#ffffff15;width:38px;height:39px;border-radius:10px;font-size:25px;cursor:pointer}
.hgai-chat-head .hgai-menu-toggle{font-size:24px;font-weight:400}
.hgai-client .hgai-chat-side p{font-size:12px;margin:0;color:#6680a7}
.hgai-subtabs{flex:0 0 auto;display:flex;background:#f6f9ff;border-bottom:1px solid #e0eafb;padding:5px 13px;gap:6px}
.hgai-subtabs button{border:0;border-radius:10px;background:transparent;color:#52658b;font:600 13px system-ui;padding:9px 16px;cursor:pointer}
.hgai-subtabs button.active{background:#001D6E;color:#fff}
.hgai-filterbar{display:flex;align-items:center;flex:0 0 auto;gap:6px;padding:8px 13px;border-bottom:1px solid #e3ebfa;overflow-x:auto;scrollbar-width:none}
.hgai-filterbar button{border:1px solid #d3def1;border-radius:15px;background:#fff;color:#3c527c;font:600 12px system-ui;padding:6px 13px;cursor:pointer;white-space:nowrap}
.hgai-filterbar button.active{background:#dceaff;border-color:#7FB5FF;color:#001D6E}
.hgai-filterbar span{color:#647da0;white-space:nowrap;font-size:11px}
.hgai-scroll-viewport{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable}
.hgai-scroll-viewport .hgai-thread{display:flex;flex-direction:column;min-height:100%;overflow:visible;gap:12px;scroll-behavior:auto}
.hgai-msg[hidden]{display:none}
.hgai-info{flex:1;min-height:0;overflow-y:auto;padding:19px;color:#1c3661}
.hgai-info h3{margin:0 0 15px;color:#001D6E}.hgai-info h4{margin:22px 0 8px;color:#001D6E}
.hgai-older{align-self:center;border:1px solid #7fb5ff;background:#eff5ff;color:#001d6e;padding:7px 13px;border-radius:12px;cursor:pointer}
.hgai-menu-pop{position:absolute;z-index:10;top:64px;right:12px;background:#fff;max-height:min(500px,65dvh);overflow-y:auto;width:min(275px,calc(100% - 24px));padding:12px;border:1px solid #d7e4fa;border-radius:14px;box-shadow:0 18px 40px #001d6e33;color:#001d6e}
.hgai-menu-pop strong{display:block;font-size:13px;margin:3px 4px 9px}.hgai-menu-pop hr{border:0;border-top:1px solid #e4eaf5;margin:10px 0}
.hgai-menu-item{display:block;width:100%;background:transparent;border:0;text-align:left;border-radius:8px;color:#244370;padding:9px;font-size:12px;cursor:pointer}.hgai-menu-item.active,.hgai-menu-item:hover{background:#e5eeff}
.hgai-menu-filters{display:flex;gap:5px}.hgai-menu-filters button{flex:1;padding:7px 3px;background:#f1f5ff;border:1px solid #c9d9f7;border-radius:8px;color:#001d6e;font-size:12px;cursor:pointer}.hgai-menu-filters button.active{background:#001d6e;color:#fff}
.hgai-onboard{position:absolute;z-index:20;inset:0;background:#f5f9fffa;overflow-y:auto;padding:16px;display:grid;place-items:center}
.hgai-onboard-card{width:min(400px,100%);background:#fff;border:1px solid #d5e4f7;box-shadow:0 16px 50px #001d6e22;border-radius:20px;padding:25px;color:#1a2e52}
.hgai-onboard-card h2{margin:8px 0;color:#001d6e;font-size:23px}.hgai-onboard-card p{font-size:13px;line-height:1.6;color:#506b93}.hgai-onboard-card label{display:flex;flex-direction:column;gap:6px;font-weight:650;font-size:12px;margin:12px 0}
.hgai-onboard-card input,.hgai-onboard-card textarea{width:100%;padding:11px;border-radius:9px;border:1px solid #d0ddf0;box-sizing:border-box;color:#1a345c;font:14px system-ui}
.hgai-onboard-card button[type=submit]{width:100%;border:0;background:#001d6e;color:#fff;border-radius:10px;padding:12px;font-weight:700;cursor:pointer}
.hgai-onboard-card .hgai-intro-icon{height:52px;width:52px;font-size:25px;border-radius:17px;margin:0}
.hgai-connect-addon{width:min(1100px,calc(100% - 19px));margin:20px auto 35px;border:1px solid #d7e4f8;border-radius:16px;overflow:hidden;background:#fff}
.hgai-connect-toggle{width:100%;border:0;background:#001d6e;color:#fff;font-weight:700;text-align:left;font-size:15px;padding:14px 20px;cursor:pointer}.hgai-connect-toggle span{float:right}
.hgai-connect-panel{padding:14px}.hgai-connect-panel .hgai-embedded{height:auto}
.hgai-client .hgai-auth-cta{margin:4px 13px;padding:8px;font-size:12px}
@media(max-width:650px){
.hgai-widget-panel{width:calc(100vw - 19px);height:calc(100dvh - 19px);max-width:calc(100vw - 19px);max-height:calc(100dvh - 19px)}
.hgai-menu-pop{top:59px}
.hgai-chat-head{min-height:66px}
.hgai-scroll-viewport .hgai-thread{padding:12px}
.hgai-onboard-card{padding:16px}
}
.hgai-questions{flex:1;min-height:0;overflow-y:auto;padding:18px}.hgai-questions h3{margin:0 0 7px;color:#001d6e}.hgai-questions p{font-size:12px;color:#5c769c}
.hgai-questions [data-questions-list]{display:flex;flex-direction:column;gap:8px}.hgai-question-item{text-align:left;background:#f4f8ff;border:1px solid #d9e6fa;border-radius:10px;color:#17356a;padding:12px;cursor:pointer;white-space:pre-wrap;overflow-wrap:anywhere}

/* Author styles must not override HTML hidden state. */
.hgai-client [hidden], .hgai-widget-panel[hidden], .hgai-connect-panel[hidden], .hgai-connect-addon [hidden] { display:none; }

/* PATCH 03 — Single public thread and raised three-button navigation rail. */
.hgai-client .hgai-subtabs{display:flex;align-items:center;justify-content:stretch;gap:7px;margin:8px 12px 6px;padding:5px;background:linear-gradient(180deg,#eaf1ff,#dbe8fc);border:1px solid #c6d8f5;border-radius:14px;box-shadow:inset 0 1px 3px #001d6e1c,0 3px 9px #001d6e12}
.hgai-client .hgai-subtabs button{flex:1;min-width:0;text-align:center;padding:10px 5px;border:1px solid #dfb38d;border-radius:10px;color:#001d6e;background:linear-gradient(180deg,#fff0de,#fee2c5);box-shadow:0 3px 0 #d8b38e,0 4px 6px #001d6e17;transform:translateY(-1px);transition:box-shadow .12s,transform .12s}
.hgai-client .hgai-subtabs button.active,.hgai-client .hgai-subtabs button:active{background:linear-gradient(180deg,#fee2c5,#f4c69c);border-color:#c58b5e;color:#001d6e;box-shadow:inset 0 2px 5px #945d3429,0 1px 0 #ffeedd;transform:translateY(2px)}
.hgai-client .hgai-history-item.hgai-participant{display:flex;align-items:center;gap:10px;cursor:default;background:#eaf2ff;border-color:#d4e1f5}
.hgai-client .hgai-menu-secretary{cursor:default;font-weight:600;border-bottom:1px solid #e7edf7}
.hgai-client .hgai-menu-secretary:last-child{border-bottom:0}
.hgai-client .hgai-chat-status{color:#426993;font-size:11px}
.hgai-client .hgai-chat-brand small{font-weight:650;letter-spacing:.02em}
.hgai-client .hgai-footnote{padding-top:6px}
@media(max-width:650px){.hgai-widget-panel{width:calc(100vw - 19px);max-width:calc(100vw - 19px);height:calc(100dvh - 19px);max-height:calc(100dvh - 19px)}.hgai-client .hgai-subtabs{margin:7px 9px 5px}.hgai-client .hgai-subtabs button{padding:9px 4px}}

/* Keep launcher clickable even when full-screen mobile chat is open. */
.hgai-floating .hgai-bubble{position:relative;z-index:2147480002}
.hgai-floating.hgai-is-open .hgai-bubble{transform:scale(.72);transform-origin:100% 100%}

/* PATCH 04 — distinct right-side team navigation and options. */
.hgai-client .hgai-chat-head{gap:9px}
.hgai-client .hgai-menu-toggle{margin-left:0;flex:0 0 40px}
.hgai-client .hgai-chat-side{left:auto;right:0;border-right:0;border-left:1px solid #dae4f4;transform:translateX(102%);box-shadow:-5px 4px 22px rgba(0,29,110,.1)}
.hgai-client.hgai-sidebar-open .hgai-chat-side{transform:translateX(0)}
.hgai-team-entry{display:flex;align-items:center;justify-content:space-between;cursor:pointer;width:100%;padding:13px 12px;border:1px solid #c7dbf8;background:#001d6e;color:#fff;text-align:left;border-radius:12px;font-size:14px;font-weight:700}
.hgai-team-entry span{transition:transform .2s ease}.hgai-team-entry[aria-expanded="false"] span{transform:rotate(-90deg)}
.hgai-client .hgai-conversation-items{display:flex;flex-direction:column;gap:7px;padding:8px 0 0}
.hgai-client .hgai-team-person{width:100%;cursor:pointer;display:flex;align-items:center;gap:10px;text-align:left;font:inherit;padding:12px;border:1px solid #d9e4f3;border-radius:11px;background:#fff;color:#001d6e}
.hgai-client .hgai-team-person.active{background:#dceaff;border-color:#7fb5ff}
.hgai-client .hgai-team-person[hidden],.hgai-client .hgai-conversation-items[hidden],.hgai-client [data-send][hidden]{display:none}
.hgai-client .hgai-menu-pop{right:58px}
.hgai-client .hgai-thread{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:13px;min-height:100%;height:auto}
.hgai-client .hgai-msg{position:relative;display:block;width:fit-content;min-height:max-content;max-width:min(88%,520px);flex:0 0 auto;margin:0;overflow:visible}
.hgai-client .hgai-msg[hidden]{display:none}
.hgai-client .hgai-msg-user{margin-left:auto}
.hgai-client .hgai-msg-text{display:block;position:relative;white-space:pre-wrap;overflow-wrap:anywhere}
.hgai-floating.hgai-is-open .hgai-bubble{transform:none}
.hgai-floating .hgai-bubble{transition:box-shadow .18s ease}
.hgai-floating.hgai-is-open .hgai-bubble{box-shadow:0 0 0 3px #7fb5ff,0 12px 28px #001d6e55}
@media(max-width:650px){.hgai-client .hgai-menu-pop{right:52px}.hgai-client .hgai-msg{max-width:94%}}

/* PATCH 04 — optional image attachment; text or image may be sent */
.hgai-image-picker{height:40px;min-width:38px;display:grid;place-items:center;cursor:pointer;border-radius:10px;border:1px solid #c8daf7;color:#001d6e;font-size:20px;background:#eaf3ff}
.hgai-image-picker:focus-within{outline:2px solid #7fb5ff}
.hgai-attachment-caption{font-size:11px;color:#365884;padding:4px 18px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hgai-message-image{max-width:260px;max-height:260px;overflow:hidden;border-radius:12px;margin-top:6px}
.hgai-photo{display:block;max-width:100%;max-height:260px;object-fit:contain;border-radius:10px;margin-top:7px}
.hgai-client [data-send][hidden]{display:none}

/* PATCH 05 — one public chat, team drawer on the left. */
.hgai-client .hgai-chat-side{left:0;right:auto;border-right:1px solid #dae4f4;border-left:0;transform:translateX(-102%);box-shadow:5px 4px 22px rgba(0,29,110,.1)}
.hgai-client.hgai-sidebar-open .hgai-chat-side{transform:translateX(0)}
.hgai-client .hgai-menu-toggle{margin-left:0;margin-right:5px;order:-5}
.hgai-client .hgai-chat-brand{flex:1;min-width:0}
.hgai-client .hgai-more,.hgai-client .hgai-menu-pop{display:none}
.hgai-client .hgai-chat-status{min-height:1em}

/* PATCH 06 — visible composer, accessible media modes and shared thread filters. */
.hgai-client .hgai-attachment-caption{display:flex;align-items:center;gap:10px;min-height:0;white-space:normal;overflow-wrap:anywhere}
.hgai-client .hgai-clear-attachment{border:1px solid #bbd0ed;background:#fff;color:#001d6e;border-radius:8px;padding:4px 8px;cursor:pointer;font:600 12px system-ui}
.hgai-client .hgai-voice-tools{display:flex;flex:0 0 auto;align-items:center;flex-wrap:wrap;gap:9px;margin:6px 14px 0;padding:8px 10px;background:#f4f7ff;border:1px solid #dce7f6;border-radius:12px}
.hgai-client .hgai-voice-tools button{border:1px solid #bed1ed;background:#fff;color:#001d6e;border-radius:10px;font-weight:650;padding:7px 10px;cursor:pointer}
.hgai-client .hgai-voice-tools [data-voice-indicator]{font-size:12px;color:#4a6286}
.hgai-client .hgai-team-members{display:flex;flex-direction:column;gap:5px;margin-top:9px;border-top:1px solid #dce6f4;padding-top:10px}
.hgai-client .hgai-team-members small{display:block;color:#5f779e;margin:4px 0 5px}
.hgai-client .hgai-team-person{font-size:13px}
.hgai-client .hgai-msg .hgai-attachment{max-width:100%;padding:4px 0 0;overflow-wrap:anywhere}
.hgai-client .hgai-audio{max-width:min(100%,270px);display:block;height:45px}
.hgai-client .hgai-document-link{display:inline-flex;align-items:center;gap:6px;border-radius:9px;border:1px solid #c8dbf3;background:#f0f6ff;color:#001d6e;font:600 12px system-ui;max-width:100%;padding:9px 12px;overflow-wrap:anywhere}
.hgai-client .hgai-message-image{max-width:100%}
.hgai-client .hgai-photo{max-width:min(100%,290px);height:auto;object-fit:contain}
.hgai-test-chat{max-width:750px;margin:15px 0 6px;min-height:660px}
.hgai-test-chat .hgai-client{height:min(73dvh,790px);min-height:550px}
.hgai-client [hidden],.hgai-client [data-compose-mode][hidden],.hgai-client [data-voice-start][hidden],.hgai-client [data-voice-stop][hidden]{display:none}
@media(max-width:650px){
 .hgai-client .hgai-voice-tools{margin:6px 10px 0}
 .hgai-test-chat{min-height:0}
 .hgai-test-chat .hgai-client{min-height:570px}
}


/* PATCH 07: compact single-border composer, hidden scrollbar track, image viewer. */
.hgai-client .hgai-scroll-viewport,.hgai-client .hgai-thread{scrollbar-width:none;scrollbar-gutter:auto}
.hgai-client .hgai-scroll-viewport::-webkit-scrollbar,.hgai-client .hgai-thread::-webkit-scrollbar{width:0;height:0;display:none}
.hgai-client .hgai-team-expander{font-weight:700;background:#eaf2ff;justify-content:space-between}
.hgai-client .hgai-team-expander .hgai-arrow{margin-left:auto}
.hgai-client .hgai-team-members{display:flex;flex-direction:column;gap:6px;padding:5px 0 5px 10px;margin:0;border:0}
.hgai-client .hgai-team-members .hgai-team-person{font-size:12px}
.hgai-client .hgai-open-photo{display:block;max-width:100%;margin:7px 0 0;padding:0;border:0;background:transparent;border-radius:11px;cursor:zoom-in}
.hgai-client .hgai-open-photo img{display:block;margin:0;max-width:min(100%,300px);max-height:250px;border-radius:11px;object-fit:contain}
.hgai-client .hgai-lightbox[hidden]{display:none}
.hgai-client .hgai-lightbox{position:absolute;z-index:35;inset:0;background:rgba(2,17,49,.91);display:flex;align-items:center;justify-content:center;padding:48px 10px 16px;min-height:0}
.hgai-client .hgai-lightbox-image{max-width:100%;max-height:100%;object-fit:contain;border-radius:8px;box-shadow:0 12px 40px #0006}
.hgai-client .hgai-lightbox-close{position:absolute;top:8px;right:9px;width:37px;height:37px;display:grid;place-items:center;box-sizing:border-box;margin:0;padding:0;text-align:center;border:1px solid #fff5;border-radius:50%;background:#fff;color:#001d6e;font:700 27px/1 system-ui;cursor:pointer}
.hgai-client .hgai-msg{flex:0 0 auto;position:relative}

/* PATCH 09 — persistent top toolbar, borderless editor, message-level delivery indicator */


/* PATCH 15: single constrained wrap; nested regions are derived, never independently widened. */
#hgai-widget-panel{max-width:calc(100vw - 19px) !important;box-sizing:border-box;min-width:0;overflow:hidden}
.hgai-client,.hgai-client .hgai-chat-layout,.hgai-client .hgai-chat-main,.hgai-client .hgai-scroll-viewport{min-width:0;max-width:100%;box-sizing:border-box}
.hgai-client .hgai-chat-main{overflow:hidden}
.hgai-client .hgai-popup{max-width:100%;min-width:0}
.hgai-client .hgai-media-open,.hgai-client .hgai-attachment a{display:inline-flex;align-items:center;gap:6px;max-width:100%;white-space:normal;overflow-wrap:anywhere;border:1px solid #c5d8f7;border-radius:9px;padding:9px 12px;margin:4px;background:#edf5ff;color:#001d6e;font:650 12px system-ui;cursor:pointer;text-decoration:none}
@media(max-width:650px){.hgai-public-wrap{box-sizing:border-box;width:calc(100vw - 19px);max-width:calc(100vw - 19px);margin:9.5px auto}.hgai-embedded{width:100%;max-width:100%;height:calc(100dvh - 19px);min-height:0}}

/* Actual navigation into HG AI from an opt-in HG Connect shortcode. */
.hgai-connect-launch{width:100%;max-width:100%;box-sizing:border-box;margin:12px 0 6px;padding:0 9.5px}
.hgai-connect-launch a{display:flex;gap:9px;align-items:center;justify-content:center;max-width:100%;padding:12px 16px;border:1px solid #7fb5ff;border-radius:12px;background:#001d6e;color:#fff;text-decoration:none;font:700 14px system-ui;box-shadow:0 3px 8px #001d6e24}
.hgai-connect-launch a:hover,.hgai-connect-launch a:focus-visible{color:#fff;background:#1843a2}

/* PATCH 16 — outer chat wrap is the only viewport sizing authority. */
.hgai-widget-panel{height:calc(100dvh - 19px);max-height:calc(100dvh - 19px);max-width:calc(100vw - 19px)}
.hgai-client.hgai-popup{height:100%;min-height:0;max-height:100%;width:100%;min-width:0;max-width:100%}
.hgai-client [data-saved][hidden]{display:none}


/* PATCH 19 — Layout authority: floating widget and inline shortcode are different surfaces.
 * Only the existing outer #hgai-widget-panel rule uses !important, never children.
 * The normal page renders like page content (no simulated floating-window viewport).
 */
.hgai-client.hgai-embedded{display:block;height:auto;max-height:none;overflow:visible;width:100%;box-shadow:none}
.hgai-client.hgai-embedded .hgai-chat-layout{display:block;flex:none;min-height:0;height:auto;overflow:visible}
.hgai-client.hgai-embedded .hgai-chat-main{display:flex;flex-direction:column;height:auto;min-height:0;overflow:visible}
.hgai-client.hgai-embedded .hgai-scroll-viewport{flex:none;height:auto;min-height:min(66dvh,610px);max-height:none;overflow:visible}
.hgai-client.hgai-embedded .hgai-thread{height:auto;min-height:min(66dvh,610px);overflow:visible}
.hgai-client.hgai-embedded .hgai-info,.hgai-client.hgai-embedded .hgai-questions{flex:none;height:auto;min-height:250px;max-height:none;overflow:visible}
.hgai-client.hgai-embedded .hgai-chat-side{bottom:auto;height:min(77dvh,650px);max-height:calc(100dvh - 19px)}
.hgai-client.hgai-embedded .hgai-composer{margin-bottom:12px}
/* A full-page shortcode is not forced to the height of a floating widget. */
.hgai-public-wrap{width:calc(100% - 19px);max-width:none;margin:18px 9.5px 35px}
.hgai-test-chat{max-width:none;min-height:0}
.hgai-test-chat .hgai-client{height:auto;min-height:0}

/* PATCH 20: desktop floating chat has TWO separate scroll contexts.
 * Outer fixed viewport only reveals the header or bottom of composer when
 * requested. The messages never scroll that outer surface or the site page.
 * Header remains above the initially shown rail; normal embedded pages keep
 * their own document layout. */
@media(min-width:651px){
  .hgai-widget-panel{height:calc(100dvh - 19px);max-height:calc(100dvh - 19px);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:none}
  .hgai-widget-panel::-webkit-scrollbar{width:0;display:none}
  .hgai-client.hgai-popup{--hgai-popup-head:73px;--hgai-compose-half:75px;
    height:calc(100% + var(--hgai-popup-head) + var(--hgai-compose-half));
    min-height:0;max-height:none;overflow:hidden}
  .hgai-client.hgai-popup .hgai-chat-layout,
  .hgai-client.hgai-popup .hgai-chat-main{min-height:0;overflow:hidden}
  .hgai-client.hgai-popup .hgai-scroll-viewport{flex:1 1 0;height:0;min-height:0;overflow-y:auto;overscroll-behavior:contain}
  .hgai-client.hgai-popup .hgai-thread{min-height:100%;height:auto;overflow:visible}
}
@media(max-width:650px){
  .hgai-widget-panel{overflow:hidden}
  .hgai-client.hgai-popup{height:100%;min-height:0;max-height:100%;overflow:hidden}
  .hgai-client.hgai-popup .hgai-scroll-viewport{flex:1 1 0;height:0;min-height:0;overflow-y:auto;overscroll-behavior:contain}
  .hgai-client.hgai-embedded .hgai-scroll-viewport{min-height:56dvh}
  .hgai-client.hgai-embedded .hgai-thread{min-height:56dvh}
}

/* Widget close action is in the header on small screens, without covering Send. */
.hgai-client .hgai-widget-close{flex:0 0 34px;width:34px;height:34px;display:grid;place-items:center;border:1px solid #ffffff55;background:#ffffff15;color:#fff;border-radius:9px;font:26px/1 system-ui;cursor:pointer}
@media(min-width:651px){.hgai-client .hgai-widget-close{display:none}}
@media(max-width:650px){.hgai-floating.hgai-is-open .hgai-bubble{visibility:hidden;pointer-events:none}}

/* PATCH 21 — sidebar hierarchy, 70dvh embedded message scrolling, login interstitial. */
.hgai-client .hgai-filter-root{display:flex;flex-direction:column;gap:5px;margin:6px 0 14px;padding-bottom:11px;border-bottom:1px solid #d5e2f4}
.hgai-client .hgai-team-entry{width:100%}
.hgai-client .hgai-chat-side .hgai-side-top{font-size:13px;color:#001d6e}
.hgai-client.hgai-embedded .hgai-scroll-viewport{height:70dvh;max-height:70dvh;min-height:280px;flex:0 0 70dvh;overflow-y:auto;overscroll-behavior:contain}
.hgai-client.hgai-embedded .hgai-thread{height:auto;min-height:100%;overflow:visible}
.hgai-client.hgai-embedded .hgai-chat-main{overflow:visible}
.hgai-client.hgai-embedded .hgai-chat-layout{overflow:visible}
.hgai-client.hgai-embedded .hgai-subtabs{position:sticky;top:0;z-index:2}
.hgai-guest-locked{display:flex;justify-content:space-between;min-height:0;height:100%;max-width:100%;background:#f5f9ff}
.hgai-guest-welcome{display:flex;flex:1 1 auto;min-height:0;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:24px 18px;gap:12px;overflow:auto}
.hgai-guest-star{display:grid;place-items:center;width:60px;height:60px;border-radius:50%;background:#001d6e;color:#fff;font-size:34px}
.hgai-guest-welcome h2{color:#001d6e;font-size:23px;margin:4px 0}
.hgai-guest-welcome p{max-width:450px;line-height:1.55;font-size:14px;margin:0;color:#38597e}
.hgai-guest-reply{box-sizing:border-box;width:100%;max-width:440px;border:1px solid #afccef;border-radius:13px;padding:14px;text-align:left;color:#7d93b4;background:#fff;margin-top:8px}
.hgai-guest-auth{display:flex;flex:0 0 auto;justify-content:center;align-items:center;gap:12px;flex-wrap:wrap;background:#e9f2ff;border-top:1px solid #d0e0f8;padding:16px}
.hgai-guest-auth a{display:inline-block;padding:11px 19px;background:white;color:#001d6e;border:1px solid #a6c5ef;border-radius:10px;text-decoration:none;font-weight:700}
.hgai-guest-auth a.hgai-login-link{background:#001d6e;color:#fff}
.hgai-client.hgai-embedded.hgai-guest-locked{height:70dvh;min-height:340px}

/* PATCH 21: correct close icon alignment and full-height editor viewport. */
.hgai-client .hgai-widget-close{display:grid;place-items:center;line-height:1;padding:0;text-align:center}
.hgai-client.hgai-embedded .hgai-write-modal{position:fixed;inset:9.5px;width:calc(100vw - 19px);height:calc(100dvh - 19px);max-width:calc(100vw - 19px);max-height:calc(100dvh - 19px);z-index:2147480002}
.hgai-client.hgai-popup .hgai-write-modal{position:fixed;inset:9.5px;width:calc(100vw - 19px);height:calc(100dvh - 19px);min-height:0;max-height:calc(100dvh - 19px);z-index:2147480002}

/* Guest login gate: the floating widget keeps its own accessible close action. */
.hgai-guest-locked.hgai-popup{flex-direction:column}
.hgai-guest-locked .hgai-guest-head{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;padding:11px 13px;background:#001d6e;color:#fff}
.hgai-guest-locked .hgai-guest-head .hgai-widget-close{position:static;display:grid;place-items:center;width:32px;height:32px;padding:0;line-height:1;border:0;border-radius:8px;background:rgba(255,255,255,.14);color:white}

/* PATCH 22 — 3D rails, including sidebar filters; no !important. */
.hgai-client .hgai-team-entry{background:linear-gradient(180deg,#fff0de,#fee2c5);color:#001d6e;border-color:#dfb38d;box-shadow:0 3px 0 #d8b38e,0 5px 9px #001d6e1a;transform:translateY(-1px)}
.hgai-client .hgai-team-person{background:linear-gradient(180deg,#fff,#eaf2ff);border:1px solid #bfcee7;box-shadow:0 3px 0 #c1d2ee,0 4px 8px #001d6e15;transform:translateY(-1px);transition:transform .14s,box-shadow .14s}
.hgai-client .hgai-team-person.active,.hgai-client .hgai-team-person:active{background:linear-gradient(180deg,#2755ae,#001d6e);color:white;box-shadow:inset 0 2px 4px #0004,0 1px 0 #7fb5ff;transform:translateY(1px)}
.hgai-client .hgai-team-expander{background:#fee2c5;border-color:#e2b990;color:#001d6e}

/* PATCH 24 — touch screen requesting Desktop site (CSS viewport often ~980px).
 * Override the DESKTOP-only 510px narrow panel and two-level scrolling. The
 * outer panel owns viewport dimensions; messages scroll in their own region. */
.hgai-widget-panel.hgai-touch-desktop{overflow:hidden;overscroll-behavior:contain;scrollbar-width:auto}
.hgai-widget-panel.hgai-touch-desktop .hgai-client.hgai-popup{height:100%;max-height:100%;min-height:0;overflow:hidden}
.hgai-widget-panel.hgai-touch-desktop .hgai-chat-layout,
.hgai-widget-panel.hgai-touch-desktop .hgai-chat-main{min-height:0;overflow:hidden}
.hgai-widget-panel.hgai-touch-desktop .hgai-scroll-viewport{flex:1 1 0;height:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.hgai-widget-panel.hgai-touch-desktop .hgai-thread{min-height:100%;height:auto;overflow:visible}
.hgai-widget-panel.hgai-touch-desktop .hgai-widget-close{display:grid}
.hgai-floating.hgai-is-open:has(.hgai-touch-desktop) .hgai-bubble{visibility:hidden;pointer-events:none}

/* PATCH 34: manual refresh instead of idle polling. */
.hgai-subtabs .hgai-refresh-thread{margin-left:auto;white-space:nowrap;font-size:.88em;min-width:0;padding-inline:.65em;}
.hgai-subtabs .hgai-refresh-thread:hover,.hgai-subtabs .hgai-refresh-thread:focus-visible{outline-offset:2px;}
