/* AI assistant widget (public portal and staff workspace). */
.hub-ai { --ai-ink: #1d2433; --ai-muted: #4d5869; --ai-line: #d5dbe3; --ai-bg: #ffffff; --ai-soft: #f1f5f9; --ai-brand: #1f7098; --ai-brand-2: #17516e; --ai-amber: #d8b65c;
  position: fixed; right: 20px; bottom: 20px; z-index: 1080; font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
[data-bs-theme="dark"] .hub-ai { --ai-ink: #e6edf5; --ai-muted: #aab4c3; --ai-line: #334155; --ai-bg: #111827; --ai-soft: #1f2937; }
.hub-ai-fab { display: inline-flex; align-items: center; gap: .55rem; border: 0; border-radius: 999px; padding: .8rem 1.15rem; min-height: 52px;
  background: linear-gradient(135deg, #2179a6, #1f7098); color: #fff; font-weight: 700; font-size: 1rem; box-shadow: 0 10px 30px rgba(13, 47, 63, .35), inset 0 -3px 0 var(--ai-amber); cursor: pointer; }
.hub-ai-fab i { font-size: 1.2rem; color: var(--ai-amber); }
.hub-ai-fab:hover { filter: brightness(1.08); }
.hub-ai.is-open .hub-ai-fab { display: none; }
.hub-ai-panel { width: min(400px, calc(100vw - 24px)); height: min(620px, calc(100vh - 40px)); display: flex; flex-direction: column; background: var(--ai-bg); color: var(--ai-ink);
  border: 1px solid var(--ai-line); border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .28); overflow: hidden; }
.hub-ai-panel[hidden] { display: none; }
.hub-ai-head { display: flex; align-items: center; gap: .65rem; padding: .85rem .9rem; background: linear-gradient(135deg, #2179a6, #1f7098); color: #fff; border-bottom: 3px solid var(--ai-amber); }
.hub-ai-head h2 { font-size: 1rem; margin: 0; font-weight: 700; color: #fff; }
.hub-ai-head p { margin: 0; font-size: .78rem; color: #fff; line-height: 1.3; }
.hub-ai-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .15); display: flex; align-items: center; justify-content: center; flex: none; color: var(--ai-amber); }
.hub-ai-icon { margin-left: auto; background: transparent; border: 0; color: #fff; width: 36px; height: 36px; border-radius: 8px; flex: none; }
.hub-ai-icon + .hub-ai-icon { margin-left: 0; }
.hub-ai-icon:hover { background: rgba(255, 255, 255, .12); }
.hub-ai-log { flex: 1; overflow-y: auto; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .7rem; background: var(--ai-soft); outline: none; }
.hub-ai-msg { max-width: 88%; padding: .65rem .85rem; border-radius: 14px; font-size: .92rem; line-height: 1.5; word-wrap: break-word; }
.hub-ai-msg p { margin: 0 0 .45rem; } .hub-ai-msg p:last-child { margin-bottom: 0; }
.hub-ai-msg ol, .hub-ai-msg ul { margin: .25rem 0 .45rem; padding-left: 1.2rem; }
.hub-ai-msg code { background: rgba(31, 112, 152, .1); padding: 0 .3rem; border-radius: 4px; font-size: .85em; color: inherit; }
.hub-ai-msg a { color: var(--ai-brand); font-weight: 600; }
[data-bs-theme="dark"] .hub-ai-msg a { color: #8ec9ea; }
.hub-ai-user { align-self: flex-end; background: var(--ai-brand); color: #fff; border-bottom-right-radius: 4px; }
.hub-ai-assistant { align-self: flex-start; background: var(--ai-bg); border: 1px solid var(--ai-line); border-bottom-left-radius: 4px; }
.hub-ai-notice { font-size: .78rem; color: #8a5300; background: #fff6e0; border-radius: 8px; padding: .35rem .5rem; margin-bottom: .45rem; }
.hub-ai-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.hub-ai-chips button { border: 1px solid var(--ai-line); background: var(--ai-soft); color: var(--ai-ink); border-radius: 999px; padding: .35rem .7rem; font-size: .8rem; min-height: 32px; }
.hub-ai-chips button:hover { border-color: var(--ai-brand); color: var(--ai-brand); }
.hub-ai-rate { display: flex; align-items: center; gap: .2rem; margin-top: .4rem; font-size: .75rem; color: var(--ai-muted); }
.hub-ai-rate button { border: 0; background: transparent; color: var(--ai-muted); width: 30px; height: 30px; border-radius: 6px; }
.hub-ai-rate button:hover, .hub-ai-rate button.on { color: var(--ai-brand); background: rgba(31, 112, 152, .1); }
.hub-ai-typing { display: flex; gap: 4px; align-items: center; }
.hub-ai-typing span:not(.visually-hidden) { width: 7px; height: 7px; border-radius: 50%; background: var(--ai-muted); animation: hubAiDot 1.2s infinite ease-in-out; }
.hub-ai-typing span:nth-child(2) { animation-delay: .15s; } .hub-ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hubAiDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .hub-ai-typing span { animation: none !important; } }
.hub-ai-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--ai-line); background: var(--ai-bg); }
.hub-ai-form textarea { flex: 1; resize: none; border: 1px solid #8a96a8; border-radius: 12px; padding: .6rem .75rem; font-size: .95rem; min-height: 44px; background: var(--ai-bg); color: var(--ai-ink); }
.hub-ai-send { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--ai-brand); color: #fff; flex: none; }
.hub-ai-send:disabled { opacity: .5; }
.hub-ai-foot { margin: 0; padding: 0 .9rem .6rem; font-size: .7rem; color: var(--ai-muted); background: var(--ai-bg); }
.hub-ai :focus-visible { outline: 3px solid var(--ai-amber); outline-offset: 2px; }
@media (max-width: 575px) {
  .hub-ai { right: 12px; bottom: 12px; }
  .hub-ai.is-open { right: 0; bottom: 0; left: 0; top: 0; }
  .hub-ai-panel { width: 100vw; height: 100dvh; border-radius: 0; }
  .hub-ai-fab span { display: none; }
  .hub-ai-fab { padding: 0; width: 56px; height: 56px; justify-content: center; }
}

.hub-ai-sources { margin-top: .5rem; font-size: .76rem; color: var(--ai-muted); display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.hub-ai-sources a, .hub-ai-sources .hub-ai-src { border: 1px solid var(--ai-line); border-radius: 999px; padding: .05rem .5rem; text-decoration: none; color: inherit; background: var(--ai-soft); }
.hub-ai-sources a:hover { border-color: var(--ai-brand); color: var(--ai-brand); }

/* Answer length, copy / retry, suggestions note, phone lock */
.hub-ai-tools { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; padding: .4rem .7rem 0; background: var(--ai-bg); font-size: .78rem; color: var(--ai-muted); }
.hub-ai-tools select { border: 1px solid var(--ai-line); border-radius: 8px; background: var(--ai-bg); color: var(--ai-ink); font-size: .8rem; padding: .2rem 1.6rem .2rem .5rem; min-height: 32px; }
.hub-ai-copy, .hub-ai-retry { border: 0; background: transparent; color: var(--ai-muted); border-radius: 6px; min-height: 30px; }
.hub-ai-copy { width: 30px; margin-left: auto; }
.hub-ai-retry { padding: 0 .5rem; font-weight: 600; color: var(--ai-brand); }
.hub-ai-copy:hover, .hub-ai-retry:hover { background: rgba(31, 112, 152, .1); color: var(--ai-brand); }
.hub-ai-hint { margin: .45rem 0 0; font-size: .74rem; color: var(--ai-muted); }
.hub-ai-msg { font-size: clamp(.9rem, .86rem + .15vw, .97rem); }
html.hub-ai-lock, html.hub-ai-lock body { overflow: hidden; }
[data-bs-theme="dark"] .hub-ai-notice { color: #f3c97b; background: rgba(243, 176, 124, .12); }
@media (max-width: 575px) { .hub-ai-panel { height: 100vh; height: 100dvh; } .hub-ai-form textarea { font-size: 16px; } }
