/* =====================================================================
   Symphonate self-playing product demo — shared styling (v2)
   Mirrors the app's Direction B "Stream" palette (client/src/index.css in
   tdu1/collaborai): deep teal on warm paper, terracotta for the AI.

   v2 adds a desktop three-pane frame (threads rail · thread · Work rail),
   an animated desktop ⇄ phone device transition, and a decision-provenance
   sweep (numbered source-message highlights). Devices are designed at
   fixed pixel sizes (desktop 880×550, phone 356×720) and fitted to the
   embedding iframe with transform: scale() computed in demo.js — so the
   demo renders identically at any embed size.

   Loaded by demos/*.html; the timeline data + engine live in demo.js.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --paper: #f4f3ee;
  --paper-2: #f0efe8;
  --card: #ffffff;
  --ink: #26271f;
  --ink-2: #6f6e66;
  --ink-3: #9b9a91;
  --teal: #127c6d;
  --teal-hover: #0f665a;
  --teal-subtle: rgba(18, 124, 109, 0.1);
  --ai: #d96f43;
  --ai-bg: rgba(217, 111, 67, 0.09);
  --border: #e4e2d8;
  --shadow-card: 0 1px 2px rgba(38, 39, 31, 0.05), 0 4px 16px rgba(38, 39, 31, 0.07);
  --shadow-dev: 0 30px 70px -20px rgba(38, 39, 31, 0.4), 0 8px 24px rgba(38, 39, 31, 0.16);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 120% at 50% 0%, #faf9f4 0%, var(--paper) 55%, #eceae1 100%);
  overflow: hidden;
}

/* ---------- Stage ---------- */
.stage {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.4vh, 12px);
  padding: clamp(8px, 1.8vh, 18px) clamp(10px, 2vw, 20px);
}

.context-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(10px, 1.6vh, 13px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-subtle);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.context-tag .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal);
}

/* Device area — holders are centered and JS-scaled to fit */
.viewport {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}
.dev-holder {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  /* JS sets: transform: translate(-50%,-50%) scale(s) */
}
.dev {
  transition:
    opacity 0.55s ease,
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.55s ease;
}
.dev.hidden-dev {
  opacity: 0;
  transform: scale(0.9) translateY(26px);
  filter: blur(3px);
  pointer-events: none;
}

/* ---------- Desktop frame (880 × 550 design size) ---------- */
.desktop {
  width: 880px;
  height: 550px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-dev);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.browser-bar {
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--border);
}
.traffic {
  display: inline-flex;
  gap: 6px;
}
.traffic i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.traffic i:nth-child(1) {
  background: #e8837a;
}
.traffic i:nth-child(2) {
  background: #e5c06b;
}
.traffic i:nth-child(3) {
  background: #7fc98b;
}
.url-pill {
  flex: 0 1 320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 24px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--ink-2);
}
.url-pill .lock {
  font-size: 9px;
  color: var(--teal);
}

.desk-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 196px 1fr 218px;
}

/* Left rail — workspace + threads + presence */
.rail-left {
  background: var(--paper);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.ws-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
.ws-name .ws-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.rail-h {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 8px 2px 2px;
}
.thread-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  color: var(--ink-2);
}
.thread-item.active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-card);
}
.thread-item .t-ic {
  font-size: 13px;
}
.thread-item .t-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.thread-item .unread {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal);
}
.rail-presence {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-2);
}

