/* ==========================================================
   SupervisorDemo — the supervisor variant of home's WorkspaceDemo
   (Businesses page, Workspace section). Builds on css/workspace-demo.css:
   same window chrome, rail, cards, pills, buttons and cursor. Only the
   layout of the window and the Activate / Deliver views live here.
   Everything is scoped to .sv-demo, so home's demo is untouched.
   ========================================================== */

/* ---------- Window: flows with its content (home's is a fixed 1200×680 stage) ---------- */
/* Absolute (as in home's demo) so the design width never stretches the page;
   js/supervisor-demo.js sets the design width, scales it, and sizes the root. */
.sv-demo .nd-stage {
  width: 660px;
  height: auto;
}
.sv-demo .nd-window { position: relative; inset: auto; }
.sv-demo .nd-body { position: relative; top: auto; left: auto; right: auto; bottom: auto; }
/* Wide column (no roomy layout): a shared minimum window height */
.sv-demo--full .nd-window { min-height: 560px; }
.sv-demo--full .nd-body { min-height: 520px; } /* 560 minus the 40px chrome */

.sv-demo .nd-head { padding: 18px 28px 0; }
.sv-demo .nd-h1 { font-size: 20px; }
.sv-demo .nd-top { gap: 16px; }
.sv-demo .nd-top .nd-stack { padding-top: 4px; }
.sv-demo .nd-tabs { margin-top: 14px; }
/* Static tabs: the "on" tab carries its own white pill (no sliding pill needed) */
.sv-demo .nd-tab.on {
  background: #fff;
  box-shadow: 0 1px 2px rgba(7, 0, 48, 0.08), 0 4px 12px rgba(7, 0, 48, 0.06);
}
.sv-demo .nd-views { margin-top: 16px; }
.sv-demo .nd-view {
  position: relative;
  inset: auto;
  opacity: 1;
  transform: none;
  padding: 0 28px 24px;
  overflow: visible;
}

