/* ============================================================
 * Workflow v4 — real UI-kit components inside product frames
 * ============================================================ */
.wf4 {
  background: var(--bg-surface-muted);
  padding: 120px 0;
  border-top: 1px solid var(--border);
}
.wf4__head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 64px;
}
.wf4__title {
  font-size: clamp(36px, 4.6vw, 56px);
  font-weight: 660;
  letter-spacing: -0.028em;
  line-height: 1.04;
  color: var(--fg-1);
  margin: 18px 0 0;
  text-wrap: balance;
}
.wf4__lede {
  margin: 18px auto 0;
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 56ch;
  text-wrap: pretty;
}

.wf4__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}
@media (max-width: 880px) {
  .wf4__grid { grid-template-columns: minmax(0, 1fr); }
  .wf4__cell { min-width: 0; }
}

.wf4__cell {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
}
.wf4__cell-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.wf4__cell-step {
  font-size: 12px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
}
.wf4__cell-name {
  font-size: 22px;
  font-weight: 630;
  letter-spacing: -0.015em;
  color: var(--fg-1);
  margin: 0;
}
.wf4__cell-caption {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fg-2);
  margin: 0;
  text-wrap: pretty;
  max-width: 56ch;
}

/* ---------- ProductFrame — subtle window chrome ---------- */
.wf4__frame {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(11, 18, 32, 0.04),
    0 24px 60px -24px rgba(11, 18, 32, 0.18);
  display: flex;
  flex-direction: column;
  min-height: 360px;
  flex: 1;
}
.wf4__frame-chrome {
  height: 36px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--bg-surface-muted);
  border-bottom: 1px solid var(--border);
}
.wf4__frame-dots { display: flex; gap: 6px; }
.wf4__frame-dots span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--neutral-200);
}
.wf4__frame-dots span:nth-child(1) { background: #E8B4A0; }
.wf4__frame-dots span:nth-child(2) { background: #E8D7A0; }
.wf4__frame-dots span:nth-child(3) { background: #B5E0B0; }
.wf4__frame-tab {
  font-size: 11.5px;
  font-weight: 540;
  color: var(--fg-2);
  letter-spacing: -0.005em;
}
.wf4__frame-body {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  min-width: 0;
  overflow: hidden;
}

/* TaskRow inside the loop frame — tighten on small screens so the row
   never exceeds the container width (Confidence column is sacrificed first). */
@media (max-width: 720px) {
  .wf4__tasks .bex-taskrow {
    grid-template-columns:
      14px
      minmax(0, 2fr)
      minmax(0, 1fr)
      minmax(0, 56px)
      auto
      !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }
  /* Hide the source / source-meta column on very tight screens — keep state,
     name, signal, confidence, action */
  .wf4__tasks .bex-taskrow > :nth-child(4) { display: none; }
}

/* ---------- 01 · Ask body ---------- */
.wf4__ask {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  background: var(--bg-surface);
}
.wf4__ask-user {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}
.wf4__ask-avatar {
  width: 28px; height: 28px;
  border-radius: 9999px;
  background: var(--bg-surface-muted);
  color: var(--fg-2);
  font-size: 10px;
  font-weight: 620;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}
.wf4__ask-user-bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-surface-muted);
  border-radius: 14px;
  border-top-left-radius: 4px;
}
.wf4__ask-user-name {
  font-size: 11px;
  color: var(--fg-3);
  font-weight: 590;
}
.wf4__ask-user-text {
  font-size: 13.5px;
  color: var(--fg-1);
  line-height: 1.45;
  letter-spacing: -0.005em;
}

.wf4__ask-plan { display: none; }

/* AI agent task list — checks off as it works */
.wf4__ask-tasks {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wf4__ask-tasks-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.wf4__ask-tasks-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
.wf4__ask-tasks-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-1);
  letter-spacing: -0.005em;
}
.wf4__ask-tasks-meta {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--fg-3);
}

