/**
 * HG Connect visual adapter for HG AI Assistant (embedded Assistant Team only).
 * Reference: HG Connect chat-header.css, chat-list.css, chat-box.css,
 * chat-composer.css. Contract: HG AI Assistant's actual chat.php and
 * shared-message-bubbles.js; no copied IDs, markup, listeners or HTTP actions.
 * This theme is inert in --hgai mode; official Connect choice also skins the
 * HG AI global widget panel without changing its engine or room state.
 */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) {
  --hg-chat-primary:#001d6e;
  --hg-chat-primary-hover:#002b9a;
  --hg-chat-primary-soft:#eaf2ff;
  --hg-chat-soft-blue:#d9e6f8;
  --hg-chat-softest-blue:#f4f8ff;
  --hg-chat-surface:#fff;
  --hg-chat-border:#dfe7f2;
  --hg-chat-border-strong:#c7d6e9;
  --hg-chat-text:#17233d;
  --hg-chat-muted:#65738b;
  --hg-chat-small-shadow:0 5px 18px rgba(0,29,110,.09);
  font-family:inherit;
}
/* Native HG AI header is the ONLY header: familiar menu, status and room pill. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client.hgai-embedded .hgai-chat-head {
  display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:12px 15px;
  min-height:68px;background:linear-gradient(180deg,#fff,#f7faff);
  border-bottom:1px solid var(--hg-chat-border);color:var(--hg-chat-text);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-menu-toggle {
  display:inline-flex;align-items:center;justify-content:center;flex:0 0 38px;
  width:38px;height:38px;min-width:38px;margin:0;padding:0;
  border:1px solid rgba(0,29,110,.16);border-radius:10px;
  background:var(--hg-chat-soft-blue);color:var(--hg-chat-primary);
  box-shadow:-2px 3px 0 rgba(0,29,110,.10),0 5px 12px rgba(15,23,42,.08);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-menu-toggle:hover,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-menu-toggle:focus-visible,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-menu-toggle[aria-expanded=true] {
  background:var(--hg-chat-soft-blue);border-color:rgba(0,29,110,.26);
  box-shadow:-4px 5px 0 rgba(0,29,110,.13),0 9px 18px rgba(15,23,42,.13);
}
/* .hgai-menu-toggle contains a text glyph, not three spans in the current HG AI HTML. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-head .hgai-avatar {
  width:38px;height:38px;flex:0 0 38px;background:#e3efff;
  border:1px solid #c4d9f3;border-radius:11px;color:var(--hg-chat-primary);font-size:21px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-brand {
  flex:1 1 140px;min-width:0;gap:5px;align-items:flex-start;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-brand strong {
  display:inline-flex;width:auto;max-width:100%;min-height:34px;align-items:center;
  padding:7px 13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-size:clamp(12px,2.5vw,15px);line-height:1.1;font-weight:850;
  color:var(--hg-chat-primary);background:var(--hg-chat-soft-blue);
  border:1px solid rgba(0,29,110,.16);border-radius:999px;
  box-shadow:-3px 4px 0 rgba(0,29,110,.10),0 7px 14px rgba(15,23,42,.10);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-brand small {
  margin:0 0 0 9px;color:#536d8d;font-size:11px;font-weight:600;
}
/* Scrollable rail: same blue/white raised button system as HG Connect chat tabs. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs {
  display:flex;flex-wrap:nowrap;justify-content:flex-start;align-items:center;
  width:calc(100% - 24px);min-width:0;gap:7px;margin:10px 12px 12px;
  padding:10px;border:1px solid #d9e4f3;border-radius:17px;
  background:linear-gradient(180deg,#edf4ff,#f8fbff);
  box-shadow:inset 0 1px 3px rgba(0,29,110,.06),var(--hg-chat-small-shadow);
  overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:thin;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs button {
  flex:0 0 auto;min-width:unset;min-height:42px;white-space:nowrap;
  padding:9px 16px;color:#54647d;background:#fff;border:1px solid #d5e0ee;
  border-radius:12px;font-size:13px;font-weight:750;
  box-shadow:0 3px 0 rgba(0,29,110,.09),0 4px 9px rgba(0,29,110,.07);
  transform:none;transition:background-color .14s,box-shadow .14s;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs button.active,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs button:active {
  background:var(--hg-chat-primary);border-color:var(--hg-chat-primary);
  color:#fff;box-shadow:0 5px 14px rgba(0,29,110,.22);transform:none;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs button:focus-visible {
  outline:2px solid #7fb5ff;outline-offset:2px;
}
/* Side drawer: preserve HG AI's data-side, backdrop and own open/close handlers. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-side {
  padding:18px 14px;background:linear-gradient(180deg,#fff,#f2f7ff);
  border-color:#d9e4f3;box-shadow:8px 0 26px rgba(0,29,110,.13);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-side-top {
  gap:10px;min-height:54px;padding:0 2px 13px;margin:0 0 14px;
  border-bottom:1px solid #dae5f4;color:var(--hg-chat-primary);font-weight:800;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-filter-root {
  padding-bottom:14px;margin:0 0 12px;border-color:#d9e4f3;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-filter-root :is(input,select) {
  width:100%;max-width:100%;min-height:43px;padding:9px 13px;
  background:#fff;border:1px solid #d5e1ee;border-radius:13px;
  box-shadow:0 3px 10px rgba(0,29,110,.06);color:var(--hg-chat-text);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-team-entry,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-team-person,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-history-item {
  min-height:42px;padding:10px 12px;background:#fff;
  border:1px solid #d1e0f2;border-radius:12px;color:var(--hg-chat-primary);
  box-shadow:0 3px 0 rgba(0,29,110,.08),0 5px 10px rgba(0,29,110,.05);
  transform:none;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client :is(.hgai-team-entry,.hgai-team-person,.hgai-history-item).active,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-history-item.hgai-selected {
  background:#d9e8ff;border-color:#aac9ed;color:var(--hg-chat-primary);
  box-shadow:inset 0 2px 4px rgba(0,29,110,.07);
}
/* Chat cards: source geometry from HG Connect chat-box.css, preserving HG AI DOM. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-thread {
  gap:14px;padding:18px 16px;background:#f8faff;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg {
  width:max-content;max-width:min(82%,760px);min-width:0;align-self:flex-start;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg.hgai-msg-user {
  align-self:flex-end;margin-left:auto;max-width:min(82%,760px);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-message-box {
  display:flex;flex-direction:column;gap:0;padding:0;border:1px solid #b8d1ee;
  background:#e5f0ff;border-radius:16px 16px 16px 7px;color:#17253b;
  box-shadow:0 3px 10px rgba(0,29,110,.08);overflow:visible;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg.hgai-msg-user .hgai-message-box {
  background:#d7e9ff;border-color:#91b9e9;border-radius:16px 16px 7px 16px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-message-box::after {
  background:#e5f0ff;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg.hgai-msg-user .hgai-message-box::after {
  background:#d7e9ff;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-head,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg.hgai-msg-user .hgai-msg-head {
  display:flex;align-items:center;gap:10px;min-height:56px;padding:10px 12px;
  background:#fff;border-bottom:1px solid #dbe5f4;border-radius:15px 15px 0 0;
  color:#17253b;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg.hgai-msg-user .hgai-msg-head {
  flex-direction:row-reverse;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-avatar {
  display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;
  border:2px solid #fff;border-radius:50%;background:#d9e8f9;
  box-shadow:0 2px 7px rgba(0,29,110,.13);overflow:hidden;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-identity {
  flex:1;min-width:0;gap:4px;align-items:flex-start;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg.hgai-msg-user .hgai-msg-identity {
  align-items:flex-end;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-name {
  font-size:13px;font-weight:800;color:var(--hg-chat-text);line-height:1.35;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-time {
  font-size:11px;color:#7c8ba2;opacity:1;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-text {
  padding:16px 17px 12px;line-height:1.55;font-size:clamp(14px,1.9vw,16px);
  color:#17253b;background:transparent;
}
/* Save and Copy keep HG AI's button nodes, text labels and click handlers.
 * Hide the visible label through font sizing only; assistive tech still reads it.
 * Pseudo icons are presentation only. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-message-box .hgai-message-footer {
  display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;
  min-height:45px;padding:6px 11px 10px;margin:0;gap:7px;
  border:0;background:transparent;border-radius:0 0 15px 15px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-message-footer :is(.hgai-message-save,.hgai-message-copy) {
  position:relative;display:inline-flex;flex:0 0 36px;align-items:center;justify-content:center;
  min-width:36px;width:36px;height:36px;min-height:36px;padding:0;margin:0;
  border:1px solid #c7d6e9;border-radius:10px;
  background:#fff;color:var(--hg-chat-primary);box-shadow:0 2px 5px rgba(0,29,110,.07);
  font-size:0;line-height:1;cursor:pointer;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-message-footer .hgai-message-save::before {
  content:'☆';font-size:21px;line-height:1;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-message-footer .hgai-message-save[aria-pressed=true]::before {
  content:'★';
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-message-footer .hgai-message-copy::before {
  content:'⧉';font-size:21px;line-height:1;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-message-footer :is(.hgai-message-save,.hgai-message-copy):focus-visible {
  outline:2px solid #7fb5ff;outline-offset:2px;
}
/* Composer: HG AI owns original appearance, layout, modes and interactions. */
/* Voice recorder and audio cards: skin only, never use HG Connect's recorder events. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-voice-tools {
  margin:9px 10px 0;padding:12px;gap:9px;background:#f4f8ff;
  border:1px solid #c7d6e9;border-radius:14px;box-shadow:0 3px 10px rgba(0,29,110,.05);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-voice-tools button {
  min-height:36px;padding:7px 12px;background:#fff;border:1px solid #b8d1ee;
  color:var(--hg-chat-primary);border-radius:10px;cursor:pointer;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client :is(audio,.hgai-voice-player) {
  max-width:100%;accent-color:var(--hg-chat-primary);
}
@media (max-width:780px) {
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-head {padding:10px 11px;gap:8px;}
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-brand strong {font-size:12px;max-width:100%;}
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-side {
    width:min(345px,calc(100% - 44px));max-width:calc(100% - 44px);height:min(77dvh,650px);
  }
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs {margin:8px 8px 10px;width:calc(100% - 16px);padding:9px;}
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs button {min-height:39px;padding:8px 13px;font-size:12px;}
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-thread {padding:12px 10px;gap:12px;}
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg,
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg.hgai-msg-user {max-width:94%;}
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-text {font-size:14px;padding:12px 12px 10px;}
}
@media (prefers-reduced-motion:reduce) {
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-subtabs button {transition:none;}
}

/* The HG AI attachment gallery and expanded text/image dialog stay native. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-write-modal-card {
  border:1px solid #c7d6e9;border-radius:16px;background:#fff;
  box-shadow:0 12px 30px rgba(0,29,110,.17);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-write-modal-card > header,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-write-modal-card > footer {background:#f4f8ff;border-color:#d9e4f3;}
/* Genuine HG Connect View More visual style: collapse TEXT only, never media. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-text.hg-connect-ai-truncated {
  position:relative;max-height:clamp(190px,36vh,320px);overflow:hidden;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg .hgai-msg-text.hg-connect-ai-truncated::after {
  content:'';position:absolute;bottom:0;left:0;right:0;height:67px;pointer-events:none;
  background:linear-gradient(to bottom,rgba(229,240,255,0),#e5f0ff);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-msg-user .hgai-msg-text.hg-connect-ai-truncated::after {
  background:linear-gradient(to bottom,rgba(215,233,255,0),#d7e9ff);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-viewmore-row {
  display:flex;align-items:center;justify-content:center;padding:5px 8px 9px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-viewmore {
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  min-height:35px;padding:7px 14px;background:rgba(255,255,255,.79);
  border:1px solid rgba(67,126,193,.22);border-radius:999px;
  font:750 12px/1.2 system-ui;color:#155ba9;cursor:pointer;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-viewmore:hover {background:#fff;color:#0f4b8d;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-viewmore:focus-visible {outline:2px solid #7fb5ff;outline-offset:2px;}
/* True existing HG AI filters in the Connect Chat drawer; no invented rooms. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-side-top {
  position:relative;display:flex;gap:12px;align-items:center;min-height:64px;
  padding:0 40px 14px 3px;border-bottom:1px solid #dce6f4;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-side-top strong {font-size:18px;color:#001d6e;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-side-icon {
  display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;
  background:#d9e6f8;color:#001d6e;border-radius:12px;font-size:20px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-side-close {
  position:absolute;right:0;top:3px;border:0;border-radius:10px;
  color:#001d6e;background:#eaf2ff;min-width:34px;min-height:37px;font-size:26px;cursor:pointer;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-side-search {
  display:flex;gap:9px;align-items:center;min-height:47px;margin:13px 0 18px;
  padding:6px 12px;background:#fff;border:1px solid #d7e4f4;
  border-radius:14px;box-shadow:0 3px 11px rgba(0,29,110,.05);
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-side-search input {
  flex:1;min-width:0;max-width:100%;min-height:33px;border:0;outline:0;
  background:transparent;color:#17233d;font:inherit;font-size:14px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-side-search:focus-within {outline:2px solid #7fb5ff;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-side-footer {
  margin-top:auto;padding-top:14px;display:flex;gap:10px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-side-footer button {
  display:flex;align-items:center;justify-content:center;gap:9px;
  flex:1;min-height:43px;border:1px solid #d5e0ee;border-radius:11px;
  color:#001d6e;background:#fff;cursor:pointer;font-weight:750;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-filter-root,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-conversation-items {gap:8px;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-team-person,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-history-item,
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-team-entry {
  min-height:49px;text-align:left;background:#fff;color:#001d6e;
  border:1px solid #d1e0f2;border-radius:12px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-filter-root > .hgai-team-person::before {content:'›';float:right;color:#64748b;font-size:21px;line-height:1;}
/* The popup panel is the SAME Connect adapter theme and real HG AI modal. */
body.hg-connect-ai-widget-skin-connect #hgai-widget-panel .hgai-client.hgai-popup {
  background:#fff;border:1px solid #d9e4f3;box-shadow:0 14px 46px rgba(0,29,110,.18);
  border-radius:17px;overflow:hidden;
}
body.hg-connect-ai-widget-skin-connect #hgai-widget-panel .hgai-client.hgai-popup .hgai-chat-head {
  min-height:68px;background:linear-gradient(180deg,#fff,#f7faff);color:#17233d;
  border-bottom:1px solid #dfe7f2;padding:12px;gap:10px;
}
body.hg-connect-ai-widget-skin-connect #hgai-widget-panel .hgai-client.hgai-popup .hgai-chat-brand strong {
  display:inline-flex;align-items:center;max-width:100%;min-height:34px;padding:7px 12px;
  background:#d9e6f8;color:#001d6e;border-radius:999px;
  border:1px solid rgba(0,29,110,.16);font-weight:850;
}
body.hg-connect-ai-widget-skin-connect #hgai-widget-panel .hgai-client.hgai-popup .hgai-chat-brand small {color:#536d8d;}
body.hg-connect-ai-widget-skin-connect #hgai-widget-panel .hgai-client.hgai-popup .hgai-chat-head .hgai-avatar {
  background:#e3efff;color:#001d6e;border:1px solid #c4d9f3;border-radius:11px;
}


