/* P400 #158 support chat — one stylesheet for both shells: body.hp--panel (/help/, inside the launcher's panel) and
   body.hp--page (/support/, the full page: a wide reading column, wider code blocks). Colours only through the brand roles
   (palette.css, closed palette); the bubble / composer shapes follow the phone Web App (the web app's app.css:
   round send button, 14 px code blocks with the copy word in a bar above the code). Scrollbars hidden, still scrollable. */
html, body { height: 100%; }
body.hp { min-height: 0; height: 100%; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.hp * { scrollbar-width: none; }
.hp *::-webkit-scrollbar { display: none; }
.hp-noscript { padding: var(--sp-5); }
.hp-app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.hp-col { width: 100%; padding-inline: var(--sp-4); }
.hp--page .hp-col { padding-inline: var(--gutter); }
.hp-ic { width: 18px; height: 18px; flex: none; display: block; }

/* ---- /support/ top bar ---- */
.hp-top { flex: none; display: flex; align-items: center; gap: var(--sp-3); min-height: 56px;
  padding: 0 var(--gutter); padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--border-soft); }
.hp-top__brand { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; color: var(--text);
  text-decoration: none; font: 700 1.05rem/1 var(--font-title); }
.hp-top__brand img { width: 28px; height: 28px; }
.hp-top__title { font: 500 var(--fs-sm)/1.3 var(--font-subtitle); color: var(--text-muted); }

/* ---- tool bar: level · new chat · 中/EN ---- */
.hp-bar { flex: none; border-bottom: 1px solid var(--border-soft); }
.hp-bar__in { display: flex; align-items: center; gap: var(--sp-2); min-height: 52px; }
.hp-bar__gap { flex: 1 1 auto; }
.hp-tier { display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--sp-3); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text); font: 500 var(--fs-xs)/1 var(--font-body); white-space: nowrap; }
.hp-tool, .hp-lang { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 var(--sp-3);
  border: 0; border-radius: var(--r-md); background: none; color: var(--text); font: 500 var(--fs-sm)/1 var(--font-body); }
.hp-tool:hover, .hp-lang:hover { background: var(--surface-2); }
.hp-lang { gap: 2px; font-size: var(--fs-xs); letter-spacing: .02em; }
.hp-lang span { color: var(--text-muted); }
.hp-lang[data-on="zh"] .hp-lang__zh, .hp-lang[data-on="en"] .hp-lang__en { color: var(--text); font-weight: 700; }

/* ---- the reading area ---- */
.hp-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-block: var(--sp-4); }
.hp-notice { display: grid; gap: var(--sp-2); padding: var(--sp-4); margin-bottom: var(--sp-5); border-radius: var(--r-lg);
  background: var(--surface-2); font-size: var(--fs-sm); line-height: 1.6; }
