/* Extracted verbatim from templates/onboarding.html (Foundation Stage 3B-1, 2026-09-08).
   Contiguous slice, cascade-preserved. Do not reorder relative to the other onboarding/styles/*.css files. */
  /* ── XkroX Assistant — persistent floating work panel ────────────────
     Scoped entirely to #obAi*. Body-level fixed element; no coupling to
     onboarding screen IDs, so the same shell can host a workspace context
     later. Presentation only — behaviour lives in the assistant IIFE. */
  #obAiDock {
    --obai-ink: #16150f; --obai-ink-2: #2b2a26; --obai-muted: #8a8578;
    --obai-line: #e6e2d6; --obai-paper: #f4f2ec; --obai-paper-2: #faf8f2;
    --obai-shadow: 0 1px 2px rgba(20,18,10,.05), 0 20px 56px -12px rgba(20,18,10,.22);
    --obai-radius: 20px;
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: max(20px, env(safe-area-inset-bottom));
    width: min(824px, calc(100vw - 40px));
    z-index: 900;
    font: 400 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
    color: var(--obai-ink-2);
  }
  #obAiDock[hidden] { display: none; }

  #obAiDock :focus-visible {
    outline: 2px solid var(--obai-ink); outline-offset: 2px; border-radius: 8px;
  }

  /* ── panel ──────────────────────────────────────────────────────── */
  #obAiPanel {
    background: #fff;
    border: 1px solid var(--obai-line); border-bottom: none;
    border-radius: var(--obai-radius) var(--obai-radius) 0 0;
    box-shadow: var(--obai-shadow);
    display: flex; flex-direction: column; overflow: hidden;
    max-height: min(62vh, 620px);
    opacity: 1; transition: max-height .2s cubic-bezier(.22,.61,.36,1), opacity .16s ease;
  }
  #obAiPanel[hidden] { display: none; }
  #obAiDock[data-mode="collapsed"] #obAiPanel { max-height: 0; opacity: 0; min-height: 0; }
  /* a genuine working surface — real presence even with little content */
  #obAiDock[data-mode="expanded"] #obAiPanel { min-height: 216px; }

  #obAiHead {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 10px 13px 18px; border-bottom: 1px solid var(--obai-line); flex: none;
  }
  #obAiTitle { font-size: 13px; font-weight: 600; letter-spacing: -.005em; color: var(--obai-ink); }
  #obAiHeadActions { display: flex; gap: 2px; }
  #obAiHead button {
    border: none; background: none; cursor: pointer; color: var(--obai-muted);
    width: 30px; height: 30px; border-radius: 8px; font-size: 15px; line-height: 1; padding: 0;
    display: flex; align-items: center; justify-content: center;
  }
  #obAiHead button:hover { background: var(--obai-paper); color: var(--obai-ink); }

  #obAiBody {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 16px 18px 18px; scroll-behavior: smooth;
  }
  #obAiLog { display: flex; flex-direction: column; gap: 15px; }

  /* conversation — quiet, typographic, not WhatsApp */
  #obAiLog .m { font-size: 14px; line-height: 1.5; animation: obAiFade .16s ease both; }
  #obAiLog .m.user {
    align-self: flex-end; max-width: 82%;
    background: var(--obai-paper); color: var(--obai-ink);
    padding: 8px 13px; border-radius: 14px 14px 3px 14px;
  }
  #obAiLog .m.ai { align-self: stretch; color: var(--obai-ink-2); }
  /* Contrast fix — was color: var(--obai-muted) (#8a8578 on this panel's
     cream background is ~2.7:1, well under WCAG AA for normal text; the
     exact "barely visible 'Working…'" pattern this round flags). Full
     high-contrast ink now, matching every other AI message bubble. */
  #obAiLog .m.think { align-self: flex-start; color: var(--obai-ink-2); font-size: 13px; }
  #obAiLog .m.think::after { content: "…"; animation: obAiEllipsis 1.1s steps(4) infinite; }

  /* rich result cards inside the work area */
  #obAiCand { margin-top: 15px; }
  #obAiCand[hidden] { display: none; }
  #obAiCard {
    border: 1px solid var(--obai-line); border-radius: 14px; overflow: hidden; background: #fff;
    animation: obAiFade .18s ease both;
  }
  #obAiCard .ch { padding: 12px 14px 10px; }
  #obAiCard .ch-t { font-size: 13px; font-weight: 600; color: var(--obai-ink); }
  #obAiCard .ch-s { font-size: 12px; color: var(--obai-muted); margin-top: 2px; }
  #obAiCard .row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 14px; border-top: 1px solid var(--obai-line);
  }
  #obAiCard .row > span:first-child { min-width: 0; }
  #obAiCard .row .rn { display: block; font-size: 13.5px; font-weight: 500; color: var(--obai-ink); }
  #obAiCard .row .rs { display: block; font-size: 12px; color: var(--obai-muted); margin-top: 2px; line-height: 1.4; }
  #obAiCard .row .rp { font-size: 13px; color: var(--obai-ink-2); font-variant-numeric: tabular-nums; }
  #obAiCard .row button {
    border: 1px solid var(--obai-line); background: #fff; color: var(--obai-ink);
    border-radius: 999px; padding: 7px 14px; font-size: 12.5px; white-space: nowrap; cursor: pointer;
  }
  #obAiCard .row button:hover { border-color: var(--obai-ink); }
  #obAiCard .row button.ghost { border-color: transparent; color: var(--obai-muted); }
  #obAiCard .foot {
    display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--obai-line); background: var(--obai-paper-2);
  }
  #obAiCard .foot button {
    border-radius: 999px; padding: 8px 16px; font-size: 12.5px; cursor: pointer;
    border: 1px solid var(--obai-line); background: #fff; color: var(--obai-ink);
  }
  #obAiCard .foot button.primary { background: var(--obai-ink); color: #fff; border-color: var(--obai-ink); }

  /* XkroX UX1.1 (2026-09-08), §1-3 — structured choices rendered AS
     MESSAGE CONTENT inside the chat (category chips, and any future
     AI-asked choice) — never a page-level control bar. */
  #obAiLog .obai-choices {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; animation: obAiFade .18s ease both;
  }
  #obAiLog .obai-choices button {
    border: 1px solid var(--obai-line); background: #fff; color: var(--obai-ink);
    border-radius: 999px; padding: 10px 18px; font-size: 13.5px; cursor: pointer;
  }
  #obAiLog .obai-choices button:hover { border-color: var(--obai-ink); }
  /* Consolidation Step 4 §5 — a direct action in flight disables its own
     button set (not the whole composer) so a double-click can't fire a
     second request while the first is still resolving. */
  #obAiLog .obai-choices button:disabled { opacity: .5; cursor: default; }

  /* Storefront S2 continuation §4/§5 — a generated-image candidate shown
     in-chat, visually distinct from an already-applied asset (dashed
     border + an explicit "Preview" tag) until the merchant approves it. */
  #obAiLog .obai-visual-preview {
    position: relative; margin: 4px 0 2px; border: 1.5px dashed var(--obai-line);
    border-radius: 10px; overflow: hidden; max-width: 240px;
  }
  #obAiLog .obai-visual-preview img { display: block; width: 100%; height: auto; }
  #obAiLog .obai-visual-preview-tag {
    position: absolute; left: 8px; bottom: 8px; background: rgba(20,18,10,.72); color: #fff;
    font-size: 10.5px; padding: 3px 8px; border-radius: 999px; letter-spacing: .01em;
  }

  /* Demo Integration D1 §9-11 — generation is now async and polled; this
     replaces the image while status is 'generating', a subtle loader
     rather than a static "Preview" tag over nothing. */
  #obAiLog .obai-visual-generating {
    display: flex; align-items: center; gap: 8px; padding: 14px 12px;
    background: var(--obai-paper); position: static;
  }
  #obAiLog .obai-visual-generating .obai-visual-preview-tag { position: static; background: none; color: var(--obai-ink-2); padding: 0; font-size: 12px; }
  #obAiLog .obai-visual-loader {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--obai-line); border-top-color: var(--obai-ink-2);
    animation: obaiVisualSpin .8s linear infinite; flex: none;
  }
  @keyframes obaiVisualSpin { to { transform: rotate(360deg); } }

  /* XKROX R4.4 (2026-09-10) — the "Visible Discovery/Enrichment
     Progress" in-chat checklist/card ruleset that used to live here
     (.obai-disc-*) is retired along with the widget itself: discovery/
     enrichment progress now renders exclusively on the LEFT storefront-
     building surface (canvas.css's .bs-banner.is-discovery rules) —
     this RIGHT conversation panel is never interrupted by a progress
     widget again. */

  /* ── contextual shortcut row ────────────────────────────────────── */
  #obAiShortcuts {
    display: flex; gap: 7px; flex-wrap: wrap; padding: 2px 4px 9px;
  }
  #obAiShortcuts[hidden] { display: none; }
  #obAiShortcuts button {
    border: none; background: var(--obai-paper); color: var(--obai-ink-2);
    border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; line-height: 1.3;
  }
  #obAiShortcuts button:hover { background: #ece8dd; color: var(--obai-ink); }

  /* ── composer ───────────────────────────────────────────────────── */
  #obAiComposer {
    position: relative; background: #fff; border: 1px solid var(--obai-line);
    border-radius: var(--obai-radius);
    box-shadow: var(--obai-shadow); padding: 8px 8px 6px;
  }
  #obAiDock[data-mode="expanded"] #obAiComposer {
    border-radius: 0 0 var(--obai-radius) var(--obai-radius); box-shadow: none;
    border-top: 1px solid var(--obai-line);
  }
  #obAiComposer form { display: flex; align-items: flex-end; gap: 4px; }
  #obAiAttach {
    flex: none; border: none; background: none; cursor: pointer; color: var(--obai-muted);
    width: 36px; height: 36px; border-radius: 10px; font-size: 22px; line-height: 1; padding: 0;
  }
  #obAiAttach:hover, #obAiAttach[aria-expanded="true"] { background: var(--obai-paper); color: var(--obai-ink); }
  #obAiAttachMenu {
    position: absolute; left: 8px; bottom: calc(100% + 6px); z-index: 5;
    background: #fff; border: 1px solid var(--obai-line); border-radius: 14px;
    box-shadow: 0 12px 34px -8px rgba(20,18,10,.24); padding: 6px; min-width: 176px;
    animation: obAiFade .14s ease both;
  }
  #obAiAttachMenu[hidden] { display: none; }
  #obAiAttachMenu button {
    display: block; width: 100%; text-align: left; border: none; background: none;
    cursor: pointer; font: inherit; font-size: 13.5px; color: var(--obai-ink);
    padding: 9px 11px; border-radius: 9px;
  }
  #obAiAttachMenu button:hover { background: var(--obai-paper); }
  #obAiInput {
    flex: 1; border: none; outline: none; resize: none; background: transparent;
    font: inherit; font-size: 15px; line-height: 1.5; padding: 9px 6px 7px; max-height: 132px; color: var(--obai-ink);
  }
  #obAiInput::placeholder { color: var(--obai-muted); }
  #obAiComposer .tools { display: flex; align-items: center; gap: 2px; flex: none; }
  #obAiComposer .tools button {
    border: none; background: none; cursor: pointer; color: var(--obai-muted);
    padding: 0; width: 36px; height: 36px; border-radius: 10px; font-size: 17px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
  }
  #obAiComposer .tools button:hover { background: var(--obai-paper); color: var(--obai-ink); }
  #obAiExpandBtn { font-size: 13px; }
  #obAiDock[data-mode="expanded"] #obAiExpandBtn { transform: rotate(180deg); }
  #obAiComposer #obAiMic { position: relative; }
  /* state colours — id+id+attr beats "#obAiComposer .tools button" */
  #obAiComposer #obAiMic[data-state="listening"] { color: #a4342a; background: #f7e9e6; }
  #obAiComposer #obAiMic[data-state="listening"]::after {
    content: ""; position: absolute; inset: 0; border-radius: 10px;
    box-shadow: 0 0 0 0 rgba(164,52,42,.4); animation: obAiPulse 1.4s ease-out infinite;
  }
  #obAiComposer #obAiMic[data-state="transcribing"] { color: #6b6559; background: var(--obai-paper); }
  #obAiComposer #obAiMic[data-state="error"] { color: #a4342a; background: #f7e9e6; }
  @keyframes obAiPulse { to { box-shadow: 0 0 0 7px rgba(164,52,42,0); } }
  #obAiMicHint { font-size: 11.5px; color: var(--obai-muted); padding: 5px 8px 1px; }
  #obAiMicHint[hidden] { display: none; }
  #obAiSend {
    border: none; cursor: pointer; background: var(--obai-ink); color: #fff;
    border-radius: 12px; width: 36px; height: 36px; font-size: 16px; padding: 0; flex: none;
    transition: opacity .12s ease, transform .12s ease;
  }
  #obAiSend:not(:disabled):hover { transform: translateY(-1px); }
  #obAiSend:not(:disabled) { box-shadow: 0 2px 6px -1px rgba(20,18,10,.35); }
  #obAiSend:disabled { opacity: .28; cursor: default; }

  @keyframes obAiFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  @keyframes obAiEllipsis { to { clip-path: inset(0 0 0 100%); } }

  @media (max-width: 640px) {
    #obAiDock {
      width: calc(100vw - 16px); bottom: max(8px, env(safe-area-inset-bottom));
    }
    #obAiPanel { border-radius: 16px 16px 0 0; }
    #obAiDock[data-mode="expanded"] #obAiPanel { max-height: 74vh; }
    #obAiComposer { border-radius: 16px; }
    #obAiDock[data-mode="expanded"] #obAiComposer { border-radius: 0 0 16px 16px; }
  }
  @media (prefers-reduced-motion: reduce) {
    #obAiPanel, #obAiSend { transition: none; }
    #obAiLog .m, #obAiCard, #obAiAttachMenu { animation: none; }
    #obAiComposer #obAiMic[data-state="listening"]::after, #obAiLog .m.think::after { animation: none; }
  }