/* Center — thread */
.desk-center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fbfaf7;
  position: relative;
}
.desk-header {
  flex: 0 0 auto;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.desk-header .titlerow {
  display: flex;
  align-items: center;
  gap: 9px;
}
.desk-header .thread-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: var(--paper-2);
}
.desk-header .thread-title {
  font-size: 14px;
  font-weight: 700;
}
.desk-header .goal-pill {
  margin-top: 8px;
}
.people-row {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.person-chip {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-left: -6px;
  border: 2px solid #fff;
}
.person-chip:first-child {
  margin-left: 0;
}
/* Late joiner: chip pops in when they arrive mid-thread */
.person-chip.joined {
  animation: pop 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.person-chip .on {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #3f9d62;
  border: 1.5px solid #fff;
}
/* AI chips get their colour inline from the cast map (Aimy terracotta,
   Aiden indigo) — same path as human chips. */

/* Right rail — the Work rail (decisions + artifacts) */
.rail-right {
  background: var(--paper);
  border-left: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.work-item {
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--ink-2);
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 7px;
  align-items: flex-start;
  line-height: 1.35;
}
.work-item .wi-ic {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--teal);
}
.work-item b {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Shared thread bits ---------- */
.goal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}
.goal-pill .goal-key {
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.03em;
  font-size: 10px;
}

.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar {
  display: none;
}

.row {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 78%;
  animation: pop 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.row.right {
  align-self: flex-end;
  align-items: flex-end;
}
.row.left {
  align-self: flex-start;
}
.row .who {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  margin: 0 4px 3px;
}
.bubble {
  position: relative;
  padding: 9px 12px;
  border-radius: 15px;
  font-size: 12.5px;
  line-height: 1.42;
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition:
    box-shadow 0.35s ease,
    transform 0.35s ease;
}
.row.left .bubble {
  border-bottom-left-radius: 5px;
}
.row.right .bubble {
  border-bottom-right-radius: 5px;
}

/* Reaction chip */
.react-chip {
  position: absolute;
  bottom: -9px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1.5px 7px;
  box-shadow: var(--shadow-card);
  animation: pop 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.row.left .react-chip {
  right: auto;
  left: 8px;
}

/* --- Provenance highlight: numbered source-message glow --- */
.row.src .who {
  margin-left: 16px; /* clear the numbered source badge */
}
.row.src .bubble {
  box-shadow:
    0 0 0 2px var(--teal),
    0 6px 22px rgba(18, 124, 109, 0.28);
  transform: translateY(-1px);
}
.src-badge {
  position: absolute;
  top: -9px;
  left: -9px;
  z-index: 3;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(18, 124, 109, 0.4);
  animation: badge-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.row.right .src-badge {
  left: auto;
  right: -9px;
}

/* AI (Aimy) card */
.row.ai {
  max-width: 84%;
}
.ai-card {
  position: relative;
  background: var(--ai-bg);
  border: 1px solid rgba(217, 111, 67, 0.28);
  border-radius: 15px;
  border-top-left-radius: 5px;
  padding: 10px 12px 11px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.35s ease;
}
.row.src .ai-card {
  box-shadow:
    0 0 0 2px var(--teal),
    0 6px 22px rgba(18, 124, 109, 0.28);
}
.ai-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ai);
  margin-bottom: 5px;
}
.ai-avatar {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--ai);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.ai-body {
  font-size: 12.5px;
  line-height: 1.46;
  color: var(--ink);
}
.ai-body .cite {
  color: var(--teal);
  font-weight: 600;
  border-bottom: 1px dotted rgba(18, 124, 109, 0.5);
}
.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 1px;
  background: var(--ai);
  transform: translateY(2px);
  animation: blink 1s step-end infinite;
}
.cites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.cite-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-subtle);
  border-radius: 999px;
  padding: 3px 9px;
}

/* --- Second AI teammate (Aiden, indigo) --- */
:root {
  --ai2: #5c62c5;
  --ai2-bg: rgba(92, 98, 197, 0.08);
}
.row.ai2 .ai-card {
  background: var(--ai2-bg);
  border-color: rgba(92, 98, 197, 0.3);
}
.row.ai2 .ai-name {
  color: var(--ai2);
}
.row.ai2 .ai-avatar {
  background: var(--ai2);
}
.row.ai2 .caret {
  background: var(--ai2);
}
.typing.ai2 {
  background: var(--ai2-bg);
  border-color: rgba(92, 98, 197, 0.3);
}
.typing.ai2 .lbl {
  color: var(--ai2);
}
.typing.ai2 .dots i {
  background: var(--ai2);
}

/* typing indicator */
.typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 15px;
  border-bottom-left-radius: 5px;
  background: var(--card);
  box-shadow: var(--shadow-card);
  animation: pop 0.24s ease both;
}
.typing.ai {
  background: var(--ai-bg);
  border: 1px solid rgba(217, 111, 67, 0.28);
}
.typing .lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}
.typing.ai .lbl {
  color: var(--ai);
}
.dots {
  display: inline-flex;
  gap: 3px;
}
.dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--ink-3);
  animation: bounce 1.2s infinite ease-in-out;
}
.typing.ai .dots i {
  background: var(--ai);
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

/* system line in chat */
.sysline {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-subtle);
  border-radius: 999px;
  padding: 4px 11px;
  animation: pop 0.3s ease both;
}

/* short list artifact */
.artifact {
  align-self: flex-start;
  width: 86%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 12px;
  box-shadow: var(--shadow-card);
  animation: pop 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.artifact .a-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}
.artifact .a-title {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 8px;
}
.artifact ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.artifact li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
}
.artifact li .pin {
  color: var(--teal);
  font-size: 10.5px;
}
.artifact li .sub {
  color: var(--ink-3);
  font-size: 10.5px;
}

/* --- To-dos card --- */
.todo-card li {
  align-items: center;
}
.todo-box {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1.5px solid var(--teal);
  background: var(--teal-subtle);
}

