/* Entirely independent from autonomy-flow. Only .afv and its descendants are styled. */
.afv {
  --afv-bg: #101310;
  --afv-card: #161b17;
  --afv-accent: #d4f77d;
  --afv-text: #f0f2e9;
  --afv-muted: #a3aea2;
  --afv-line: #3a453b;
  --afv-warm: #e6b88a;
  box-sizing: border-box;
  width: 100%;
  max-width: 640px;
  min-width: 0;
  container-type: inline-size;
  isolation: isolate;
  border: 1px solid #303a31;
  border-radius: 18px;
  background: var(--afv-card);
  color: var(--afv-text);
  color-scheme: dark;
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-align: left;
}
.afv *, .afv *::before, .afv *::after { box-sizing: border-box; }
.afv h2, .afv h3, .afv p { margin: 0; padding: 0; color: inherit; }
.afv svg { display: block; }
.afv .afv__header { padding: 23px 20px; border-bottom: 1px solid #29322a; }
.afv .afv__eyebrow, .afv .afv__label, .afv .afv__branch-label, .afv .afv__note > :first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .05em;
}
.afv .afv__eyebrow { color: var(--afv-accent); margin-bottom: 9px; font-size: 9px; }
.afv .afv__header h2 { font-weight: 500; font-size: 20px; line-height: 1.3; letter-spacing: -.03em; text-wrap: balance; }

