/* Clayrune public demo — shell chrome only.
 *
 * The product's REAL UI rules live in _real-ui.css, extracted verbatim from the
 * app's static/css/app.css (see demo/README.md). Do NOT restyle product
 * components here — if the app changes, re-extract _real-ui.css instead.
 * This file holds only what the demo needs and the app does not: the bounded
 * frame, the coach-marks, and the settings modal.
 */

/* ── Bounded frame (the demo lives in a ~1100×640 iframe, not a viewport) ── */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; overflow: hidden;
}
.demo-root { display: flex; flex-direction: row; height: 100%; min-height: 0; }
.demo-maincol { flex: 1 1 auto; min-width: 0; height: 100%; display: flex; flex-direction: column; }

/* ── App bar (mirrors the product's header) ── */
.demo-appbar {
  height: 48px; flex: 0 0 48px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.demo-logo { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: .2px; }
.demo-logo-mark {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 22px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
}
.demo-crumb { color: var(--text-dim); font-size: 13px; }
.demo-crumb b { color: var(--text); font-weight: 600; }

/* Back-to-dashboard button (project view only). */
.demo-backbtn {
  display: none; align-items: center; gap: 6px; cursor: pointer;
  height: 30px; padding: 0 11px 0 8px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
  font-size: 12.5px; font-weight: 600;
}
.demo-backbtn:hover { color: var(--text); border-color: var(--border2); }
body.view-project .demo-backbtn { display: inline-flex; }
/* Desktop dashboard shows "Dashboard · N projects"; mobile hides it (the
   greeting takes its place — handled in the ≤960 block). */
.demo-appbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.demo-livepill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--green-dim); color: var(--green-text);
}
.demo-livedot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: demoPulse 1.6s ease-in-out infinite;
}
@keyframes demoPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.demo-iconbtn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
}
.demo-iconbtn:hover { color: var(--text); border-color: var(--border2); }
/* Shared-sprite icons (Lucide-style): inherit the host's currentColor, drawn as
   strokes — matches .si-svg/.bti-svg in the shipped app. */
.demo-ic {
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* The body hosts two swappable views: the fleet dashboard and the 3-pane
   project view. Only one is mounted at a time (toggled by a body class). */
.demo-body { flex: 1 1 auto; min-height: 0; display: flex; }
.demo-body .agent-panel { flex: 1 1 auto; min-height: 0; }

.demo-view { flex: 1 1 auto; min-height: 0; display: none; }
body.view-dashboard #dashView { display: flex; flex-direction: column; }
body.view-project    #projView { display: flex; }

/* ── Dashboard (the fleet grid — 'one dashboard instead of N terminals') ── */
.dash-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 20px 22px; }
.dash-toolbar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.dash-title { font-size: 15px; font-weight: 700; letter-spacing: .1px; }
.dash-title .dash-count { color: var(--text-faint); font-weight: 600; margin-left: 8px; font-size: 13px; }
.dash-sub { font-size: 12px; color: var(--text-dim); }
.dash-hint { font-size: 11.5px; color: var(--text-faint); }

/* Agent-count chip in the tile footer (mirrors the app's live pill, small). */
.tile-agents {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 999px; font-size: 10px; font-weight: 600;
  background: var(--green-dim); color: var(--green-text);
}
.tile-agents.idle { background: var(--surface3); color: var(--text-faint); }
.tile-agents .tile-agents-dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  animation: demoPulse 1.6s ease-in-out infinite;
}
.tile-agents.idle .tile-agents-dot { animation: none; }
.tile-footer .tile-spacer { flex: 1 1 auto; }

/* Mobile-only app chrome — hidden on desktop, switched on inside the ≤768 block
   below. Keeps the desktop demo pixel-identical. */
.demo-greet,
.mc-pill-row,
.mc-chat-list,
.demo-tabbar { display: none; }

/* Plain agent prose keeps its paragraph breaks (plans, summaries). */
.agent-line.md { white-space: pre-wrap; }
/* A conversation whose agent is still mid-task shows a live, pulsing footer
   line instead of a completion status — reinforces the "fleet is live" pitch. */
.agent-line.demo-working {
  color: var(--green-text); font-style: italic;
  display: inline-flex; align-items: center; gap: 7px;
}
.agent-line.demo-working::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; animation: demoPulse 1.4s ease-in-out infinite;
}
/* A fade so statically-rendered transcript lines don't all snap in at once. */
@keyframes demoLineIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.agent-line.fade-in { animation: demoLineIn .26s ease both; }

/* app.css ships `.agent-output:empty { display: none }` — sensible in the product
 * (a new conversation shows a composer empty-state instead), but the demo opens
 * on an EMPTY thread while the coach-marks run. With the output collapsed the
 * composer rides up under the app bar and the page reads as broken — which is
 * the FIRST thing a visitor sees. Keep the thread box laid out even when empty
 * so the composer stays bottom-anchored. Demo-only; product CSS is untouched. */
.agent-3pane .agent-main .agent-output:empty { display: flex; }

/* ── Coach-marks ──
 * The dim comes ENTIRELY from .coach-spot's 9999px box-shadow, which paints
 * everything outside the spotlight. The backdrop must therefore never capture
 * pointer events: the tour asks the user to click the highlighted control
 * ("Approve & run"), and a click-eating backdrop makes that impossible. Keep
 * pointer-events:none here — this is load-bearing, not cosmetic.
 */
.coach-backdrop {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: transparent;
}
.coach-spot {
  position: fixed; z-index: 61; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(4, 6, 12, .58), 0 0 0 2px var(--accent);
  transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
.coach-tip {
  position: fixed; z-index: 62; width: 268px; padding: 14px;
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
  transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
.coach-step { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); }
.coach-title { margin: 5px 0 6px; font-size: 14px; font-weight: 650; }
.coach-body { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-dim); }
.coach-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.coach-next {
  margin-left: auto; padding: 6px 14px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #06101f; font-weight: 650; font-size: 12.5px;
}
.coach-next:hover { filter: brightness(1.08); }
.coach-skip { background: none; border: 0; color: var(--text-faint); cursor: pointer; font-size: 12.5px; }
.coach-skip:hover { color: var(--text-dim); }