/* --- Document artifact with download chips --- */
.doc-line {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-foot {
  margin-top: 9px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--teal);
  border-radius: 999px;
  padding: 4px 11px;
  box-shadow: 0 2px 8px rgba(18, 124, 109, 0.3);
}

/* --- Rich link-embed card (Airbnb / Figma style) --- */
.link-card {
  position: relative;
  display: flex;
  gap: 10px;
  width: 300px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 9px 11px;
  box-shadow: var(--shadow-card);
}
.lc-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(140deg, #fde8e8, #fdd9d3);
}
.lc-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.lc-title {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-sub {
  font-size: 10.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-site {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
}
.lc-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ink-3);
}

/* --- Video artifact (attachment-style, plays in-thread) --- */
.video-card {
  position: relative;
  width: 300px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.vc-thumb {
  position: relative;
  height: 108px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2b3d3a 0%, #127c6d 60%, #1f9c88 100%);
}
.vc-thumb .vc-glyph {
  position: absolute;
  font-size: 34px;
  opacity: 0.28;
}
.vc-play {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.vc-play::after {
  content: '';
  margin-left: 3px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent var(--teal);
}
.vc-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  padding: 2px 7px;
}
.vc-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
}
.vc-meta .vc-t {
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vc-meta .vc-s {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--ink-3);
}

/* --- Visual diagram artifact (mermaid-style flow) --- */
.diagram-card .dg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 0 1px;
}
.dg-node {
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: var(--teal-subtle);
  border: 1.5px solid rgba(18, 124, 109, 0.45);
  border-radius: 9px;
  padding: 6px 10px;
}
.dg-node .dg-sub {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.dg-node.alt {
  background: var(--ai-bg);
  border-color: rgba(217, 111, 67, 0.45);
}
.dg-arrow {
  font-size: 12px;
  line-height: 1;
  color: var(--teal);
  font-weight: 700;
}

/* --- Code artifact --- */
.code-card {
  align-self: flex-start;
  width: 86%;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid #2b2c25;
  animation: pop 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.row .code-card {
  width: 100%;
}
.cc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #33342c;
  color: #d8d7cd;
  font-size: 10.5px;
  font-weight: 600;
}
.cc-lang {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8fd4c8;
  background: rgba(18, 124, 109, 0.25);
  border-radius: 999px;
  padding: 2px 8px;
}
.cc-body {
  background: #26271f;
  padding: 9px 12px 11px;
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.6;
  color: #d8d7cd;
  overflow: hidden;
}
.cc-line {
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-line .k {
  color: #e8a07e;
}
.cc-line .s {
  color: #a8cf8e;
}
.cc-line .c {
  color: #77766c;
}
.cc-line .f {
  color: #8fb8e8;
}

/* --- GitHub PR card --- */
.pr-card {
  align-self: flex-start;
  width: 86%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 10px 12px 11px;
  box-shadow: var(--shadow-card);
  animation: pop 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.pr-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.pr-octo {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: var(--ink);
  position: relative;
}
.pr-octo::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 7px;
  height: 5px;
  border-radius: 4px 4px 2px 2px;
  background: #fff;
}
.pr-num {
  margin-left: auto;
  font-weight: 700;
  color: var(--teal);
}
.pr-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
}
.pr-branch {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--ink-3);
}
.pr-branch .mono {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  background: var(--paper-2);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--ink-2);
}
.pr-status {
  margin-top: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3.5px 10px;
}
.pr-status.ok {
  color: #1a7f37;
  background: rgba(26, 127, 55, 0.1);
}
.pr-card.approved {
  border-color: var(--teal);
}

/* ---------- Decision card ---------- */
.decision {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: 13px;
  padding: 11px 12px 12px;
  box-shadow: 0 10px 26px rgba(38, 39, 31, 0.14);
  animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.decision.in-chat {
  align-self: stretch;
}
.decision.in-rail {
  animation:
    slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both,
    pulse-ring 1.4s ease 0.5s;
}
.decision .d-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 6px;
}
.d-check {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 9px;
  display: grid;
  place-items: center;
}
.decision .d-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
}
.decision .d-why {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-2);
}
.decision .d-why b {
  color: var(--ink);
  font-weight: 600;
}
.decision .d-foot {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.agreed {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--ink-3);
}
.avatars {
  display: inline-flex;
}
.avatars span {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 8.5px;
  font-weight: 700;
  color: #fff;
  margin-left: -6px;
  border: 1.5px solid var(--card);
}
.avatars span:first-child {
  margin-left: 0;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-subtle);
  border-radius: 999px;
  padding: 3.5px 9px;
  transition: box-shadow 0.35s ease;
}
.decision.tracing .source-chip {
  box-shadow: 0 0 0 2px var(--teal);
}
.outbound-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ai);
  background: var(--ai-bg);
  border-radius: 999px;
  padding: 3.5px 9px;
  margin-top: 7px;
}
.outbound-chip .roll {
  color: var(--ink-3);
  font-weight: 500;
}

