/* Ask Doulos: the help assistant's window (assets/help-chat.js).

   THE DESK AND A TABLET: a small window, bottom right above the round button,
   half the height the side panel used to be (the owner, 2026-10-10). Drag it by
   its title bar, resize it from its corner, minimize it to a one-line pill.
   z-index 945: over a modeless window (940, tms.css) and over the backdrop a
   window raises (900), so the chat stays usable about the window that is open
   (tms-shell.js keeps it out of `inert` for the same reason), and under the
   menubar (950) so the menus still drop down over it.

   A PHONE (html.tms-mobile, the shell view-mobile.js mounts): a bottom sheet over
   the shell's own screens, sheets and drawer (their highest is 121), leaving the
   top of the screen — the part the answer is about — in view. */

.hc-panel {
  position: fixed;
  right: 12px;
  bottom: 128px;
  height: max(260px, calc((100vh - var(--tms-menubar-h, 44px) - 84px) / 2));
  width: min(400px, calc(100vw - 24px));
  min-width: 300px;
  min-height: 200px;
  max-width: calc(100vw - 8px);
  max-height: calc(100vh - var(--tms-menubar-h, 44px) - 8px);
  resize: both;
  display: flex;
  flex-direction: column;
  background: var(--bg, #fff);
  color: var(--ink, #222);
  border: 1px solid var(--line, #d8d8d8);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
  z-index: 945;
  font-size: 13px;
  overflow: hidden;
}
.hc-panel[hidden] { display: none; }
/* Placed by help-chat.js (placeBox): left and top are inline, so the corner grip
   grows it right and down, the way a window's does. */
.hc-panel.hc-placed { right: auto; bottom: auto; }
.hc-head { cursor: move; user-select: none; }
.hc-head .btn, .hc-head .hc-x { cursor: pointer; }

.hc-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line, #d8d8d8); background: var(--panel, #f7f7f5); }
.hc-title { font-size: 14px; }
.hc-gap { flex: 1; }
.hc-x { border: none; background: none; font-size: 16px; line-height: 1; padding: 2px 6px; cursor: pointer; color: var(--mut, #666); }
.hc-meter { padding: 4px 10px; font-size: 12px; color: var(--mut, #666); border-bottom: 1px solid var(--line, #d8d8d8); }
.hc-meter[hidden], .hc-note[hidden], .hc-notice[hidden], .hc-past[hidden], .hc-form[hidden] { display: none; }
.hc-note { padding: 8px 10px; }
.hc-note.warn { background: var(--amber-bg, #fdf3e0); color: #7a4d0b; }
.hc-notice { padding: 10px; background: #eef3fb; border-bottom: 1px solid #cddcf0; display: grid; gap: 8px; }
.hc-notice p { margin: 0; }
.hc-notice .btn { justify-self: start; }

.hc-past { max-height: 45%; overflow-y: auto; border-bottom: 1px solid var(--line, #d8d8d8); padding: 6px 10px; display: grid; gap: 6px; }
.hc-pastrow { display: flex; align-items: center; gap: 6px; }
.hc-pastlab { flex: 1; min-width: 0; display: grid; }
.hc-pastlab b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-mut { color: var(--mut, #666); font-size: 12px; }

.hc-log { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.hc-empty { color: var(--mut, #666); margin: auto 0; }
.hc-msg { border-radius: 8px; padding: 6px 9px; max-width: 92%; }
.hc-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.hc-text code { background: rgba(0, 0, 0, .06); padding: 0 3px; border-radius: 3px; }
.hc-you { align-self: flex-end; background: #e8f0fb; }
.hc-claude { align-self: flex-start; background: var(--panel, #f7f7f5); }
.hc-line { font-size: 12px; }
.hc-tool { color: var(--mut, #666); }
.hc-tool.err, .hc-error { color: var(--red, #c0392b); }
.hc-refused { color: #7a4d0b; background: var(--amber-bg, #fdf3e0); padding: 6px 9px; border-radius: 8px; }

.hc-form { border-top: 1px solid var(--line, #d8d8d8); padding: 8px 10px; }
.hc-form textarea { width: 100%; box-sizing: border-box; font: inherit; resize: vertical; min-height: 44px; }
.hc-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.hc-busy { color: var(--mut, #666); font-size: 12px; }

/* The phone: a bottom sheet. The bug button sits bottom-right on a phone too,
   over the sheet's last 60px, so the box and Send keep a column clear of it. */
html.tms-mobile .hc-panel {
  left: 0; right: 0; bottom: 0; top: auto;
  width: auto; min-width: 0; max-width: none;
  height: min(48vh, 440px);
  resize: none;
  border-radius: 14px 14px 0 0;
  border-left: none; border-right: none; border-bottom: none;
  z-index: 130;
  font-size: 15px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.tms-mobile .hc-head { min-height: 44px; cursor: default; }
html.tms-mobile .hc-head .btn, html.tms-mobile .hc-x { min-height: 40px; }
html.tms-mobile .hc-form textarea { font-size: 16px; }
html.tms-mobile .hc-form { padding-right: 70px; }
html.tms-mobile .hc-row .btn { min-height: 40px; }

/* ---- The corner door: #hc-fab ------------------------------------------------
   PLACEMENT B (the owner, 2026-10-10): a round blue button directly ABOVE the
   bug button (bug-reporter.css .tmsbug-fab), the same size as it at each tier,
   with a bigger icon inside. Its offsets are the bug button's own plus its
   height and a 10px gap, tier by tier: desk 18 + 44 + 10, tablet 20 + 52 + 10,
   phone 14 + 48 + 10 over the shell's bottom bar (--tmsbug-dock). One z-index
   below the bug button's, so the two never fight. Hidden while the panel is
   open: the panel has its own ✕. */
.hc-fab {
  position: fixed;
  right: 18px;
  bottom: 72px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #2563EB;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  z-index: 2147482999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.hc-fab[hidden], html.hc-open .hc-fab, html.role-guest .hc-fab { display: none; }
.hc-fab svg { width: 34px; height: 34px; flex: none; display: block; }
/* The ? inside the white bubble takes the colour of whatever it sits on. */
.hc-q { stroke: #2563EB; }
.hc-q circle { fill: #2563EB; }
.hc-fab:hover .hc-q { stroke: #1D4ED8; }
.hc-fab:hover .hc-q circle { fill: #1D4ED8; }
.hc-fab:hover { background: #1D4ED8; transform: scale(1.1); box-shadow: 0 4px 12px rgba(37, 99, 235, .45); }
.hc-fab:active { transform: scale(.95); }
.hc-fab:focus-visible { outline: 3px solid #93C5FD; outline-offset: 2px; }
html.tms-tablet .hc-fab { width: 52px; height: 52px; right: 20px; bottom: 82px; }
html.tms-tablet .hc-fab svg { width: 40px; height: 40px; }
html.tms-mobile .hc-fab {
  width: 48px; height: 48px; right: 12px;
  bottom: calc(var(--tmsbug-dock, 0px) + 72px + env(safe-area-inset-bottom, 0px));
}
html.tms-mobile .hc-fab svg { width: 36px; height: 36px; }
@media (prefers-reduced-motion: reduce) {
  .hc-fab { transition: none; }
  .hc-fab:hover, .hc-fab:active { transform: none; }
}
@media print { .hc-fab { display: none !important; } }

/* A walk's steps in the chat: ✓ done, ▶ the one outlined now. */
.hc-walk ol { margin: 4px 0 6px 18px; padding: 0; }
.hc-walk li { margin: 2px 0; }
.hc-walk .btn[hidden] { display: none; }

/* ---- Minimized: one line at the bottom of the screen ------------------------
   Centred, so it is clear of the round button and the bug button on the right. */
.hc-pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  z-index: 945;
  display: flex;
  align-items: center;
  gap: 2px;
  background: #2563EB;
  color: #fff;
  border-radius: 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  padding: 2px 6px 2px 2px;
  max-width: calc(100vw - 150px);
}
.hc-pill[hidden] { display: none; }
.hc-pill-open {
  display: flex; align-items: center; gap: 8px;
  border: none; background: none; color: inherit; font: 600 14px system-ui, sans-serif;
  padding: 6px 10px 6px 8px; cursor: pointer; border-radius: 20px; min-height: 36px; white-space: nowrap;
}
.hc-pill-open:hover { background: rgba(255, 255, 255, .14); }
.hc-pill-open svg { width: 22px; height: 22px; flex: none; }
.hc-pill-state { font-weight: 400; opacity: .85; overflow: hidden; text-overflow: ellipsis; }
.hc-pill-state:empty { display: none; }
.hc-pill .hc-x { color: #fff; min-width: 32px; min-height: 32px; }
html.tms-mobile .hc-pill { bottom: calc(var(--tmsbug-dock, 0px) + 18px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 140px); }
html.tms-mobile .hc-pill-open { min-height: 44px; }
html.tms-mobile .hc-pill .hc-x { min-width: 44px; min-height: 44px; }
@media print { .hc-pill { display: none !important; } }
