/* Hub Assistant panel (js/hub-assistant.js). Everything is scoped under .ha- so it can sit on any Hub page. */
.ha-root, .ha-root * { box-sizing: border-box; }
.ha-root { --ha-navy: #1B1F4D; --ha-gold: #F6CF46; --ha-ink: #23283a; --ha-muted: #6b7280; --ha-line: #e4e6f0; --ha-canvas: #f4f5f9;
  --ha-ok: #0f6e56; --ha-ok-bg: #e1f5ee; --ha-warn: #854f0b; --ha-warn-bg: #faeeda; --ha-alert: #a32d2d; --ha-alert-bg: #fceaea;
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang HK', 'Noto Sans HK', sans-serif; color: var(--ha-ink); font-size: 14px; line-height: 1.5; }
.ha-root button { font: inherit; cursor: pointer; }
.ha-root a { color: var(--ha-navy); }

.ha-fab { position: fixed; right: 24px; bottom: 24px; width: 56px; height: 56px; border-radius: 50%; border: 0; z-index: 1100;   /* under the Hub's toasts (1200-4000) */
  background: var(--ha-navy); color: var(--ha-gold); box-shadow: 0 10px 24px rgba(27,31,77,.35); display: flex; align-items: center; justify-content: center; }
.ha-fab:focus-visible { outline: 3px solid var(--ha-gold); outline-offset: 3px; }

.ha-panel { position: fixed; right: 24px; bottom: 96px; width: 420px; height: min(760px, calc(100vh - 120px)); z-index: 1150;
  background: var(--ha-canvas); border-radius: 16px; box-shadow: 0 24px 60px rgba(27,31,77,.28), 0 2px 6px rgba(27,31,77,.12);
  display: flex; flex-direction: column; overflow: hidden; }
.ha-panel[hidden] { display: none; }
.ha-full .ha-panel, .ha-panel.ha-full { right: 0; bottom: 0; width: 100vw; height: 100%; border-radius: 0; }
@media (max-width: 640px) { .ha-panel { right: 0; bottom: 0; width: 100vw; height: 100%; border-radius: 0; } }

.ha-head { background: var(--ha-navy); color: #fff; padding: 14px 14px 14px 16px; display: flex; align-items: center; gap: 10px; }
.ha-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--ha-gold); color: var(--ha-navy); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ha-title { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.ha-title b { font-size: 15px; font-weight: 800; }
.ha-title span { font-size: 12px; color: #c9cde6; }
.ha-iconbtn { width: 40px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: #c9cde6; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ha-iconbtn:hover, .ha-iconbtn:focus-visible { background: rgba(255,255,255,.1); color: #fff; }

.ha-ctx { background: #fff; border-bottom: 1px solid var(--ha-line); padding: 9px 16px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ha-muted); flex-wrap: wrap; }
.ha-chip { background: var(--ha-line); color: var(--ha-navy); font-weight: 700; padding: 4px 10px; border-radius: 99px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ha-body { flex-grow: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ha-body > * { flex-shrink: 0; }   /* a tall card must scroll, never be squashed (overflow:hidden would hide its buttons) */
.ha-row { display: flex; gap: 8px; align-items: flex-start; }
.ha-av { width: 24px; height: 24px; border-radius: 50%; background: var(--ha-gold); flex-shrink: 0; }
.ha-text { font-size: 14px; line-height: 1.55; min-width: 0; overflow-wrap: anywhere; }
.ha-me { align-self: flex-end; max-width: 300px; background: var(--ha-navy); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.ha-indent { margin-left: 32px; }
.ha-err { color: var(--ha-alert); background: var(--ha-alert-bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.ha-typing { color: var(--ha-muted); font-size: 13px; }

.ha-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ha-qbtn { text-align: left; background: #fff; border: 1px solid var(--ha-line); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ha-navy); font-weight: 700; display: flex; flex-direction: column; gap: 2px; min-height: 44px; }
.ha-qbtn span { font-weight: 400; color: var(--ha-muted); font-size: 12px; }
.ha-qbtn:hover, .ha-qbtn:focus-visible { border-color: var(--ha-navy); }

.ha-card { background: #fff; border: 1px solid var(--ha-line); border-radius: 12px; overflow: hidden; }
.ha-card-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--ha-line); font-size: 13px; font-weight: 700; color: var(--ha-navy); }
.ha-card-h a { margin-left: auto; font-size: 12px; white-space: nowrap; }
.ha-kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 10px; padding: 12px 14px; font-size: 13px; }
.ha-kv dt { color: var(--ha-muted); margin: 0; }
.ha-kv dd { margin: 0; overflow-wrap: anywhere; }
.ha-li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--ha-line); font-size: 13px; color: inherit; text-decoration: none; }
.ha-li:last-child { border-bottom: 0; }
a.ha-li:hover, a.ha-li:focus-visible { background: var(--ha-canvas); }
.ha-li-main { flex-grow: 1; min-width: 0; }
.ha-li-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ha-li-main span { color: var(--ha-muted); }
.ha-badge { font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: 99px; white-space: nowrap; background: var(--ha-line); color: var(--ha-navy); }
.ha-badge.alert { background: var(--ha-alert-bg); color: var(--ha-alert); }
.ha-badge.warn { background: var(--ha-warn-bg); color: var(--ha-warn); }
.ha-badge.ok { background: var(--ha-ok-bg); color: var(--ha-ok); }
.ha-foot { display: block; padding: 11px 14px; background: var(--ha-canvas); font-size: 13px; font-weight: 700; text-decoration: none; }
.ha-more { padding: 8px 14px; font-size: 12px; color: var(--ha-muted); }
.ha-choices { display: flex; flex-direction: column; gap: 8px; }
.ha-choice { text-align: left; background: #fff; border: 1px solid var(--ha-line); border-radius: 10px; padding: 10px 12px; color: var(--ha-navy); font-weight: 700; display: flex; flex-direction: column; gap: 2px; min-height: 44px; }
.ha-choice span { font-weight: 400; color: var(--ha-muted); font-size: 12px; }
.ha-choice:hover, .ha-choice:focus-visible { border-color: var(--ha-navy); }
.ha-choice:disabled { opacity: .55; cursor: default; }
.ha-opened { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--ha-line); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.ha-opened svg { color: var(--ha-ok); flex-shrink: 0; }

.ha-compose { background: #fff; border-top: 1px solid var(--ha-line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ha-bar { display: flex; align-items: center; gap: 8px; }
.ha-input { flex-grow: 1; min-width: 0; height: 40px; border: 1px solid var(--ha-line); border-radius: 10px; padding: 0 12px; font-size: 14px; background: var(--ha-canvas); color: var(--ha-ink); font-family: inherit; }
.ha-input:focus { outline: 2px solid var(--ha-navy); outline-offset: 0; background: #fff; }
.ha-btn { width: 40px; height: 40px; border: 1px solid var(--ha-line); border-radius: 10px; background: #fff; color: var(--ha-navy); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ha-btn.ha-send { border: 0; background: var(--ha-navy); color: var(--ha-gold); }
.ha-btn.ha-live { background: var(--ha-alert-bg); color: var(--ha-alert); border-color: var(--ha-alert-bg); }
.ha-btn:disabled { opacity: .5; cursor: default; }
.ha-lang { border: 0; background: none; color: var(--ha-muted); font-size: 11px; padding: 0 2px; text-decoration: underline; }
.ha-note { font-size: 11px; color: var(--ha-muted); text-align: center; }
.ha-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* phase 2: proposal → confirm → result, link card, done today */
.ha-pbody { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ha-plabel { font-size: 11px; font-weight: 700; color: var(--ha-muted); letter-spacing: .5px; text-transform: uppercase; margin-top: 4px; }
.ha-pline { overflow-wrap: anywhere; }
.ha-muted { color: var(--ha-muted); font-weight: 400; }
.ha-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.ha-warnbox { background: var(--ha-warn-bg); color: var(--ha-warn); border-radius: 8px; padding: 8px 10px; font-weight: 600; }
.ha-preview summary { cursor: pointer; font-weight: 700; color: var(--ha-navy); }
.ha-pre { white-space: pre-wrap; background: var(--ha-canvas); border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 12px; overflow-wrap: anywhere; }
.ha-pbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ha-pbtn { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--ha-line); background: #fff; color: var(--ha-navy); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; text-decoration: none; }
.ha-pbtn.ha-gold { background: var(--ha-gold); border-color: var(--ha-gold); color: var(--ha-navy); font-weight: 800; }
.ha-pbtn:disabled { opacity: .5; cursor: default; }
.ha-pbtn:focus-visible, .ha-linkbtn:focus-visible { outline: 2px solid var(--ha-navy); outline-offset: 2px; }
.ha-editf { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.ha-pstatus { font-size: 13px; color: var(--ha-ink); }
.ha-spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--ha-line); border-top-color: var(--ha-navy); border-radius: 50%; animation: ha-spin .8s linear infinite; vertical-align: -2px; }
@keyframes ha-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ha-spin { animation: none; } }
.ha-result { border-color: var(--ha-ok); }
.ha-result .ha-card-h { background: var(--ha-ok-bg); color: var(--ha-ok); }
.ha-result .ha-card-h svg { flex-shrink: 0; }
.ha-dim { opacity: .55; }
.ha-linkbox { width: 100%; font-size: 12px; }
.ha-done { display: flex; flex-direction: column; gap: 6px; }
.ha-doneitem { background: #fff; border: 1px solid var(--ha-line); border-radius: 10px; padding: 8px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.ha-doneitem svg { color: var(--ha-ok); flex-shrink: 0; }
.ha-linkbtn { border: 0; background: none; color: var(--ha-navy); font-weight: 700; font-size: 12px; text-decoration: underline; min-height: 32px; }
