/* ============================================================
   The Agent-Run Company · lifecycle/lifecycle.css
   Page rules for the lifecycle visualiser: the ring, the stage panel, the
   live board and its ticker, and the ALD-42 trace. Colours come from
   shared/tokens.css only.
   ============================================================ */

.lc-tabs .tabbar button { font-size: .95rem; }
.lc-tabs .tabbar button .n { font-family: var(--mono); font-size: .72rem; color: var(--cyan-deep); margin-right: 6px; }

/* ---- 1 · the loop ---- */
.loopwrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
.ring { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px; box-shadow: var(--shadow); }
.ring svg { display: block; width: 100%; height: auto; }
.ring .arc { fill: none; stroke: var(--line-2); stroke-width: 6; stroke-linecap: round; }
.ring .arc.learn { stroke: var(--cyan); stroke-dasharray: 12 9; }
.ring .arc.back { stroke: var(--bad); stroke-width: 4; stroke-dasharray: 7 7; }
.ring .arclbl { font: 600 12.5px var(--mono); fill: var(--cyan-deep); }
.ring .arclbl.back { fill: var(--bad); }
.ring .arclbl.plain { fill: var(--muted); font-weight: 500; }
.ring .stage { cursor: pointer; outline: none; }
.ring .stage .halo { fill: none; stroke: var(--sc); stroke-width: 3; opacity: 0; transition: opacity .2s; }
.ring .stage:focus-visible .halo, .ring .stage:hover .halo { opacity: .45; }
.ring .stage .bg { fill: #fff; stroke: var(--sc); stroke-width: 3.5; transition: fill .25s var(--ease); }
.ring .stage.on .bg { fill: var(--sc); }
.ring .stage .num { font: 700 12px var(--mono); fill: var(--sc); }
.ring .stage.on .num { fill: #fff; opacity: .85; }
.ring .stage .lbl { font: 700 21px var(--display); fill: var(--navy); }
.ring .stage.on .lbl { fill: #fff; }
.ring .stage .st { font: 500 11.5px var(--mono); fill: var(--muted); }
.ring .stage.on .st { fill: #fff; opacity: .9; }
.ring .packet { fill: var(--cyan); stroke: #fff; stroke-width: 2.5; }
.ring .packet.defect { fill: var(--bad); }
.ring .c1 { font: 700 19px var(--display); fill: var(--navy); }
.ring .c2 { font: 12.5px var(--font); fill: var(--muted); }
.ring .cap { font-size: .84rem; color: var(--muted); margin: 8px 6px 2px; }

.stagepanel { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--sc, var(--cyan)); border-radius: var(--radius-lg); padding: 18px 20px 16px; box-shadow: var(--shadow); }
.stagepanel .kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--sc, var(--cyan-deep)); display: block; }
.stagepanel h3 { font-family: var(--display); font-size: 1.45rem; color: var(--navy); margin: 3px 0 6px; }
.stagepanel .what { color: var(--ink-2); font-size: .98rem; }
.stagepanel dl { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 9px 14px; margin: 14px 0 0; font-size: .92rem; }
.stagepanel dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 4px; }
.stagepanel dd { margin: 0; color: var(--ink-2); min-width: 0; }
.stagepanel dd .row { gap: 6px; }
.stagepanel .statepill { display: inline-block; font-family: var(--mono); font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--info-soft); color: var(--navy); margin: 0 4px 4px 0; }
.stagepanel .art { display: inline-block; font-size: .8rem; padding: 2px 8px; border-radius: 6px; background: var(--neutral-soft); color: var(--ink-2); margin: 0 4px 4px 0; }
.stagepanel .gatebadge { display: inline-flex; flex-direction: column; gap: 1px; font-size: .8rem; padding: 5px 9px; border-radius: 8px; background: var(--violet-soft); color: var(--violet); margin: 0 6px 6px 0; }
.stagepanel .gatebadge b { font-family: var(--mono); font-size: .74rem; }
.stagepanel .gatebadge span { color: var(--ink-2); font-size: .78rem; }
.stagepanel .none { color: var(--muted); font-size: .88rem; }
.stagepanel .nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