/* Desktop toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  box-shadow: 0 8px 24px rgba(38, 39, 31, 0.3);
  animation: pop 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 5;
  white-space: nowrap;
}

/* ---------- Composer ---------- */
.composer {
  flex: 0 0 auto;
  padding: 9px 12px 11px;
  border-top: 1px solid var(--border);
  background: inherit;
}
.composer .box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 7px 7px 14px;
}
.composer .ph {
  flex: 1;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
}
.composer .send {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
}

/* ---------- Phone frame (356 × 720 design size) ---------- */
.phone {
  position: relative;
  width: 356px;
  height: 720px;
  background: #1c1d17;
  border-radius: 46px;
  padding: 12px;
  box-shadow: var(--shadow-dev);
}
.phone::after {
  content: '';
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 22px;
  background: #1c1d17;
  border-radius: 999px;
  z-index: 6;
}
.screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--paper);
  border-radius: 34px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-header {
  flex: 0 0 auto;
  padding: 48px 16px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  z-index: 4;
}
.app-header .titlerow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chev {
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
}
.app-header .thread-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--paper-2);
}
.thread-meta {
  min-width: 0;
}
.app-header .thread-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 1px;
}
.thread-sub .live {
  color: var(--teal);
  font-weight: 600;
}
.phone .messages {
  padding: 14px 14px 8px;
}
.phone .row {
  max-width: 86%;
}
.phone .row.ai {
  max-width: 92%;
}
.phone .composer {
  padding-bottom: 16px;
  background: var(--paper);
}

/* Phone push-notification banner */
.notif {
  position: absolute;
  top: 14px;
  left: 12px;
  right: 12px;
  z-index: 7;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 11px 13px;
  box-shadow: 0 12px 32px rgba(38, 39, 31, 0.25);
  animation: drop-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.notif .n-ic {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.notif .n-t {
  font-size: 11.5px;
  font-weight: 700;
}
.notif .n-b {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 1px;
  line-height: 1.35;
}

/* ---------- Sign-off (stage-level overlay) ---------- */
.signoff {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: linear-gradient(160deg, #ffffff 0%, var(--paper) 60%, #eceae1 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 26px;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
}
.signoff.show {
  opacity: 1;
}
.signoff .wm {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: clamp(18px, 3.4vh, 24px);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.signoff .wm .glyph {
  width: 1.5em;
  height: 1.5em;
  border-radius: 0.45em;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8em;
}
.signoff .tagline {
  font-size: clamp(15px, 2.8vh, 20px);
  font-weight: 600;
  line-height: 1.35;
  max-width: 22em;
}
.signoff .tagline .em {
  color: var(--teal);
}
.signoff .url {
  font-size: clamp(11px, 1.9vh, 13px);
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

/* ---------- Caption + progress ---------- */
.caption {
  flex: 0 0 auto;
  min-height: 2.4em;
  max-width: min(560px, 94vw);
  text-align: center;
  font-size: clamp(12px, 2vh, 15px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink-2);
  transition: opacity 0.3s ease;
}
.caption b {
  color: var(--ink);
  font-weight: 700;
}
.caption .tealw {
  color: var(--teal);
  font-weight: 700;
}
.progress {
  flex: 0 0 auto;
  width: min(340px, 78vw);
  height: 4px;
  border-radius: 999px;
  background: rgba(38, 39, 31, 0.1);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--teal);
  border-radius: 999px;
  transition: width 0.45s linear;
}

.replay {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-2);
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 40;
}
body:hover .replay {
  opacity: 1;
}

/* ---------- Animations ---------- */
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes drop-in {
  from {
    opacity: 0;
    transform: translateY(-26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes badge-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes pulse-ring {
  0% {
    box-shadow:
      0 0 0 0 rgba(18, 124, 109, 0.45),
      0 10px 26px rgba(38, 39, 31, 0.14);
  }
  70% {
    box-shadow:
      0 0 0 14px rgba(18, 124, 109, 0),
      0 10px 26px rgba(38, 39, 31, 0.14);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(18, 124, 109, 0),
      0 10px 26px rgba(38, 39, 31, 0.14);
  }
}
@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .row,
  .decision,
  .artifact,
  .typing,
  .notif,
  .react-chip,
  .src-badge,
  .sysline,
  .toast {
    animation: none !important;
  }
  .dev {
    transition: opacity 0.2s ease;
  }
  .caret {
    display: none;
  }
}