/* One main column at EVERY width; the second column is reserved for recovery. */
.afv .afv__stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-rows: repeat(6, auto);
  gap: 26px 20px;
  padding: 24px 14px;
}
.afv .afv__connections { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.afv .afv__edge, .afv .afv__arrow { fill: none; stroke: var(--afv-line); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; transition: stroke 220ms; }
.afv .afv__edge--control { stroke-dasharray: 2 5; }
.afv .afv__edge--branch { stroke-dasharray: 4 4; }
.afv .afv__edge--active, .afv .afv__arrow--active { stroke: var(--afv-accent); }
.afv .afv__edge--warm, .afv .afv__arrow--warm { stroke: var(--afv-warm); }
.afv .afv__token { fill: var(--afv-accent); stroke: var(--afv-card); stroke-width: 1.5; }
.afv .afv__token--warm { fill: var(--afv-warm); }
.afv .afv__node, .afv .afv__controller, .afv .afv__recovery {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 13px 11px;
  border: 1px solid #354035;
  border-radius: 10px;
  background: #191f1a;
  transition: border-color 300ms, background-color 300ms, box-shadow 300ms;
}
.afv .afv__controller { grid-column: 1; grid-row: 1; background: #20271c; border-color: #64724a; }
.afv .afv__node { grid-column: 1; }
.afv .afv__node--plan { grid-row: 2; }
.afv .afv__node--build { grid-row: 3; }
.afv .afv__node--check { grid-row: 4; }
.afv .afv__node--review { grid-row: 5; }
.afv .afv__node--pass { grid-row: 6; }
.afv .afv__label { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--afv-muted); font-size: 9px; letter-spacing: .015em; margin-bottom: 11px; }
.afv .afv__label svg, .afv .afv__recovery > svg { flex: 0 0 auto; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.afv .afv__controller .afv__label { color: #c3d4a4; }
.afv .afv__node h3, .afv .afv__controller h3, .afv .afv__recovery h3 { font-size: 16px; font-weight: 500; letter-spacing: -.025em; line-height: 1.3; margin-bottom: 6px; }
.afv .afv__node p, .afv .afv__controller p, .afv .afv__recovery p { font-size: 11px; line-height: 1.6; color: var(--afv-muted); }
.afv .afv__control-light { display: inline-block; width: 5px; height: 5px; margin-left: 9px; border-radius: 50%; vertical-align: middle; background: #889570; }
.afv .afv__control-long { display: none; }
.afv .afv__recovery { grid-column: 2; grid-row: 4; align-self: center; color: #a3aea2; border-style: dashed; border-color: #3d493d; background: #171d18; }
.afv .afv__recovery > svg { color: #969e88; margin-bottom: 9px; }
.afv .afv__branch-label { position: absolute; bottom: calc(100% + 11px); left: 0; width: 100%; font-size: 8px; text-align: center; line-height: 1.5; color: #a3aea2; }
.afv .afv__visited { border-color: #536341; }
.afv .afv__active { border-color: var(--afv-accent); background: #212b1e; box-shadow: 0 0 16px #d4f77d06; }
.afv .afv__active .afv__label { color: var(--afv-accent); }
.afv .afv__controller.afv__active .afv__control-light { background: var(--afv-accent); box-shadow: 0 0 9px #d4f77d30; }
.afv .afv__failure, .afv .afv__recovery.afv__active { border-color: var(--afv-warm); background: #29241d; box-shadow: 0 0 16px #e6b88a08; }
.afv .afv__failure .afv__label, .afv .afv__recovery.afv__active > svg, .afv .afv__recovery.afv__active .afv__branch-label { color: var(--afv-warm); }
.afv .afv__recovery.afv__active h3 { color: var(--afv-text); }
.afv .afv__footer { display: flex; align-items: baseline; gap: 10px; padding: 19px 20px; border-top: 1px solid #29322a; }
.afv .afv__status-dot { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--afv-accent); }
.afv .afv__footer > div { min-width: 0; }
.afv .afv__status-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.afv .afv__status-detail { color: var(--afv-muted); font-size: 11px; line-height: 1.6; min-height: 3.2em; }
.afv .afv__note { display: flex; flex-wrap: wrap; gap: 5px 12px; justify-content: space-between; padding: 13px 20px; border-top: 1px solid #29322a; color: var(--afv-muted); font-size: 9px; }
.afv .afv__note > :first-child { font-size: 8px; }
.afv .afv__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Only sizing changes. Stage order and branch placement remain vertical. */
@container (min-width: 440px) {
  .afv .afv__header { padding: 26px 30px; }
  .afv .afv__header h2 { font-size: 23px; }
  .afv .afv__stage { gap: 28px 36px; padding: 28px 30px; }
  .afv .afv__node, .afv .afv__controller, .afv .afv__recovery { padding: 15px 17px; }
  .afv .afv__label { font-size: 10px; }
  .afv .afv__node h3, .afv .afv__controller h3, .afv .afv__recovery h3 { font-size: 18px; }
  .afv .afv__node p, .afv .afv__controller p, .afv .afv__recovery p { font-size: 12px; }
  .afv .afv__control-long { display: block; }
  .afv .afv__control-short { display: none; }
  .afv .afv__branch-label { font-size: 9px; }
  .afv .afv__footer { padding: 20px 30px; }
  .afv .afv__note { padding-inline: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .afv *, .afv *::before, .afv *::after { transition: none !important; animation: none !important; }
  .afv .afv__token { display: none; }
}
.afv[data-afv-playback="paused"] * { transition: none; }

/* lindu.build integration: shared typography and palette; vertical geometry preserved. */
.afv{--afv-bg:var(--bg,#101310);--afv-card:var(--surface,#161b17);--afv-accent:var(--accent,#d4f77d);--afv-text:var(--ink,#f0f2e9);--afv-muted:var(--muted,#a3aea1);max-width:none;padding:0;border:0;border-radius:0;font:14px/1.6 var(--sans,Arial,Helvetica,sans-serif)}
.afv .afv__eyebrow,.afv .afv__label,.afv .afv__branch-label,.afv .afv__note>:first-child{font-family:var(--mono,ui-monospace,SFMono-Regular,Consolas,monospace);font-weight:400}
.afv .afv__header{padding:18px 22px}
.afv .afv__eyebrow{font-size:12px;line-height:1.6;letter-spacing:.5px;margin:0;color:var(--afv-muted)}
.afv .afv__stage{gap:12px 26px;padding:16px 22px}
.afv .afv__node,.afv .afv__controller,.afv .afv__recovery{padding:9px 12px;border-radius:3px}
.afv .afv__label{font-size:11px;line-height:1.5;letter-spacing:.2px;margin-bottom:6px}
.afv .afv__node h3,.afv .afv__controller h3,.afv .afv__recovery h3{font-size:14px;line-height:1.4;font-weight:400;letter-spacing:-.15px;margin-bottom:3px}
.afv .afv__stage-title{display:flex;align-items:center;justify-content:space-between;gap:8px}
.afv .afv__stage-title svg{flex:0 0 auto;width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;color:var(--afv-muted)}
.afv .afv__step{margin-right:6px;color:var(--afv-muted);font:11px/1.5 var(--mono,ui-monospace,SFMono-Regular,Consolas,monospace);letter-spacing:.2px}
.afv .afv__active .afv__step,.afv .afv__active .afv__stage-title svg{color:var(--afv-accent)}
.afv .afv__failure .afv__step,.afv .afv__recovery.afv__active .afv__stage-title svg{color:var(--afv-warm)}
.afv .afv__node p,.afv .afv__controller p,.afv .afv__recovery p{font-size:12px;line-height:1.5}
.afv .afv__branch-label{font-size:10px;line-height:1.5;bottom:calc(100% + 9px)}
.afv .afv__footer{padding:16px 22px}
.afv .afv__footer{position:relative}
.afv .afv__progress{position:absolute;top:-1px;left:0;right:0;height:1px;overflow:hidden}
.afv .afv__progress>span{display:block;width:100%;height:100%;background:var(--afv-accent);transform:scaleX(0);transform-origin:left center;will-change:transform}
.afv .afv__status-title{font-size:14px;font-weight:400;line-height:1.6}
.afv .afv__status-detail{font-size:12px;line-height:1.6}
.afv .afv__note{padding:12px 22px;font:11px/1.7 var(--mono,monospace)}
.afv .afv__note>:first-child{font-size:10px}
.autonomy-project{position:relative}
.autonomy-project>.autonomy-anchor{position:absolute;top:0}
.autonomy-project .architecture-note{margin:16px 0 0;padding-top:12px;border-top:1px solid var(--line,#30382f);color:var(--faint,#798675);font:11px/1.7 var(--mono,ui-monospace,SFMono-Regular,Consolas,monospace)}
@container(max-width:439px){
 .afv .afv__header{padding:16px}
 .afv .afv__eyebrow{font-size:11px}
 .afv .afv__stage{padding:14px 12px;gap:12px 20px}
 .afv .afv__node,.afv .afv__controller,.afv .afv__recovery{padding:8px 9px}
 .afv .afv__label{font-size:10px}
 .afv .afv__node h3,.afv .afv__controller h3,.afv .afv__recovery h3{font-size:14px}
 .afv .afv__step{font-size:10px;margin-right:4px}
 .afv .afv__node p,.afv .afv__controller p,.afv .afv__recovery p{font-size:12px}
 .afv .afv__branch-label{font-size:9px}
 .afv .afv__footer{padding:16px}
 .afv .afv__note{padding:12px 16px}
}

/* Divider lines inset to the same gutter as the other project visuals (.research-motion padding). */
.afv{--afv-gutter:24px}
@media(max-width:1050px){.afv{--afv-gutter:20px}}
@media(max-width:760px){.afv{--afv-gutter:16px}}
.afv .afv__header,.afv .afv__footer,.afv .afv__note{margin-inline:var(--afv-gutter);padding-inline:0}
.afv .afv__stage{padding-inline:var(--afv-gutter)}
/* Bottom note mirrors .research-caption: no divider, 8px below the status, card padding beneath. */
.afv .afv__footer{padding-bottom:0}
.afv .afv__note{border-top:0;padding-block:8px var(--afv-gutter-bottom,20px)}
.afv{--afv-gutter-bottom:24px}
@media(max-width:1050px){.afv{--afv-gutter-bottom:20px}}
/* Top label mirrors .research-top: no divider, card padding above, 19px gap to content. */
.afv .afv__header{border-bottom:0;padding-block:var(--afv-gutter-bottom) 0}
.afv .afv__stage{padding-top:19px}
/* Slightly longer connector arrows: arrows span the row gap (minus a 3px tip offset). */
.afv .afv__stage{row-gap:18px}
/* Orchestrator as the control layer: spans both workflow columns, content centred. */
.afv .afv__controller{grid-column:1 / -1;text-align:center}
.afv .afv__controller .afv__stage-title{justify-content:center;flex-wrap:wrap;gap:4px 10px}
/* The failed stage's icon follows the warning colour, like its border and step number. */
.afv .afv__failure .afv__stage-title svg{color:var(--afv-warm)}
/* Role micro-labels (AGENT / GATE / STATE): muted mono, secondary to the stage title. */
.afv .afv__meta{display:inline-flex;align-items:center;gap:10px;flex:0 0 auto}
.afv .afv__role{font:10px/1 var(--mono,ui-monospace,SFMono-Regular,Consolas,monospace);letter-spacing:.06em;color:var(--faint,#798675)}
@container(max-width:439px){
 .afv .afv__stage-title{gap:4px}
 .afv .afv__meta{gap:5px}
 .afv .afv__role{font-size:9px;letter-spacing:.03em}
}
@container(max-width:439px){
 .afv .afv__stage-title{flex-wrap:wrap;row-gap:2px}
 .afv .afv__meta{margin-left:auto}
}
/* The orchestrator's row stays centred, so its role label does not push to the right edge. */
.afv .afv__controller .afv__meta{margin-left:0}
/* Orchestrator: title stays centred; role label + icon sit top-right like the other stages. */
.afv .afv__controller .afv__stage-title{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;column-gap:10px}
.afv .afv__controller .afv__stage-title>span:first-child{grid-column:2}
.afv .afv__controller .afv__meta{grid-column:3;justify-self:end}