.hp-notice__head { display: flex; gap: var(--sp-3); align-items: flex-start; }
.hp-notice__head img { width: 28px; height: 28px; flex: none; margin-top: 1px; }
.hp-notice__hi { font-size: var(--fs-md); line-height: 1.55; }
.hp-notice__line { color: var(--text); }
.hp-notice__privacy { display: flex; gap: var(--sp-2); align-items: flex-start; color: var(--text-muted); }
.hp-notice__privacy .hp-ic { width: 16px; height: 16px; margin-top: 3px; }
.hp-remote { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.hp-remote .hp-ic { width: 16px; height: 16px; }

.hp-log { display: flex; flex-direction: column; gap: var(--sp-4); }
.hp-msg { display: flex; gap: var(--sp-2); align-items: flex-start; min-width: 0; }
.hp-msg--me { flex-direction: column; align-items: flex-end; }
.hp-avatar { width: 24px; height: 24px; flex: none; margin-top: 6px; }
.hp-bubble { min-width: 0; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.hp-msg--me .hp-bubble { background: var(--primary-bg); color: var(--primary-fg); border-bottom-right-radius: 6px; }
.hp-msg--bot .hp-bubble { flex: 1 1 auto; background: var(--surface-1); border: 1px solid var(--border); border-top-left-radius: 6px; }
.hp-plain { white-space: pre-wrap; font-size: var(--fs-md); line-height: 1.6; }
.hp-plainwrap.is-folded .hp-plain { max-height: calc(1.6em * 10); overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.hp-msg--me .hp-fold { color: var(--primary-fg); }
.hp-imgnote { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--fs-xs); opacity: .85; }
.hp-redacted { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); }
.hp-redacted .hp-ic { width: 14px; height: 14px; color: var(--accent); }
.hp-sys { align-self: center; padding: 8px 14px; border-radius: var(--r-md); background: var(--surface-2);
  color: var(--text); font-size: var(--fs-xs); line-height: 1.5; text-align: center; border-left: 3px solid var(--c-peachy-feeling); }
.hp-sys--ok { border-left-color: var(--accent); }

/* Markdown inside a reply (md.js output) */
.hp-md { font-size: var(--fs-md); line-height: 1.65; }
.hp-md > * + * { margin-top: .7em; }
.hp-md :is(h1, h2, h3, h4) { font-size: 1.05em; line-height: 1.35; margin-top: 1em; }
.hp-md :is(ul, ol) { padding-left: 1.3em; }
.hp-md li + li { margin-top: .25em; }
.hp-md blockquote { padding-left: .8em; border-left: 3px solid var(--border); color: var(--text-muted); }
.hp-md code.icode { padding: .1em .35em; border-radius: 4px; background: var(--code-bg); font: .9em/1.4 var(--font-mono); cursor: copy; }
.hp-md .lhost { font-size: .85em; color: var(--text-muted); }
.hp-md .tablewrap { max-width: 100%; overflow-x: auto; }
.hp-md table { border-collapse: collapse; font-size: .9em; }
.hp-md :is(th, td) { border: 1px solid var(--border); padding: .35em .6em; text-align: left; vertical-align: top; }
.hp-md hr { margin: 1em 0; }
.hp .codeblock { position: relative; max-width: 100%; margin: .7em 0; border-radius: 14px; overflow: hidden;
  background: var(--code-bg); display: flex; flex-direction: column; }
.hp .codeblock .bar { display: flex; align-items: center; min-height: 44px; padding: 0 14px; }
.hp .codeblock .lang { font: 500 12px/1 var(--font-mono); letter-spacing: .04em; color: var(--text-muted); }
.hp .codeblock .copy { position: relative; margin-left: auto; padding: 4px 8px; border: 0; border-radius: 6px;
  background: var(--bg); color: var(--text); font: 500 var(--fs-xs)/1 var(--font-body); }
.hp .codeblock .copy::after { content: ""; position: absolute; inset: -10px -12px; }   /* ≥ 44 px target, word-sized mark */
.hp .codeblock .copy.done { background: var(--c-shield-soft); color: var(--c-sooty); }
.hp .codeblock pre { margin: 0; padding: 4px 14px 14px; overflow-x: auto; overscroll-behavior-x: contain; }
.hp .codeblock pre code { display: block; width: max-content; min-width: 100%; font: 400 13.5px/1.55 var(--font-mono); white-space: pre; tab-size: 4; }
.hp--page .hp .codeblock pre code, .hp--page .codeblock pre code { font-size: 14.5px; }
.hp .codeblock.is-folded pre { max-height: calc(1.55em * 12 + 18px); overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.hp .mddetails summary { cursor: pointer; min-height: 32px; }
.hp-fold { align-self: flex-start; min-height: 40px; padding: 0 14px; border: 0; background: none; color: var(--link);
  font: 500 var(--fs-xs)/1 var(--font-body); text-decoration: underline; text-decoration-color: var(--link-underline); text-underline-offset: .2em; }
.hp-plainwrap .hp-fold { padding: 0; }

/* source chips */
.hp-srcs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px dashed var(--border-soft); }
.hp-srcs__label { font-size: var(--fs-xs); color: var(--text-muted); margin-right: 2px; }
.hp-src { display: inline-flex; align-items: center; max-width: 100%; min-height: 32px; padding: 0 10px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text); font-size: var(--fs-xs); text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--border-soft); }
.hp-src:hover { border-color: var(--link-underline); }

/* waiting for an answer */
.hp-typing .hp-bubble { flex: 0 1 auto; display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-muted); font-size: var(--fs-sm); }
.hp-typing { margin-top: var(--sp-4); }
.hp-dots { display: inline-flex; gap: 4px; }
.hp-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: hp-breathe 1.4s ease-in-out infinite; }
.hp-dots i:nth-child(2) { animation-delay: .18s; } .hp-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes hp-breathe { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .hp-dots i { animation: none; opacity: .7; } }

/* human check */
.hp-human { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); background: var(--surface-2); }
.hp-human__t { font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.hp-human__frame { display: block; width: 100%; height: 120px; border: 0; border-radius: var(--r-md); background: var(--bg); }

/* ---- the dock: sheet · quick entries · composer · status ---- */
.hp-dock { flex: none; border-top: 1px solid var(--border-soft); background: var(--bg);
  padding-top: var(--sp-3); padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom)); }
.hp-quick { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding-bottom: var(--sp-3); }
.hp-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 500 var(--fs-xs)/1 var(--font-body); white-space: nowrap; position: relative; max-width: 100%; }
.hp-chip span { overflow: hidden; text-overflow: ellipsis; }
.hp-chip::after { content: ""; position: absolute; inset: -4px 0; }   /* 44 px tall target */
.hp-chip .hp-ic { width: 16px; height: 16px; }
.hp-chip:hover, .hp-chip[aria-expanded="true"] { background: var(--surface-2); }