/* ---- 2 · the board ---- */
.boardctl { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 12px; }
.boardctl .date { min-width: 200px; }
.boardctl .date b { display: block; font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--navy); line-height: 1.15; font-variant-numeric: tabular-nums; }
.boardctl .date span { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.boardctl label { font-size: .84rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.boardctl select { font: 600 .84rem var(--font); padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--navy); }
.boardctl input[type=range] { flex: 1 1 180px; min-width: 150px; accent-color: var(--cyan-deep); }
.boardwrap { overflow-x: auto; padding-bottom: 6px; }
.board { display: grid; grid-template-columns: repeat(7, minmax(148px, 1fr)); gap: 10px; min-width: 1096px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 8px; min-height: 330px; display: flex; flex-direction: column; }
.kcol h4 { margin: 2px 4px 8px; font-size: .72rem; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kcol h4 .cnt { font-family: var(--mono); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; font-size: .68rem; color: var(--muted); font-weight: 500; }
.klist { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.kcard { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--bc, var(--line-2)); border-radius: var(--radius); padding: 7px 9px; font-size: .8rem; box-shadow: var(--shadow); position: relative; }
.kcard.hidden { display: none; }
.kcard .kid { font-family: var(--mono); font-size: .7rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.kcard .kid .pts { background: var(--neutral-soft); border-radius: 999px; padding: 0 6px; color: var(--navy); font-weight: 600; }
.kcard .kt { font-weight: 600; color: var(--ink); line-height: 1.3; margin: 2px 0 5px; }
.kcard .kmeta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.kcard .chip { font-size: .7rem; padding: 0 7px 0 2px; }
.kcard .chip .dot { width: 15px; height: 15px; font-size: .58rem; }
.kcard .flag { font-family: var(--mono); font-size: .62rem; padding: 1px 6px; border-radius: 999px; background: var(--violet-soft); color: var(--violet); }
.kcard .flag.auth { background: var(--bad-soft); color: var(--bad); }
.kcard .flag.external { background: var(--warn-soft); color: var(--amber); }
.kcard .wait { display: none; gap: 6px; align-items: center; margin-top: 6px; font-size: .7rem; color: var(--violet); font-weight: 600; background: var(--violet-soft); border-radius: 6px; padding: 3px 6px; line-height: 1.25; }
.kcard.waiting .wait { display: flex; }
.kcard .wait .pav { width: 18px; height: 18px; flex: 0 0 auto; border-radius: 50%; background: var(--c-founder); color: #fff; font: 700 .6rem var(--display); display: grid; place-items: center; }
.kcard.waiting.rejected .wait { background: var(--bad-soft); color: var(--bad); }
.kcard.defect { border-left-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.kcard.defect::after { content: "defect"; position: absolute; top: -8px; right: 8px; font: 600 .58rem var(--mono); letter-spacing: .06em; text-transform: uppercase; background: var(--bad); color: #fff; padding: 1px 6px; border-radius: 999px; }
.kcard.deployed .kt { color: var(--ink-2); }
.kcard.moving { transition: transform .55s var(--ease), box-shadow .55s var(--ease); z-index: 2; }
.kcard.landed { animation: kland .6s var(--ease); }
@keyframes kland { 0% { box-shadow: 0 0 0 0 hsl(190 85% 45% / .5); } 100% { box-shadow: 0 0 0 10px hsl(190 85% 45% / 0); } }
.ticker { margin-top: 12px; background: var(--term-bg); color: var(--term-ink); border-radius: var(--radius-lg); padding: 10px 14px; font-family: var(--mono); font-size: .78rem; min-height: 96px; max-height: 212px; overflow: hidden; box-shadow: var(--shadow-lg); }
.ticker .head { color: var(--term-dim); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.ticker .row { display: grid; grid-template-columns: 92px auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 3px 0; border-bottom: 1px solid hsl(215 40% 18%); flex-wrap: nowrap; }
.ticker .row:last-child { border-bottom: 0; }
.ticker .row .t { color: var(--term-dim); white-space: nowrap; }
.ticker .row .m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticker .row .chip { background: transparent; border-color: hsl(215 30% 30%); color: var(--term-ink); font-size: .7rem; }
.ticker .row.new { animation: tickin .35s var(--ease); }
@keyframes tickin { from { opacity: 0; transform: translateY(-6px); } }
.ticker .empty { color: var(--term-dim); }
.boardnote { font-size: .88rem; color: var(--muted); margin: 10px 0 0; }

/* ---- 3 · one issue, traced ---- */
.tracehead { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .82rem; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; gap: 7px; align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; }
.legend i.state { border-radius: 50%; background: var(--navy); }
.legend i.gate { transform: rotate(45deg) scale(.82); background: var(--violet); border-radius: 2px; }
.legend i.artifact { background: #fff; border: 2.5px solid var(--cyan-deep); border-radius: 3px; }
.legend i.loop { width: 18px; border-left: 3px solid var(--amber); border-radius: 0; height: 14px; background: linear-gradient(90deg, var(--warn-soft), transparent); }
.trace { list-style: none; padding: 0; margin: 0; position: relative; --tcol: 118px; }
.trace::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: calc(var(--tcol) + 12px + 12px); width: 2px; background: var(--line-2); }
.trace li { display: grid; grid-template-columns: var(--tcol) 26px minmax(0, 1fr); gap: 0 12px; padding: 0 0 16px; position: relative; }
.trace li:last-child { padding-bottom: 0; }
.trace .when { font-family: var(--mono); font-size: .74rem; color: var(--muted); padding-top: 4px; text-align: right; line-height: 1.35; }
.trace .when b { display: block; color: var(--cyan-deep); font-weight: 600; }
.trace .mark { width: 26px; height: 26px; display: grid; place-items: center; position: relative; }
.trace .mark i { display: block; width: 16px; height: 16px; background: var(--ac, var(--navy)); border-radius: 50%; box-shadow: 0 0 0 4px var(--surface); }
.trace .gate .mark i { background: var(--violet); border-radius: 3px; transform: rotate(45deg) scale(.85); }
.trace .artifact .mark i { background: #fff; border: 3px solid var(--ac, var(--cyan-deep)); border-radius: 3px; width: 15px; height: 15px; }
.trace .body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px 9px; min-width: 0; }
.trace .body .hd { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.trace .body .hd b { font-family: var(--display); color: var(--navy); font-size: 1rem; }
.trace .body .hd .statepill { font-family: var(--mono); font-size: .68rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--info-soft); color: var(--navy); }
.trace .body p { margin: 3px 0 0; font-size: .9rem; color: var(--ink-2); }
.trace li.loop .body { border-left: 3px solid var(--amber); background: linear-gradient(90deg, var(--warn-soft), var(--surface) 55%); }
.trace li.loop-start { padding-top: 22px; }
.trace li.loop-start::before { content: attr(data-loop); position: absolute; top: 0; left: calc(var(--tcol) + 12px + 26px + 12px); font: 600 .66rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--amber); background: var(--warn-soft); padding: 1px 8px; border-radius: 999px; }
.trace li.loop-start .when, .trace li.loop-start .mark { margin-top: 0; }
.trace li.loop-end .body::after { content: "↺ back on the ring"; display: block; margin-top: 5px; font: 600 .68rem var(--mono); color: var(--amber); }

/* ---- links ---- */
.lc-links .card .go { margin-top: 6px; }

@media (max-width: 900px) {
  .loopwrap { grid-template-columns: 1fr; }
  .stagepanel dl { grid-template-columns: 92px 1fr; }
}
@media (max-width: 640px) {
  .trace { --tcol: 0px; }
  .trace::before { left: 12px; }
  .trace li { grid-template-columns: 26px minmax(0, 1fr); }
  .trace .when { grid-column: 2; text-align: left; order: -1; padding: 0 0 4px; }
  .trace .when b { display: inline; margin-right: 6px; }
  .trace .mark { grid-row: 2; }
  .trace .body { grid-column: 2; }
  .trace li.loop-start::before { left: 38px; }
  .ticker .row { grid-template-columns: 72px minmax(0, 1fr); }
  .ticker .row .chip { display: none; }
  .boardctl .date { min-width: 0; flex: 1 1 100%; }
}