/* ── Settings modal (demo-local; persists to localStorage, never a server) ── */
.demo-modal-overlay {
  position: fixed; inset: 0; z-index: 70; display: none;
  place-items: center; background: rgba(4, 6, 12, .6);
}
.demo-modal-overlay.on { display: grid; }
.demo-modal {
  width: min(440px, 92%); max-height: 84%; overflow: auto;
  background: var(--surface); border: 1px solid var(--border2); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.demo-modal-head {
  display: flex; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid var(--border); font-weight: 650;
}
.demo-modal-head button {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--text-faint); font-size: 20px; line-height: 1;
}
.demo-modal-head button:hover { color: var(--text); }
.demo-set-group { padding: 6px 16px 14px; }
.demo-set-legend {
  font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-faint); margin: 14px 0 4px;
}
.demo-set-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.demo-set-row:last-child { border-bottom: 0; }
.demo-set-label { font-size: 13px; }
.demo-set-hint { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.demo-set-ctl { margin-left: auto; flex: 0 0 auto; }
.demo-set-ctl select {
  background: var(--surface2); color: var(--text); font-size: 12.5px;
  border: 1px solid var(--border2); border-radius: 7px; padding: 5px 8px;
}
.demo-switch {
  position: relative; width: 40px; height: 22px; border-radius: 999px; cursor: pointer;
  background: var(--surface3); border: 1px solid var(--border2); transition: background .18s ease;
}
.demo-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-faint); transition: transform .18s ease, background .18s ease;
}
.demo-switch.on { background: var(--accent-dim); border-color: var(--accent-soft); }
.demo-switch.on::after { transform: translateX(18px); background: var(--accent); }

/* ── Replay ── */
/* Sits above the composer, not on top of the send button. */
.demo-replay {
  position: absolute; right: 18px; bottom: 104px; z-index: 50;
  display: none; align-items: center; gap: 7px; padding: 8px 14px;
  border: 1px solid var(--border2); border-radius: 999px; cursor: pointer;
  background: var(--surface2); color: var(--text); font-size: 12.5px; font-weight: 600;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
}
.demo-replay.on { display: inline-flex; }
.demo-replay:hover { border-color: var(--accent); color: var(--accent); }

/* Light theme, toggled from the demo settings panel. Mirrors the product's
   [data-theme="light"] switch; the palette itself comes from _real-ui.css. */
body[data-theme="light"] { background: var(--bg); color: var(--text); }

/* ── Demo → install bridge ──
 * Three quiet touchpoints steer interested visitors to the real install:
 *   .demo-getbtn   persistent, unobtrusive "Get it" in the app bar
 *   .demo-nudge    one soft toast the moment the agent starts real work
 *   .demo-endcard  the end-of-run conversion card in the thread
 * All calm, none pushy. Links use target=_top so they navigate the host page. */
.demo-getbtn {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px;
  border-radius: 8px; text-decoration: none; white-space: nowrap;
  background: var(--accent-dim); border: 1px solid var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 650; letter-spacing: .1px;
}
.demo-getbtn:hover { filter: brightness(1.08); border-color: var(--accent); }
@media (max-width: 560px) { .demo-getbtn { display: none; } }

/* One-time soft nudge (bottom-center toast). */
.demo-nudge {
  position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 14px);
  z-index: 55; display: flex; align-items: center; gap: 10px;
  max-width: min(560px, calc(100% - 32px)); padding: 9px 10px 9px 14px;
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .42);
  font-size: 12.5px; color: var(--text-dim);
  opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .3s ease;
}
.demo-nudge.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.demo-nudge-dot {
  flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: demoPulse 1.6s ease-in-out infinite;
}
.demo-nudge-txt { min-width: 0; }
.demo-nudge-txt b { color: var(--text); font-weight: 650; }
.demo-nudge-link {
  flex: 0 0 auto; text-decoration: none; font-weight: 700; color: var(--accent);
}
.demo-nudge-link:hover { text-decoration: underline; }
.demo-nudge-x {
  flex: 0 0 auto; background: none; border: 0; cursor: pointer;
  color: var(--text-faint); font-size: 17px; line-height: 1; padding: 0 2px;
}
.demo-nudge-x:hover { color: var(--text); }
@media (max-width: 560px) { .demo-nudge-txt { display: none; } }

/* End-of-run conversion card (in-thread, appended after the summary). */
.demo-endcard {
  margin: 18px 0 8px; padding: 18px 18px 16px;
  background: linear-gradient(150deg, var(--accent-dim), var(--surface2));
  border: 1px solid var(--accent-soft); border-radius: 14px;
}
.demo-endcard-title { font-size: 15px; font-weight: 750; color: var(--text); }
.demo-endcard-sub {
  margin: 5px 0 14px; font-size: 12.5px; line-height: 1.6; color: var(--text-dim); max-width: 52ch;
}
.demo-endcard-sub b { color: var(--text); font-weight: 650; }
.demo-endcard-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.demo-endcard-btn {
  display: inline-flex; align-items: center; padding: 9px 15px; border-radius: 9px;
  text-decoration: none; font-size: 12.5px; font-weight: 650; white-space: nowrap;
}
.demo-endcard-btn.accent { background: var(--accent); color: #06101f; }
.demo-endcard-btn.accent:hover { filter: brightness(1.08); }
.demo-endcard-btn.ghost {
  background: transparent; border: 1px solid var(--border2); color: var(--text-dim);
}
.demo-endcard-btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Ask Claydo modal shell ──
 * The real app opens Claydo as a draggable modal-window; the demo uses the
 * same centered-overlay treatment as Settings, with the product's real
 * claydo-* content classes (history/msg/chip/ready-card) inside from _real-ui.css.
 * position:relative anchors the absolute .claydo-save-panel overlay. */
.demo-claydo {
  position: relative; display: flex; flex-direction: column;
  width: min(520px, 94%); height: min(600px, 88%);
  background: var(--surface); border: 1px solid var(--border2); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); overflow: hidden;
}
.demo-claydo-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 13px 14px 12px 18px; border-bottom: 1px solid var(--border);
}
.demo-claydo-av {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  border: 1px solid var(--border); object-fit: contain; background: var(--surface2);
}
.demo-claydo-titles { min-width: 0; margin-right: auto; }
.demo-claydo-title { font-size: 14px; font-weight: 700; color: var(--text); }
.demo-claydo-sub { font-size: 11px; color: var(--text-faint); }
.demo-claydo-x {
  background: none; border: 0; cursor: pointer; color: var(--text-faint);
  font-size: 20px; line-height: 1; padding: 0 4px;
}
.demo-claydo-x:hover { color: var(--text); }