/* Loop reset: the view fades out, its states are put back, then it fades in again */
.sv-demo .nd-views { transition: opacity 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
.sv-demo.is-resetting .nd-views { opacity: 0; }

/* Cursor only shows while it is moving to a click */
.sv-demo .nd-cursor { opacity: 0; transition: opacity 0.3s; }
.sv-demo.is-cursor .nd-cursor { opacity: 1; }

/* Compact layout on phones: no side rail, fewer tabs, tighter padding */
.sv-demo--narrow .nd-rail { display: none; }
.sv-demo--narrow .nd-head { padding: 16px 18px 0; }
.sv-demo--narrow .nd-view { padding: 0 18px 18px; }
.sv-demo--narrow .nd-h1 { font-size: 18px; }
.sv-demo--narrow .nd-tab:first-child { display: none; }
.sv-demo .nd-btn { white-space: nowrap; }
/* Phones: the team avatars already show on each milestone row, so drop the header stack */
.sv-demo--narrow .nd-top > .nd-stack { display: none; }
.sv-demo--narrow .sv-plan-head { flex-wrap: wrap; }
.sv-demo--narrow .sv-row { gap: 8px; padding: 10px; }
.sv-demo--narrow .sv-row .nd-pill { min-width: 0; }
.sv-demo--narrow .sv-week { min-width: 28px; }

/* ---------- Shared bits ---------- */
.sv-h { font-size: 15px; font-weight: 800; }
.sv-k {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sv-k--gap { margin-top: 14px; }
.sv-week {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  min-width: 34px;
}
/* Status pills beyond workspace-demo.css: lime success, navy-outline progress */
.sv-demo .sv-ok { background: var(--lime); color: var(--navy); }
.sv-demo .sv-prog { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.sv-spark,
.sv-ai-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--navy);
  color: var(--lime);
}
.sv-spark { width: 18px; height: 18px; border-radius: 5px; }
.sv-spark svg { width: 11px; height: 11px; }
.sv-ai-av { width: 30px; height: 30px; border-radius: 50%; }
.sv-ai-av svg { width: 14px; height: 14px; }

/* ---------- 01 · Plan ---------- */
.sv-plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.sv-row { margin-top: 8px; padding: 11px 12px; }
.sv-row .nd-pill { min-width: 84px; justify-content: center; }

/* ---------- 02 · Guide ---------- */
.sv-guide { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px; align-items: start; }
.sv-brief { padding: 16px; }
.sv-brief__goal { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: #3b3762; }
.sv-brief__ms { display: flex; align-items: center; margin: 8px 0 8px; font-size: 12.5px; font-weight: 700; }
.sv-chat { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.sv-chat__head { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sv-chat__head .sv-ai-av { width: 26px; height: 26px; border-radius: 8px; }
.sv-chat__head small { margin-left: auto; }
.sv-demo .sv-msg { max-width: 92%; animation: none; }
.sv-demo .sv-msg .bub { font-size: 12px; }
/* The typing dots and the answer share one spot, so nothing jumps when the answer lands */
.sv-reply { display: grid; }
.sv-reply > .sv-msg { grid-area: 1 / 1; }
.sv-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sv-sources span {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
}

/* ---------- 02 · Deliver: Guidance, then Progress ---------- */
/* Views share one spot; switching tabs cross-fades them (the window keeps the taller one's height) */
.sv-demo .nd-views { display: grid; }
.sv-demo .nd-views > .nd-view { grid-area: 1 / 1; transition: opacity 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.35s; }
.sv-demo .nd-views > .nd-view:not(.on) { opacity: 0; visibility: hidden; }
.sv-demo .nd-views > .nd-view.on { transition-delay: 0s; }

/* Progress: the AI summary (wide, left) and Maya's submission (right) */
.sv-progress { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 1fr); gap: 14px; align-items: start; } /* 260px: Maya's card never squeezes its one-line text */
.sv-ai { padding: 18px; }
.sv-ai__line { position: relative; margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; color: #3b3762; }
/* Typing: the untyped rest keeps its place, hidden, so the line never reflows */
.sv-type__rest { visibility: hidden; }
/* The blocker: a soft lime highlight that pulses twice, then stays (opacity only) */
.sv-ai__blocker { margin-inline: -8px; padding: 4px 8px; border-radius: 8px; isolation: isolate; color: var(--navy); font-weight: 600; }
.sv-ai__blocker::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: rgba(209, 238, 43, 0.35);
  opacity: 0;
  transition: opacity 0.3s;
}
.sv-ai__blocker.is-flagged::before { opacity: 1; animation: sv-flag-pulse 0.9s ease-in-out 2; }
@keyframes sv-flag-pulse { 50% { opacity: 0.35; } }
.sv-flag {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--navy);
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
}
.sv-sub { padding: 16px; }
.sv-sub .tk-who .nm,
.sv-sub .tk-who .nm small,
.sv-sub .tk-file .nm { white-space: nowrap; } /* name, "Submitted today" and the file name: one line each */
.sv-sub .tk-file { margin-top: 12px; padding: 10px; }
.sv-sub .tk-file .fi { width: 32px; height: 38px; }
.sv-sub .tk-acts { margin-top: 12px; }
.sv-sub .tk-acts .nd-btn { transition: opacity 0.3s; }
.sv-sub .tk-acts.is-done .nd-btn:not(.sv-approved) { opacity: 0.35; }

.sv-demo--narrow .sv-guide,
.sv-demo--narrow .sv-progress { grid-template-columns: minmax(0, 1fr); }

/* ---------- Roomy layout (.sv-demo--wide: design width 760px+, e.g. the Businesses
   stacking cards). Fills the extra width instead of stretching the rows. ---------- */
.sv-demo--wide .nd-window,
.sv-demo--wide .nd-body { min-height: 0; } /* each card sizes to its own state */
.sv-demo--wide .nd-head { padding: 18px 32px 0; }
.sv-demo--wide .nd-view { padding: 0 32px 24px; }
.sv-demo--wide .sv-row { margin-top: 6px; padding: 10px 16px; }
.sv-demo--wide .sv-guide { grid-template-columns: 260px minmax(0, 1fr); gap: 18px; }
.sv-demo--wide .sv-msg { max-width: 78%; }
/* Deliver Progress: the AI summary wider than Maya's submission */
.sv-demo--wide .sv-progress { grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 18px; }
.sv-demo--wide .sv-ai { padding: 20px 22px; }
.sv-demo--wide .sv-ai__line { font-size: 14.5px; }

/* ---------- Animated "before" states (only once the script has mounted) ---------- */
.sv-demo.is-ready [data-sv-row],
.sv-demo.is-ready [data-sv-in],
.sv-demo.is-ready [data-sv-msg] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.sv-demo.is-ready [data-sv-row].is-in,
.sv-demo.is-ready [data-sv-in].is-in,
.sv-demo.is-ready [data-sv-msg].is-in { opacity: 1; transform: none; }
/* Maya's submission slides in from the right */
.sv-demo.is-ready .sv-sub[data-sv-in]:not(.is-in) { transform: translateX(16px); }

@media (prefers-reduced-motion: reduce) {
  .sv-demo .nd-cursor { display: none; }
  /* The final state, instantly: no cross-fades, slides or pulses */
  .sv-demo .nd-views > .nd-view,
  .sv-demo.is-ready [data-sv-row],
  .sv-demo.is-ready [data-sv-in],
  .sv-demo.is-ready [data-sv-msg] { transition: none; }
  .sv-ai__blocker.is-flagged::before { animation: none; }
}