.wf4__task {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.4;
  letter-spacing: -0.005em;
}
.wf4__task-check {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1.4px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.wf4__task--done {
  color: var(--fg-3);
}
.wf4__task--done .wf4__task-text {
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklab, var(--fg-3) 40%, transparent);
}
.wf4__task--done .wf4__task-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fg-on-accent);
}
.wf4__task--running .wf4__task-check {
  border: 0;
  background: transparent;
}
.wf4__task--running .wf4__task-text { color: var(--fg-1); font-weight: 540; }
.wf4__task-spin {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in oklab, var(--accent) 24%, var(--border));
  border-top-color: var(--accent);
  animation: wf4-spin 700ms linear infinite;
}
@keyframes wf4-spin { to { transform: rotate(360deg); } }
.wf4__task-status {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent);
}

/* ---------- 02 · Map body ---------- */
.wf4__map {
  flex: 1;
  position: relative;
  min-height: 280px;
}
.wf4__map-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-floating);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.wf4__map-island-item {
  font-size: 11.5px;
  font-weight: 540;
  color: var(--fg-2);
  padding: 5px 12px;
  border-radius: 9999px;
  letter-spacing: -0.005em;
}
.wf4__map-island-item:first-child {
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 590;
}

/* Map Copilot peek — floats bottom-center over the map */
.wf4__map-peek {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  padding: 12px 14px;
  background: color-mix(in oklab, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-floating);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wf4__map-peek-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wf4__map-peek-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 26%, transparent);
}
.wf4__map-peek-title {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--fg-3);
}
.wf4__map-peek-body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg-1);
  letter-spacing: -0.005em;
}
.wf4__map-peek-body b { font-weight: 620; }
.wf4__map-peek-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wf4__map-peek-chip {
  font-size: 11.5px;
  font-weight: 540;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--fg-2);
}
.wf4__map-peek-chip--primary {
  background: var(--accent);
  color: var(--fg-on-accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- 03 · Monitor body ---------- */
.wf4__tasks {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
}
/* Real TaskRow already brings its own borders. Remove the last one's
   bottom border so it doesn't double up with the frame. */
.wf4__tasks .bex-taskrow:last-child { border-bottom: 0 !important; }

/* Force fixed-width columns so the numeric column stays vertically aligned
   across rows even when signal / source content widths vary. Overrides the
   TaskRow's default flexible grid. */
.wf4__tasks .bex-taskrow {
  grid-template-columns:
    14px                  /* state dot   */
    minmax(0, 1.6fr)      /* name + cadence */
    96px                  /* signal      */
    minmax(0, 1fr)        /* source + meta */
    56px                  /* confidence  */
    76px                  /* action      */
    !important;
  gap: 14px !important;
  padding: 14px 16px !important;
}

/* Foot of the task list — calls out the freshly-created Rotterdam task */
.wf4__tasks-foot {
  margin-top: auto;
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 18px;
  background: color-mix(in oklab, var(--accent-soft) 40%, var(--bg-surface));
  border-top: 1px solid var(--border);
}
.wf4__tasks-foot-pip {
  width: 6px; height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
.wf4__tasks-foot-text {
  font-size: 12.5px;
  color: var(--fg-1);
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.wf4__tasks-foot-text b { font-weight: 620; }

/* ---------- 04 · Evidence body ---------- */
.wf4__ev {
  padding: 18px;
  background: var(--bg-surface);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* Strip the EvidenceLedger's own outer wrapper border/shadow when it sits
   inside our frame, so the chrome doesn't double. */
.wf4__ev > div:first-child {
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: transparent !important;
}

.wf4__ev-meta {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-surface-muted);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}
.wf4__ev-meta-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
}
.wf4__ev-meta-k {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  min-width: 100px;
}
.wf4__ev-meta-v {
  color: var(--fg-1);
  letter-spacing: -0.005em;
}