/* ── Conversation header (model pill · Stop · timer · Pop Out) ──────────────
 * A LIVE chat shows the model as a compact pill beside Stop — not a labeled
 * "Model ▾" row above the composer (that only exists on a fresh chat). Mirrors
 * the real app's chat header. Demo-owned; not in the extracted _real-ui.css. */
.conv-header {
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
  padding: 9px 14px; border-bottom: 1px solid var(--border); min-width: 0;
}
.conv-status { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.conv-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conv-status-dot.running { background: var(--green); box-shadow: 0 0 6px var(--green); animation: demoPulse 2s infinite; }
.conv-status-dot.completed { background: var(--accent); }
.conv-status-dot.needs-attention { background: #f97316; box-shadow: 0 0 6px #f97316; }
.conv-status-dot.stopped { background: var(--amber); }
.conv-status-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.conv-status-label.running { color: var(--green-text); }
.conv-status-label.completed { color: var(--accent); }
.conv-status-label.needs-attention { color: #f97316; }
.conv-status-label.stopped { color: var(--amber-text); }

.model-pill-wrap { position: relative; margin-left: auto; flex: 0 0 auto; }
.model-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border2); border-radius: 8px;
  padding: 4px 10px; cursor: pointer; font-size: 12.5px; color: var(--text);
  transition: border-color .15s;
}
.model-pill:hover { border-color: var(--accent); }
.model-pill-cap { font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.model-pill-val { font-weight: 650; }
.model-pill-caret { color: var(--text-faint); font-size: 10px; }

.model-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  min-width: 226px; background: var(--surface); border: 1px solid var(--border2);
  border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, .4); padding: 6px;
}
.model-pop[hidden] { display: none; }
.model-pop-head { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); padding: 6px 10px 5px; }
.model-pop-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 13px;
}
.model-pop-item:hover { background: var(--surface3); }
.mpi-name { font-weight: 550; }
.model-pop-item[data-m=""] .mpi-name { color: var(--accent); }
.mpi-sub { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.model-pop-item:not([data-m=""]) .mpi-check { margin-left: auto; }
.mpi-check { color: var(--accent); font-weight: 700; opacity: 0; }
.model-pop-item.active .mpi-check { opacity: 1; }

.btn-stop {
  background: var(--red-dim); border: 1px solid var(--red); color: var(--red-text);
  font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 14px;
  border-radius: 8px; cursor: pointer; white-space: nowrap; flex: 0 0 auto;
}
.btn-stop:hover { background: var(--red); color: #fff; }
.conv-timer { font-size: 12px; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; white-space: nowrap; flex: 0 0 auto; }
.btn-popout {
  background: var(--surface); border: 1px solid var(--border2); color: var(--text-dim);
  font-size: 12px; padding: 5px 10px; border-radius: 7px; cursor: pointer;
  white-space: nowrap; flex: 0 0 auto; transition: border-color .15s, color .15s;
}
.btn-popout:hover { border-color: var(--accent); color: var(--accent); }

/* Composer send: desktop = green "Send" pill; mobile = circular ↑ arrow. */
.btn-send-text {
  flex-shrink: 0; background: var(--green-dim); border: 1px solid var(--green);
  color: var(--green-text); font-family: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 18px; border-radius: 16px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.btn-send-text:hover { background: var(--green); color: var(--bg); }
.btn-send-arrow { display: none !important; }
.btn-composer-plus .cp-mob { display: none; }

/* On a phone the Claydo sheet fills most of the screen. */
@media (max-width: 960px) {
  .demo-claydo { width: 96%; height: 90%; }
}

/* ── Mobile (≤960px) ──
 * The product doesn't render the 3-pane on a phone at all: `agentPanelHTML()`
 * takes a different branch and emits a drill-down (conversation list → thread).
 * `.agent-panel.agent-3pane { flex-direction: row }` is GLOBAL in app.css, so a
 * demo that always emits the 3-pane DOM stays a row on mobile and squeezes the
 * thread off-screen. Collapse to the thread here — that's what the real app
 * shows once a conversation is open, and it's the state this demo is in.
 */
@media (max-width: 960px) {
  .agent-3pane .agent-rail,
  .agent-3pane .agent-rail-resizer,
  .agent-surfaces { display: none !important; }
  .agent-panel.agent-3pane .agent-main {
    flex: 1 1 auto; width: 100%; min-width: 0;
    display: flex; flex-direction: column; min-height: 0;
  }
  /* app.css only gives the thread its fill-height flex chain inside the desktop
     block, so on mobile .agent-chat collapses to content height and the
     composer floats to the top of a mostly-empty screen. Re-establish it. */
  .agent-panel.agent-3pane .agent-main .agent-chat {
    display: flex; flex-direction: column;
    flex: 1 1 auto; height: auto !important; min-height: 0;
  }
  .agent-panel.agent-3pane .agent-main .agent-output {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
  }
  .agent-panel.agent-3pane .agent-main .agent-chat-input { flex: 0 0 auto; }
  .demo-crumb { display: none; }
  /* Clear the taller mobile composer (model row + input pill), not just the input. */
  .demo-replay { right: 12px; bottom: 158px; }

  /* The rail is hidden on phones. The real app has NO in-chat conversation
     switcher — switching is a drill-down: back (← Dashboard) → project → the
     conversation list. The active conversation shows in the app-bar breadcrumb
     ("› Ledger · Reconcile failed charges"), so no dropdown here. */
  .dash-scroll { padding: 12px; }

  /* Coach tip docks to the bottom — a floating tip beside a full-bleed thread
     has nowhere to go on a 390px screen. */
  .coach-tip {
    width: auto; left: 12px !important; right: 12px;
    top: auto !important; bottom: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE APP MODE (≤768px)
   A phone visitor should see Clayrune's real phone UI — an app bar with a
   greeting, a WhatsApp-style project chat-list, and a 5-slot bottom tab bar —
   NOT the desktop dashboard shrunk down. Mirrors static/index.html + app.css
   (≤960px) from the product. Everything here is viewport-contained: nothing
   bleeds past the screen edge. Desktop demo is untouched.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Hard containment — the reported bug was content bleeding past the edge. */
  html, body { overflow-x: hidden; }
  .demo-root { max-width: 100vw; overflow-x: hidden; }
  /* Flex items default to min-width:auto (= min-content) and refuse to shrink
     below their content — that let a nowrap chat subtitle blow the column past
     the viewport. Zero it down the flex chain so ellipsis clipping can kick in. */
  .demo-body, .demo-view { min-width: 0; }
  .dash-scroll { overflow-x: hidden; }

  /* ── App bar ─────────────────────────────────────────────────────────── */
  .demo-appbar {
    height: auto; flex: 0 0 auto; min-height: 52px; gap: 8px; padding: 8px 14px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    /* Reserve the top-right corner for the outer page's compact "End demo" ✕
       (demo.css), so the crumb / account icon never render underneath it. */
    padding-right: 56px;
  }
  .demo-logo, .demo-livepill, .demo-getbtn { display: none !important; }
  .demo-appbar-right { gap: 6px; }
  /* The settings gear reads as the account avatar on mobile. */
  .demo-iconbtn { width: 34px; height: 34px; border-radius: 50%; }

  /* Dashboard: eyebrow + greeting on the left (mirrors mc-app-bar). */
  body.view-dashboard #appGreet {
    display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; min-width: 0;
  }
  .demo-eyebrow {
    font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-faint);
  }
  .demo-greeting { font-size: 21px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }

  /* Project view: back arrow + conversation title = a mobile chat header. */
  body.view-project .demo-appbar { min-height: 50px; }
  body.view-project .demo-backbtn {
    display: inline-flex; height: 34px; padding: 0 10px 0 8px; flex: 0 0 auto;
  }
  body.view-project .demo-crumb {
    display: block; flex: 1 1 auto; min-width: 0; margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 14.5px; color: var(--text);
  }
  body.view-project .demo-crumb b { font-weight: 700; }

  /* ── Dashboard body: swap the desktop grid for the mobile app view ───── */
  .dash-scroll { padding: 0 0 78px; }
  .dash-toolbar, .projects-col { display: none; }   /* desktop grid off */

  /* Filter pills (horizontal scroll, like the app). */
  .mc-pill-row {
    display: flex; gap: 6px; padding: 12px 16px 12px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mc-pill-row::-webkit-scrollbar { display: none; }
  .mc-pill {
    flex: 0 0 auto; padding: 7px 14px; border-radius: 999px;
    background: var(--surface); border: 1.5px solid var(--border2);
    font-size: 13px; font-weight: 600; color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 6px; line-height: 1.2;
    cursor: pointer; font-family: inherit;
  }
  .mc-pill .mc-pill-count { font-size: 11px; opacity: .7; }
  .mc-pill.active { background: var(--text); color: var(--surface); border-color: var(--text); }
  .mc-pill.urgent { border-color: var(--amber); color: var(--amber-text); background: var(--amber-dim); }
  .mc-pill.urgent.active { background: var(--amber); color: var(--surface); border-color: var(--amber); }

  /* WhatsApp-style chat list (mirrors .mc-chat-list / .mc-chat-row). */
  .mc-chat-list {
    display: flex; flex-direction: column; width: auto; margin: 0 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden;
  }
  .mc-chat-row {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    cursor: pointer; border-bottom: 1px solid var(--border);
    max-width: 100%; overflow: hidden; -webkit-tap-highlight-color: transparent;
  }
  .mc-chat-row:last-child { border-bottom: none; }
  .mc-chat-row:active { background: var(--surface3); }
  .cr-avatar {
    position: relative; width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 50%; display: grid; place-items: center;
    background: var(--surface3); border: 2px solid var(--border2);
  }
  .cr-av-emoji { font-size: 22px; line-height: 1; }
  .cr-avatar.friendly-working { border-color: var(--green); }
  .cr-avatar.friendly-asking  { border-color: var(--amber); }
  .cr-avatar.friendly-idle    { border-color: var(--border2); }
  .cr-ring { display: none; }
  .cr-avatar.friendly-working .cr-ring {
    display: block; position: absolute; inset: -2px; border-radius: 50%;
    border: 2px solid var(--green); animation: crPulse 1.6s ease-out infinite;
  }
  @keyframes crPulse {
    0%   { transform: scale(1);    opacity: .7; }
    100% { transform: scale(1.35); opacity: 0;  }
  }
  .cr-main { flex: 1 1 auto; min-width: 0; }
  .cr-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  .cr-name {
    flex: 1 1 auto; min-width: 0; font-size: 15.5px; font-weight: 650; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cr-time { flex: 0 0 auto; font-size: 12px; color: var(--text-faint); }
  .cr-bot { display: flex; align-items: center; gap: 8px; margin-top: 3px; min-width: 0; }
  .cr-sub {
    flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text-dim); line-height: 1.35;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cr-badge {
    flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--green-dim); color: var(--green-text); font-size: 11px; font-weight: 700;
    display: grid; place-items: center; line-height: 1;
  }
  .cr-badge.asking { background: var(--amber-dim); color: var(--amber-text); }

  /* ── Bottom tab bar (dashboard only — the open chat is full-screen) ───── */
  body.view-dashboard .demo-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: 1.5px solid var(--border);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
  }
  .demo-tab {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: 0; cursor: pointer; padding: 3px 0;
    font-size: 9.5px; font-weight: 600; color: var(--text-faint); font-family: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .demo-tab.active { color: var(--accent); }
  .demo-tab svg {
    width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .demo-tab-claydo {
    width: 22px; height: 22px; border-radius: 50%; overflow: hidden;
    display: grid; place-items: center; background: var(--surface2);
  }
  .demo-tab-claydo img { width: 100%; height: 100%; object-fit: contain; }

  /* Keep the Get-it CTA reachable: the app-bar button is hidden on phones, so
     the end-of-run card + soft nudge carry conversion. The floating Claydo FAB
     would collide with the tab bar — Claydo lives in the tab bar on mobile. */
  .claydo-fab { display: none !important; }

  /* Thread lines must wrap, never widen the viewport. */
  .agent-output .agent-line { overflow-wrap: anywhere; word-break: break-word; }

  /* Replay button clears the bottom tab bar / composer. */
  .demo-replay { right: 12px; bottom: 96px; }

  /* ── Guided tour tooltip → mobile bottom sheet ──
   * On a phone the floating desktop tip docked to the very bottom edge, so on a
   * real device the "Skip tour" / "Next" controls fell under the browser URL bar
   * and the user was trapped — no way to dismiss the tour or advance it. Make the
   * tip a proper bottom sheet: full-width, lifted clear of the safe-area inset,
   * height-capped so it can never exceed the screen, with large (≥44px) clearly
   * tappable buttons. "Skip tour" becomes a visible outlined button, not faint
   * text. Combined with the outer frame using 100dvh, the controls are always on
   * screen. */
  .coach-tip {
    width: auto; left: 10px !important; right: 10px;
    top: auto !important;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: 68vh; overflow-y: auto;
    padding: 16px 16px 18px;
    border-radius: 16px;
    box-shadow: 0 -12px 44px rgba(0, 0, 0, .55), 0 0 0 1px var(--border2);
  }
  .coach-step { font-size: 11px; }
  .coach-title { font-size: 16px; margin: 6px 0 7px; }
  .coach-body { font-size: 13.5px; line-height: 1.5; }
  .coach-actions { margin-top: 16px; gap: 12px; }
  .coach-skip {
    order: -1;                 /* keep Skip on the left */
    padding: 12px 18px; min-height: 46px;
    background: var(--surface); border: 1.5px solid var(--border2);
    border-radius: 12px; color: var(--text); font-weight: 650; font-size: 14px;
  }
  .coach-skip:active { background: var(--surface3); }
  .coach-next {
    padding: 12px 22px; min-height: 46px; border-radius: 12px; font-size: 14px;
  }
  /* Approval step: dock to the top so the bottom-anchored "Approve & run" gate
     in the thread stays visible and tappable. */
  .coach-tip.coach-tip-top {
    top: calc(14px + env(safe-area-inset-top, 0px)) !important;
    bottom: auto !important;
    box-shadow: 0 12px 44px rgba(0, 0, 0, .55), 0 0 0 1px var(--border2);
  }

  /* ── Composer + conversation header on phones ── */
  /* Send: circular ↑ arrow (the green "Send" text pill is desktop-only). */
  .btn-send-text { display: none !important; }
  .btn-send-arrow { display: inline-flex !important; }
  /* Attach: a 📎 paperclip on mobile, a + on desktop. */
  .btn-composer-plus .cp-desk { display: none; }
  .btn-composer-plus .cp-mob { display: inline; }
  /* Real-app composer order on phones: [text field] then, on the right,
     [📎 paperclip · 🎤 mic · ↑ send] — the paperclip is plain (no boxed
     square), grouped with mic + send AFTER the input. DOM keeps the desktop
     "+" on the left; flex `order` repositions only on mobile. */
  .agent-chat-input-row .agent-task-input { order: 0; }
  .agent-chat-input-row .btn-composer-plus { order: 1; }
  .agent-chat-input-row .btn-mic { order: 2; }
  .agent-chat-input-row .btn-send-arrow { order: 3; }
  .agent-chat-input-row .btn-composer-plus {
    background: transparent !important; border: none !important;
    color: var(--text-dim); width: 34px; height: 34px; font-size: 18px;
    border-radius: 50%;
  }
  .agent-chat-input-row .btn-composer-plus:hover,
  .agent-chat-input-row .btn-composer-plus:active {
    background: transparent !important; color: var(--text); border-color: transparent !important;
  }
  /* Keep the header tight on a narrow screen — drop the timer + Pop Out. */
  .conv-header { gap: 8px; padding: 8px 12px; }
  .conv-timer, .btn-popout { display: none !important; }
  .model-pop { right: 0; min-width: 210px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   r19 SHELL — sidebar, drawer, project ⋮ menu, palette, surface sheet,
   drill-down settings, feed/beacon. Simulated chrome that makes the demo
   navigate like the shipped app. Palette tokens come from _real-ui.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Left sidebar / main nav (collapse-on-hover icon rail) ── */
.demo-sidebar {
  --sb-w: 54px; --sb-exp: 220px;
  flex: 0 0 var(--sb-w); width: var(--sb-w);
  display: flex; flex-direction: column; z-index: 30;
  background: var(--surface); border-right: 1px solid var(--border);
  overflow: hidden; transition: width .16s ease, flex-basis .16s ease;
}
.demo-sidebar:hover { flex-basis: var(--sb-exp); width: var(--sb-exp); box-shadow: 6px 0 24px rgba(0,0,0,.25); }
.sb-logo { display: flex; align-items: center; gap: 10px; height: 48px; flex: 0 0 48px; padding: 0 15px; border-bottom: 1px solid var(--border); }
.sb-logo-mark { width: 24px; height: 24px; border-radius: 7px; flex: 0 0 24px; background: linear-gradient(135deg, var(--accent), var(--purple)); }
.sb-logo-text { font-weight: 700; letter-spacing: .2px; opacity: 0; white-space: nowrap; transition: opacity .14s; }
.demo-sidebar:hover .sb-logo-text { opacity: 1; }
.sb-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 0 14px; }
.sb-scroll::-webkit-scrollbar { width: 6px; } .sb-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.sb-item {
  position: relative; display: flex; align-items: center; gap: 13px; width: 100%;
  height: 38px; padding: 0 15px; background: none; border: 0; cursor: pointer;
  color: var(--text-dim); font-family: inherit; font-size: 13.5px; white-space: nowrap;
}
.sb-item:hover { background: var(--surface2); color: var(--text); }
.sb-item.active { background: var(--accent-dim); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.sb-ic { width: 18px; height: 18px; flex: 0 0 18px; }
.sb-label { opacity: 0; transition: opacity .14s; }
.demo-sidebar:hover .sb-label { opacity: 1; }
.sb-badge {
  margin-left: auto; background: var(--amber-dim); color: var(--amber-text);
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  opacity: 0; transition: opacity .14s;
}
.demo-sidebar:hover .sb-badge { opacity: 1; }
.sb-sec {
  display: flex; align-items: center; width: 100%; padding: 12px 15px 5px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); background: none; border: 0; font-family: inherit;
  white-space: nowrap; opacity: 0; transition: opacity .14s;
}
.demo-sidebar:hover .sb-sec { opacity: 1; }
.sb-sec-toggle { cursor: pointer; }
.sb-sec-chev { width: 13px; height: 13px; margin-left: auto; transform: rotate(90deg); transition: transform .15s; }
.sb-sec-toggle[aria-expanded="false"] .sb-sec-chev { transform: rotate(0deg); }
.sb-adv { overflow: hidden; }
.sb-adv.collapsed { display: none; }
.sb-divider { height: 1px; background: var(--border); margin: 8px 14px; }
.sb-projects { padding: 2px 0; }
.sb-project { display: flex; align-items: center; gap: 11px; width: 100%; height: 32px; padding: 0 17px; background: none; border: 0; cursor: pointer; color: var(--text-dim); font-family: inherit; font-size: 12.5px; white-space: nowrap; }
.sb-project:hover { background: var(--surface2); color: var(--text); }
.sb-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.sb-dot.working { background: var(--green); } .sb-dot.asking { background: var(--amber); } .sb-dot.idle { background: var(--text-faint); }
.sb-pname { opacity: 0; transition: opacity .14s; overflow: hidden; text-overflow: ellipsis; }
.demo-sidebar:hover .sb-pname { opacity: 1; }
.demo-hamburger { display: none; width: 34px; height: 34px; border-radius: 8px; background: none; border: 0; cursor: pointer; color: var(--text-dim); place-items: center; }
.demo-hamburger:hover { color: var(--text); }

/* ── App-bar chrome parity: search pill · status pill · Live badge ── */
.demo-searchpill {
  display: inline-flex; align-items: center; gap: 8px; margin-left: 4px;
  height: 30px; padding: 0 10px; border-radius: 8px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-faint);
  font-family: inherit; font-size: 12.5px; max-width: 260px;
}
.demo-searchpill:hover { border-color: var(--border2); color: var(--text-dim); }
.demo-searchpill-txt { white-space: nowrap; }
.demo-kbd {
  margin-left: 4px; padding: 1px 6px; border-radius: 5px; font-size: 10px; font-weight: 600;
  background: var(--surface3); border: 1px solid var(--border2); color: var(--text-faint);
}
.demo-statuspill {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--green-dim); border: 1px solid var(--green); color: var(--green-text);
  font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.demo-statuspill:hover { filter: brightness(1.06); }
.demo-livebadge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--border2); color: var(--text-dim);
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
}
.demo-livebadge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: demoPulse 1.6s ease-in-out infinite; }
.demo-iconbtn.sm { width: 26px; height: 26px; border-radius: 7px; }
.demo-winchrome { display: none; align-items: center; gap: 4px; margin-right: 4px; padding-right: 6px; border-right: 1px solid var(--border); }
body.view-project .demo-winchrome { display: inline-flex; }
.demo-menu-wrap { position: relative; }

/* ── Dropdown menu (project ⋮ menu; submenus) ── */
.demo-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 80; min-width: 234px;
  background: var(--surface); border: 1px solid var(--border2); border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0,0,0,.45); padding: 6px; max-height: 74vh; overflow-y: auto;
}
.demo-menu[hidden] { display: none; }
.demo-menu-sec { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); padding: 8px 10px 4px; }
.demo-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; background: none; border: 0; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 13px;
}
.demo-menu-item:hover { background: var(--surface3); }
.demo-menu-item .mi-ic { width: 16px; text-align: center; color: var(--text-faint); flex: 0 0 16px; }
.demo-menu-item .mi-badge { margin-left: auto; background: var(--amber-dim); color: var(--amber-text); font-size: 10.5px; padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.demo-menu-item .mi-chev { margin-left: auto; color: var(--text-faint); }
.demo-menu-item .mi-val { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.demo-menu-item.active { color: var(--accent); }
.demo-menu-item.active .mi-ic { color: var(--accent); }
.demo-menu-item.danger { color: var(--red-text); }
.demo-menu-item.danger .mi-ic { color: var(--red-text); }
.demo-menu-item.danger:hover { background: var(--red-dim); }
.demo-menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.demo-menu-swatches { display: flex; gap: 7px; padding: 8px 12px 10px; }
.demo-menu-sw { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.demo-menu-sw.on { border-color: var(--text); }

/* ── Command palette ── */
.demo-pal-overlay { position: fixed; inset: 0; z-index: 90; display: none; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(4,6,12,.55); }
.demo-pal-overlay.on { display: flex; }
.demo-pal { width: min(560px, 92%); max-height: 66vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border2); border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.55); overflow: hidden; }
.demo-pal-inputwrap { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-faint); }
.demo-pal-inputwrap input { flex: 1 1 auto; background: none; border: 0; outline: none; color: var(--text); font-family: inherit; font-size: 15px; }
.demo-pal-list { flex: 1 1 auto; overflow-y: auto; padding: 6px; }
.demo-pal-group { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); padding: 9px 10px 4px; }
.demo-pal-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 9px 11px; border-radius: 9px; background: none; border: 0; cursor: pointer; color: var(--text); font-family: inherit; font-size: 13.5px; }
.demo-pal-item .pi-ic { width: 17px; height: 17px; flex: 0 0 17px; color: var(--text-faint); }
.demo-pal-item.sel, .demo-pal-item:hover { background: var(--accent-dim); color: var(--accent); }
.demo-pal-item.sel .pi-ic, .demo-pal-item:hover .pi-ic { color: var(--accent); }
.demo-pal-item .pi-sub { margin-left: auto; color: var(--text-faint); font-size: 11.5px; }
.demo-pal-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 11px; }
.demo-pal-foot b { color: var(--text-dim); }