.hp-sheet { position: relative; margin-bottom: var(--sp-3); padding: var(--sp-4); padding-right: 52px; border-radius: var(--r-lg);
  background: var(--surface-2); display: grid; gap: var(--sp-3); }
.hp-sheet__t { font: 700 var(--fs-md)/1.3 var(--font-title); }
.hp-sheet__p { font-size: var(--fs-sm); line-height: 1.6; }
.hp-sheet__ok { color: var(--text); }
.hp-sheet__err { font-size: var(--fs-sm); color: var(--danger); border-left: 3px solid var(--danger-line, var(--danger)); padding-left: var(--sp-2); }
.hp-sheet__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); }
.hp-sheet__form--col { flex-direction: column; align-items: stretch; }
.hp-sheet__x { position: absolute; top: 6px; right: 6px; }
.hp-fieldrow { flex: 1 1 200px; display: grid; gap: 6px; }
.hp-label { font-size: var(--fs-xs); color: var(--text-muted); }
.hp-text { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg); color: var(--text); font-size: 16px; }
.hp-text--code { letter-spacing: .3em; font-family: var(--font-mono); }
.hp-text--note { resize: vertical; min-height: 88px; line-height: 1.5; }
.hp-btn { min-height: 44px; padding: 0 var(--sp-4); border: 0; border-radius: var(--r-md); background: var(--primary-bg); color: var(--primary-fg);
  font: 500 var(--fs-sm)/1 var(--font-body); white-space: nowrap; }
.hp-btn--quiet { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.hp-actions { display: flex; gap: var(--sp-3); }
.hp-link { justify-self: start; min-height: 44px; padding: 0; border: 0; background: none; color: var(--link); font-size: var(--fs-sm);
  text-decoration: underline; text-decoration-color: var(--link-underline); text-underline-offset: .2em; }
.hp-x { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--text); }
.hp-x:hover { background: var(--bg); }

.hp-tray { display: flex; gap: var(--sp-2); padding-bottom: var(--sp-3); }
.hp-thumb { display: flex; align-items: center; gap: var(--sp-2); max-width: 100%; padding: 4px 4px 4px 4px; border-radius: 12px;
  border: 1px solid var(--border); font-size: var(--fs-xs); }
.hp-thumb img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.hp-thumb span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hp-composer { display: flex; align-items: flex-end; gap: var(--sp-2); }
.hp-field { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; min-height: 48px; border-radius: 24px;
  background: var(--surface-2); border: 1px solid transparent; }
.hp-field:focus-within { border-color: var(--border); }
.hp-input { width: 100%; min-height: 46px; max-height: 260px; padding: 12px 18px; border: 0; background: none; resize: none;
  color: var(--text); font-size: 16px; line-height: 1.4; }
.hp-input:focus-visible { outline: 0; }
.hp-input::placeholder { color: var(--text-muted); opacity: 1; }
.hp-send, .hp-attach { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; border: 0; }
.hp-send { background: var(--primary-bg); color: var(--primary-fg); }
.hp-send .hp-ic { width: 22px; height: 22px; }
.hp-send:disabled { background: var(--surface-2); color: var(--text-muted); cursor: default; }
.hp-send:not(:disabled):active { transform: scale(.94); }
.hp-attach { background: none; color: var(--text); border: 1px dashed var(--border); }
.hp-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hp-status { display: flex; justify-content: space-between; gap: var(--sp-3); min-height: 24px; padding: 6px 4px 0;
  font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hp-count.is-over { color: var(--danger); font-weight: 700; }
.hp-wait.is-wait { color: var(--text); font-weight: 500; }

/* ---- the panel (inside the launcher): a little tighter ---- */
.hp--panel .hp-col { padding-inline: 14px; }
.hp--panel .hp-bar__in { min-height: 48px; }
.hp--panel .hp-notice { padding: 14px; }
@media (max-width: 380px) { .hp-tool span { display: none; } }

/* ---- the full page on a large screen: the reading column breathes ---- */
.hp--page .hp-scroll { padding-block: var(--sp-6); }
@media (min-width: 900px) {
  .hp--page .hp-md, .hp--page .hp-plain { font-size: 1.0625rem; }
  .hp--page .hp-notice { padding: var(--sp-5); }
}
/* P400 queue (10-20): a message sent inside the pace window waits here, then goes out by itself */
.hp-msg--queued .hp-bubble { background: var(--surface-2); color: var(--text); border: 1px dashed var(--border); border-bottom-right-radius: 6px; }
.hp-msg--queued .hp-fold { color: var(--text); }
.hp-queue { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }
.hp-queue__t { font-variant-numeric: tabular-nums; }
.hp-qbtn { min-height: 44px; min-width: 44px; padding: 0 var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.hp-qbtn:hover { border-color: var(--accent); }
.hp-qbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
