/* WatchFlow Help button + panel (2026-10-28). Tokens only, so it follows Day / Night.
   Rhythm (spacing guardrail): 24px sections, 12px label -> field, 16px rows, 8px status line. */
.wf-help-btn {
  position: fixed; right: 24px; bottom: 24px; z-index: 1150;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 16px 0 12px; min-width: 44px;
  border-radius: var(--radius-pill, 999px); border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--white);
  font: 600 13.5px/1 var(--font-body); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.16);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.wf-help-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(0,0,0,.2); }
.wf-help-btn:focus-visible { outline: 2px solid var(--accent, var(--gold)); outline-offset: 2px; }
.wf-help-btn.is-open { background: var(--accent, var(--gold)); color: var(--on-accent, #0a0a0b); border-color: transparent; }
.wf-help-btn svg { flex-shrink: 0; }
.wf-help-btn.is-capturing, .wf-help-panel.is-capturing { visibility: hidden !important; }

.wf-help-panel {
  position: fixed; right: 24px; bottom: 80px; z-index: 1151;
  width: 400px; max-width: calc(100vw - 32px);
  height: min(640px, calc(100vh - 120px));
  display: flex; flex-direction: column;
  background: var(--bg-base); color: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-lg, 14px);
  box-shadow: 0 18px 48px rgba(0,0,0,.24);
  font-family: var(--font-body); overflow: hidden;
}
.wf-help-panel[hidden] { display: none !important; }
.wf-help-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border);
}
.wf-help-title { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.wf-help-tabs.inv-kind-switch { margin: 0; flex: 0 1 auto; }
.wf-help-tabs .inv-kind-tab { padding: 8px 14px; min-height: 36px; }
.wf-help-x {
  margin-left: auto; width: 36px; height: 36px; min-height: 36px; padding: 0; flex: 0 0 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
}
.wf-help-x:hover { color: var(--white); background: var(--bg-hover); }
.wf-help-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.wf-help-pane[hidden] { display: none !important; }

/* Assistant */
.wf-help-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.wf-help-empty { margin: auto 0; display: flex; flex-direction: column; gap: 8px; }
.wf-help-empty-title { font-size: 16px; font-weight: 700; }
.wf-help-empty-sub { font-size: 13px; color: var(--muted); line-height: 1.45; }
.wf-help-sugg { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.wf-help-chip {
  text-align: left; padding: 12px 14px; min-height: 44px; border-radius: var(--radius, 10px);
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--white);
  font: 500 13.5px/1.35 var(--font-body); cursor: pointer;
}
.wf-help-chip:hover { border-color: var(--accent, var(--gold)); }
.wf-help-msg { display: flex; }
.wf-help-msg.is-user { justify-content: flex-end; }
.wf-help-bubble { max-width: 88%; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.wf-help-msg.is-user .wf-help-bubble { background: var(--accent, var(--gold)); color: var(--on-accent, #0a0a0b); border-bottom-right-radius: 4px; }
.wf-help-msg.is-bot .wf-help-bubble { background: var(--bg-raised); border: 1px solid var(--border); border-bottom-left-radius: 4px; max-width: 100%; width: 100%; }
.wf-help-msg.is-canned .wf-help-bubble { color: var(--off-white); }
.wf-help-reply { margin: 0; }
.wf-help-steps { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.wf-help-steps li { padding-left: 4px; }
.wf-help-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.wf-help-go {
  display: inline-flex; align-items: center; min-height: 36px; padding: 8px 14px;
  border-radius: var(--radius-pill, 999px); border: 1px solid var(--accent, var(--gold));
  color: var(--accent, var(--gold)); background: transparent; text-decoration: none;
  font: 600 13px/1.2 var(--font-body); cursor: pointer;
}
.wf-help-go:hover { background: var(--accent, var(--gold)); color: var(--on-accent, #0a0a0b); }
.wf-help-video-btn { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 8px 14px; border-radius: var(--radius-pill, 999px); border: 1px solid var(--border); background: var(--bg-base); color: var(--white); font: 600 13px var(--font-body); cursor: pointer; }
.wf-help-msg-foot { margin-top: 12px; display: flex; justify-content: flex-end; }
.wf-help-report { border: 0; background: transparent; color: var(--muted); font: 500 12px var(--font-body); cursor: pointer; padding: 4px 0; min-height: 28px; text-decoration: underline; text-underline-offset: 3px; }
.wf-help-report.is-strong { color: var(--accent, var(--gold)); font-weight: 700; }
.wf-help-typing { display: inline-flex; gap: 4px; width: auto !important; }
.wf-help-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: wfHelpDot 1s infinite ease-in-out; }
.wf-help-typing i:nth-child(2) { animation-delay: .15s; } .wf-help-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes wfHelpDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.wf-help-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px 8px; border-top: 1px solid var(--border); }
.wf-help-input {
  flex: 1 1 auto; resize: none; min-height: 44px; max-height: 120px; padding: 11px 14px;
  border-radius: 22px; border: 1px solid var(--border); background: var(--bg-raised); color: var(--white);
  font: 400 14px/1.4 var(--font-body);
}
.wf-help-input:focus { outline: none; border-color: var(--accent, var(--gold)); }
.wf-help-send { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent, var(--gold)); color: var(--on-accent, #0a0a0b); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.wf-help-send:disabled { opacity: .5; cursor: default; }
.wf-help-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px 12px; }
.wf-help-fine { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.wf-help-link-btn { border: 0; background: transparent; color: var(--accent, var(--gold)); font: 600 12.5px var(--font-body); cursor: pointer; padding: 8px 0; min-height: 36px; }

/* Feedback */
.wf-help-fb-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 24px; }
.wf-help-sec { display: flex; flex-direction: column; gap: 12px; }
.wf-help-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.wf-help-shot-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 88px;
  border-radius: var(--radius-lg, 14px); border: 1.5px dashed var(--border-light, var(--border));
  background: var(--bg-raised); color: var(--white); font: 600 14px var(--font-body); cursor: pointer;
}
.wf-help-shot-btn:hover { border-color: var(--accent, var(--gold)); }
.wf-help-shot-btn[hidden], .wf-help-shot[hidden], .wf-help-from[hidden], [hidden].wf-help-fine { display: none !important; }
.wf-help-shot { display: flex; flex-direction: column; gap: 8px; }
.wf-help-shot-img { width: 100%; max-height: 220px; object-fit: contain; object-position: top; border-radius: var(--radius, 10px); border: 1px solid var(--border); background: var(--bg-raised); }
.wf-help-shot-acts { display: flex; gap: 16px; }
.wf-help-from { font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius-sm, 8px); background: var(--bg-raised); border: 1px solid var(--border); color: var(--off-white); }
.wf-help-fbtext { width: 100%; box-sizing: border-box; min-height: 104px; resize: vertical; padding: 12px 14px; border-radius: var(--radius, 10px); border: 1px solid var(--border); background: var(--bg-raised); color: var(--white); font: 400 14px/1.45 var(--font-body); }
.wf-help-fbtext:focus { outline: none; border-color: var(--accent, var(--gold)); }
.wf-help-ctx-box summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--off-white); min-height: 28px; }
.wf-help-ctx { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wf-help-ctx li { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; color: var(--muted); }
.wf-help-ctx li strong { color: var(--white); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.wf-help-fb-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.wf-help-status { flex: 1 1 auto; font-size: 12.5px; color: var(--off-white); line-height: 1.4; }
.wf-help-primary { min-height: 44px; padding: 0 24px; border-radius: var(--radius-pill, 999px); border: 0; background: var(--accent, var(--gold)); color: var(--on-accent, #0a0a0b); font: 700 14px var(--font-body); cursor: pointer; }
.wf-help-primary:disabled { opacity: .5; cursor: default; }

/* Drawing editor (full screen) */
.wf-help-editor { position: fixed; inset: 0; z-index: 1200; display: flex; flex-direction: column; background: rgba(10,10,12,.92); color: #fff; font-family: var(--font-body); }
.wf-help-ed-hint { padding: 16px 24px 8px; font-size: 13.5px; text-align: center; opacity: .85; }
.wf-help-ed-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 16px; }
.wf-help-ed-canvas { max-width: 100%; max-height: 100%; touch-action: none; cursor: crosshair; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #fff; }
.wf-help-ed-bar { display: flex; align-items: center; gap: 12px; padding: 12px 24px calc(16px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
.wf-help-ed-tools.inv-kind-switch { margin: 0; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.wf-help-ed-tools .inv-kind-tab { color: rgba(255,255,255,.75); min-height: 40px; }
.wf-help-ed-tools .inv-kind-tab.active { background: #fff; color: #111; }
.wf-help-ed-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: transparent; color: #fff; font: 600 13.5px var(--font-body); cursor: pointer; }
.wf-help-ed-gap { flex: 1 1 auto; }

.wf-help-video-ov { position: fixed; inset: 0; z-index: 1210; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; padding: 16px; }
.wf-help-video-box { position: relative; width: min(960px, 100%); aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.wf-help-video-box video, .wf-help-video-box iframe { width: 100%; height: 100%; border: 0; }
.wf-help-video-box .wf-help-x { position: absolute; top: 8px; right: 8px; z-index: 1; background: rgba(0,0,0,.5); color: #fff; }

/* Phone: icon-only round button; the panel is a bottom sheet over the page. */
@media (max-width: 768px) {
  .wf-help-btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .wf-help-btn-txt { display: none; }
  .wf-help-panel { left: 0; right: 0 !important; bottom: 0 !important; top: auto; width: 100%; max-width: 100%;
    height: calc(100dvh - 56px); max-height: calc(100vh - 56px); border-radius: 18px 18px 0 0; border-bottom: 0; }
  .wf-help-compose, .wf-help-fb-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  html.wf-help-open .wf-help-btn { display: none; }
  /* A sheet, dialog or drawer is open: its own buttons sit at the bottom of the phone, so the Help button steps aside. */
  body:has(.modal-overlay.open, .action-modal-overlay.open, .deal-drawer-overlay.open, .wf-lf-page.wf-lf-open, #page-inventory.inv-filters-open, .unified-fab.open, .wf-help-editor) .wf-help-btn:not(.is-open) { display: none; }
  .wf-help-ed-bar { padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .wf-help-ed-btn { padding: 0 12px; }
}
@media print { .wf-help-btn, .wf-help-panel { display: none !important; } }