/* ── Generic surface sheet (used by most surfaces) ── */
.demo-sheet-overlay { position: fixed; inset: 0; z-index: 85; display: none; place-items: center; background: rgba(4,6,12,.6); }
.demo-sheet-overlay.on { display: grid; }
.demo-sheet { width: min(680px, 94%); max-height: 86%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border2); border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,.55); overflow: hidden; }
.demo-sheet-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.demo-sheet-ic { font-size: 17px; line-height: 1; }
.demo-sheet-title { font-weight: 700; font-size: 15px; }
.demo-sheet-sub { color: var(--text-faint); font-size: 12px; }
.demo-sheet-x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-faint); font-size: 22px; line-height: 1; }
.demo-sheet-x:hover { color: var(--text); }
.demo-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 18px 20px; }

/* Reusable list/row primitives inside sheets. */
.sf-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.sf-chip { padding: 5px 11px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border2); color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.sf-chip.on { background: var(--accent-dim); border-color: var(--accent-soft); color: var(--accent); }
.sf-btn { margin-left: auto; padding: 6px 12px; border-radius: 8px; background: var(--accent-dim); border: 1px solid var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; cursor: pointer; font-family: inherit; }
.sf-row { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--border); }
.sf-row:last-child { border-bottom: 0; }
.sf-check { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 5px; border: 1.5px solid var(--border2); display: grid; place-items: center; color: var(--green-text); font-size: 12px; }
.sf-check.done { background: var(--green-dim); border-color: var(--green); }
.sf-main { flex: 1 1 auto; min-width: 0; }
.sf-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sf-title.done { text-decoration: line-through; color: var(--text-faint); }
.sf-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.sf-pri { flex: 0 0 auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; }
.sf-pri.p0 { background: var(--red-dim); color: var(--red-text); }
.sf-pri.p1 { background: var(--amber-dim); color: var(--amber-text); }
.sf-pri.p2 { background: var(--surface3); color: var(--text-dim); }
.sf-mini { display: flex; gap: 6px; flex: 0 0 auto; }
.sf-mini button { width: 26px; height: 26px; border-radius: 7px; background: var(--surface2); border: 1px solid var(--border); color: var(--text-faint); cursor: pointer; display: grid; place-items: center; font-size: 12px; }
.sf-mini button:hover { color: var(--text); border-color: var(--border2); }
.sf-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.sf-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sf-card-title { font-weight: 650; font-size: 14px; }
.sf-card-meta { color: var(--text-faint); font-size: 11.5px; }
.sf-card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.sf-card-actions button { padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border2); color: var(--text-dim); font-size: 12px; cursor: pointer; font-family: inherit; }
.sf-card-actions button:hover { border-color: var(--accent); color: var(--accent); }
.sf-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.sf-badge.green { background: var(--green-dim); color: var(--green-text); }
.sf-badge.amber { background: var(--amber-dim); color: var(--amber-text); }
.sf-badge.dim { background: var(--surface3); color: var(--text-dim); }
.sf-empty { text-align: center; color: var(--text-faint); padding: 26px 0; font-size: 13px; }
.sf-daygroup { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin: 16px 0 4px; }
.sf-daygroup:first-child { margin-top: 0; }
.sf-note { font-size: 12px; color: var(--text-dim); background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; margin-top: 6px; }
.sf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sf-table th { text-align: left; color: var(--text-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.sf-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); }
.sf-table tr:last-child td { border-bottom: 0; }
.sf-mono { font-family: 'JetBrains Mono', monospace; color: var(--text-dim); }
.sf-kill { padding: 4px 10px; border-radius: 7px; background: var(--red-dim); border: 1px solid var(--red); color: var(--red-text); font-size: 11.5px; cursor: pointer; font-family: inherit; }
.sf-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sf-tab { padding: 8px 4px; margin-bottom: -1px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-dim); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.sf-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.sf-plan { white-space: pre-wrap; font-size: 13px; line-height: 1.6; color: var(--text-dim); background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.sf-plan b { color: var(--text); }

/* Hivemind mini-tree. */
.hm-tree { list-style: none; margin: 0; padding: 0; }
.hm-node { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.hm-node .hm-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.hm-dot.running { background: var(--green); animation: demoPulse 2s infinite; }
.hm-dot.done { background: var(--accent); } .hm-dot.blocked { background: var(--amber); }
.hm-kids { list-style: none; margin: 0 0 0 4px; padding: 0 0 0 18px; border-left: 1px dashed var(--border2); }

/* ── Beacon "where we stand" bar (desktop dashboard) ── */
.demo-beacon { display: none; align-items: center; gap: 14px; margin-bottom: 16px; padding: 11px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; }
body.view-dashboard .demo-beacon { display: flex; }
.demo-beacon .bc-seg { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.demo-beacon .bc-seg b { color: var(--text); }
.demo-beacon .bc-dot { width: 8px; height: 8px; border-radius: 50%; }
.demo-beacon .bc-dot.amber { background: var(--amber); } .demo-beacon .bc-dot.green { background: var(--green); }
.demo-beacon .bc-report { margin-left: auto; padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border2); color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.demo-beacon .bc-report:hover { border-color: var(--accent); color: var(--accent); }

/* ── Desktop Feed column (Needs you / Recent) ── */
.dash-main { display: flex; gap: 20px; align-items: flex-start; }
.projects-col { flex: 1 1 auto; min-width: 0; }
.demo-feed { flex: 0 0 264px; }
.feed-group { margin-bottom: 18px; }
.feed-head { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.feed-head .feed-count { background: var(--amber-dim); color: var(--amber-text); border-radius: 999px; padding: 0 7px; font-size: 10.5px; }
.feed-item { display: flex; gap: 10px; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.feed-item .fi-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; margin-top: 4px; }
.fi-dot.review { background: var(--amber); } .fi-dot.answer { background: #f97316; } .fi-dot.recent { background: var(--text-faint); }
.feed-item .fi-main { min-width: 0; }
.feed-item .fi-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.feed-item .fi-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.feed-item .fi-act { margin-top: 7px; padding: 4px 10px; border-radius: 7px; background: var(--accent-dim); border: 1px solid var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 650; cursor: pointer; font-family: inherit; }

/* ── Composer starter chips ── */
.demo-starters { display: flex; gap: 8px; padding: 0 14px 10px; flex-wrap: wrap; }
.demo-starter { padding: 6px 12px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border2); color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.demo-starter:hover { border-color: var(--accent); color: var(--accent); }

/* ── Rail-row inline icons (📌 pin / ✕ hide / ◫ split) — NOT a kebab ── */
.conv-row { position: relative; }
.conv-row-icons { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); gap: 3px; background: var(--surface); border-radius: 8px; padding: 2px; }
.conv-row:hover .conv-row-icons { display: flex; }
.conv-row-icons button { width: 22px; height: 22px; border-radius: 6px; background: none; border: 0; cursor: pointer; color: var(--text-faint); display: grid; place-items: center; }
.conv-row-icons button:hover { background: var(--surface3); color: var(--text); }
.conv-row-icons svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Drill-down Settings (master/detail) ── */
.demo-settings { display: flex; width: min(760px, 94%); height: min(560px, 88%); background: var(--surface); border: 1px solid var(--border2); border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,.55); overflow: hidden; }
.demo-set-master { flex: 0 0 210px; display: flex; flex-direction: column; background: var(--surface2); border-right: 1px solid var(--border); }
.demo-set-mhead { display: flex; align-items: center; padding: 15px 16px 12px; font-weight: 700; font-size: 15px; }
.demo-set-x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-faint); font-size: 20px; line-height: 1; }
.demo-set-x:hover { color: var(--text); }
.demo-set-searchwrap { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 7px 10px; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; color: var(--text-faint); }
.demo-set-searchwrap input { flex: 1 1 auto; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-family: inherit; font-size: 12.5px; }
.demo-set-cats { flex: 1 1 auto; overflow-y: auto; padding: 4px 8px 12px; }
.demo-set-cat { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 11px; border-radius: 9px; background: none; border: 0; cursor: pointer; color: var(--text-dim); font-family: inherit; font-size: 13px; }
.demo-set-cat:hover { background: var(--surface3); color: var(--text); }
.demo-set-cat.on { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.demo-set-cat .sc-sub { display: block; font-size: 11px; color: var(--text-faint); font-weight: 400; margin-top: 1px; }
.demo-set-detail { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 18px 22px 24px; }
.demo-set-dtitle { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.demo-set-ddesc { font-size: 12.5px; color: var(--text-dim); margin-bottom: 14px; }

/* ── Mobile drawer ── */
.demo-drawer-overlay { position: fixed; inset: 0; z-index: 95; display: none; background: rgba(4,6,12,.55); }
.demo-drawer-overlay.on { display: block; }
.demo-drawer { position: absolute; top: 0; left: 0; bottom: 0; width: min(300px, 84%); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border2); box-shadow: 8px 0 40px rgba(0,0,0,.5); transform: translateX(-100%); transition: transform .2s ease; }
.demo-drawer-overlay.on .demo-drawer { transform: translateX(0); }
.demo-drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.demo-drawer-x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-faint); font-size: 22px; line-height: 1; }
.demo-drawer-list { flex: 1 1 auto; overflow-y: auto; padding: 8px; }
.demo-drawer-item { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 12px 12px; border-radius: 10px; background: none; border: 0; cursor: pointer; color: var(--text); font-family: inherit; font-size: 14.5px; }
.demo-drawer-item:active { background: var(--surface3); }
.demo-drawer-item svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--text-dim); }