/* First row: menu and room-title pill only. The assistant icon moves to the
 * separate context row below the tab controls. HG AI original mode untouched. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hgai-chat-head .hgai-avatar {display:none;}
/* PATCH 040 — native HG AI composer remains unmodified by the Connect adapter. */
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-space {
  display:grid;gap:8px;min-width:0;padding:13px 16px 10px;
  background:linear-gradient(180deg,#fff,#f8fbff);border-bottom:1px solid #dce7f5;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-title-row {
  display:flex;align-items:center;gap:11px;min-width:0;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-icon {
  flex:0 0 43px;display:grid;place-items:center;width:43px;height:43px;
  border:1px solid #bdd3f0;border-radius:13px;background:#dae9fa;color:#0f558e;font-size:25px;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-name {
  flex:1 1 auto;min-width:0;font-size:clamp(14px,2.5vw,18px);color:#001d6e;
  font-weight:800;overflow-wrap:anywhere;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-actions {
  display:flex;gap:4px;flex:0 0 auto;align-items:center;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client :is(.hg-connect-ai-conversation-refresh,.hg-connect-ai-conversation-sidebar) {
  display:inline-flex;justify-content:center;align-items:center;min-width:38px;min-height:38px;
  padding:6px;border:0;border-radius:10px;color:#001d6e;background:transparent;
  font-size:22px;cursor:pointer;white-space:nowrap;
}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-refresh {font-size:0;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-refresh::before {content:'↻';font-size:25px;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-sidebar {font-size:30px;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client :is(.hg-connect-ai-conversation-refresh,.hg-connect-ai-conversation-sidebar):focus-visible {outline:2px solid #7fb5ff;outline-offset:2px;}
:is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-space-label {
  justify-self:start;max-width:100%;border:1px solid #c9dcf4;padding:6px 13px;border-radius:999px;
  font-size:12px;font-weight:750;color:#001d6e;background:#e8f2ff;
}
@media(max-width:480px){
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-space{padding:10px 8px 9px;}
  :is(.hg-connect-wrapper .hg-connect-chat-template--connect, body.hg-connect-ai-widget-skin-connect #hgai-widget-panel) .hgai-client .hg-connect-ai-conversation-title-row{gap:6px;}
}