/* Desktop: sidebar visible, hamburger/drawer hidden. */
.demo-drawer-overlay { }
@media (min-width: 961px) { .demo-hamburger { display: none !important; } }

/* ── Mobile shell overrides ── */
@media (max-width: 960px) {
  .demo-sidebar { display: none; }
  .demo-hamburger { display: grid; }
  .demo-searchpill, .demo-statuspill, .demo-livebadge, .demo-winchrome, #btnTour { display: none !important; }
  .dash-main { display: block; }
  .demo-feed { display: none; }
  .demo-beacon { display: none !important; }
  .demo-settings { flex-direction: column; width: 96%; height: 90%; }
  .demo-set-master { flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .demo-set-cats { display: flex; overflow-x: auto; padding: 0 8px 10px; gap: 6px; }
  .demo-set-cat { flex: 0 0 auto; padding: 7px 12px; }
  .demo-set-cat .sc-sub { display: none; }
  .demo-set-searchwrap { display: none; }
  .demo-sheet { width: 96%; max-height: 88%; }
}
@media (max-width: 768px) {
  /* Starter chips wrap tight; feed/beacon already hidden. */
  .demo-starters { padding: 0 12px 8px; }
  .demo-pal { width: 94%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   r19b — MOBILE GROUND-TRUTH PASS. The kebab must live in the mobile chat app
   bar (real-03); Settings must read as profile header + vertical cards with a
   drill-down (real-05). Toast, done-status dots, drawer divider.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Show the project window chrome (wand · ⋮ · minimize · close) on mobile too —
   the real chat app bar carries the ⋮ kebab (Ron-flagged #2 / real-03). */
@media (max-width: 960px) {
  body.view-project .demo-winchrome { display: inline-flex !important; }
  body.view-project .demo-getbtn,
  body.view-project .demo-greet,
  body.view-project #btnSettings { display: none !important; }
  body.view-project .demo-backbtn { padding: 0 8px; font-size: 0; }
  body.view-project .demo-backbtn::before { content: "\2190"; font-size: 16px; }
  .demo-winchrome .demo-iconbtn.sm { width: 30px; height: 30px; }
}
.demo-winchrome .demo-wand { font-size: 15px; }

/* Transient toast (affordance-only clicks). */
.demo-toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%) translateY(10px);
  z-index: 130; background: var(--surface); border: 1px solid var(--border2); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none; max-width: 82vw; text-align: center;
}
.demo-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Done / idle status dots (dashboard tiles are already covered by _real-ui.css). */
.sb-dot.done { background: var(--green); }
.sb-dot.asking { background: var(--amber); }
.cr-avatar.friendly-done { border-color: var(--green); }
.cr-avatar.friendly-idle { border-color: var(--border2); }

/* Drawer divider before Incognito (real-02). */
.demo-drawer-item.drawer-last-before-sep { position: relative; }

/* ── Settings: profile header + category cards + chevrons (real-05) ── */
.demo-set-profile { display: flex; align-items: center; gap: 12px; padding: 4px 6px 12px; }
.demo-set-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 42px;
  background: var(--accent-dim); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 17px;
}
.demo-set-pname { font-weight: 700; font-size: 15px; }
.demo-set-psub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.demo-set-catgroup { border: 1px solid var(--border); border-radius: 12px; margin: 0 4px 12px; overflow: hidden; }
.demo-set-catgroup .demo-set-cat { border-radius: 0; border-bottom: 1px solid var(--border); }
.demo-set-catgroup .demo-set-cat:last-child { border-bottom: 0; }
.demo-set-cat { align-items: center; }
.demo-set-cat .sc-ic { width: 18px; height: 18px; flex: 0 0 18px; color: var(--text-faint); }
.demo-set-cat.on .sc-ic { color: var(--accent); }
.demo-set-cat .sc-title { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.demo-set-cat.on .sc-title { color: var(--accent); }
.demo-set-cat .sc-chev { margin-left: auto; color: var(--text-faint); flex: 0 0 15px; }
.demo-set-back {
  display: none; align-items: center; gap: 6px; background: none; border: 0;
  color: var(--accent); font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 14px;
}

/* Mobile: Settings = profile + vertical cards + drill-down (overrides the
   earlier horizontal-chip layout so it matches real-05). */
@media (max-width: 960px) {
  .demo-set-searchwrap { display: flex !important; }
  .demo-set-cats { display: block !important; overflow-y: auto; padding: 4px 4px 16px; }
  .demo-set-cat { flex: 1 1 auto !important; width: 100%; padding: 13px 12px !important; }
  .demo-set-cat .sc-sub { display: block !important; }
  .demo-set-master { flex: 1 1 auto !important; border-bottom: 0 !important; }
  .demo-set-detail { display: none; }
  /* Drilled into a category: keep the "Settings" header bar (title + ✕) so the
     modal stays closable, hide only the search + card list, show the detail. */
  .demo-settings.detail-open .demo-set-master { flex: 0 0 auto !important; }
  .demo-settings.detail-open .demo-set-searchwrap,
  .demo-settings.detail-open .demo-set-cats { display: none !important; }
  .demo-settings.detail-open .demo-set-detail { display: block; }
  .demo-settings.detail-open .demo-set-back { display: inline-flex; }
}
