/* "From checkpoint to chat" on /bot. Three square panels joined by one Signal trace; stacks below 1000px and 720px. */
.bot-sequence {
  --seq-row: 34px;
  --seq-match: color-mix(in srgb, var(--ink) 6%, var(--surface));
  --seq-panel: color-mix(in srgb, var(--surface) 40%, var(--bg));
  padding-block: 72px 88px; border-top: 1px solid var(--line);
}
.bot-sequence svg { width: auto; height: auto; fill: none; stroke: none; }
.bot-seq-label { font: 400 11px/16px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bot-seq-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .72fr) minmax(0, 1fr); gap: 56px; }
.bot-seq-panel { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--seq-panel); border: 1px solid var(--line-strong); }
.bot-seq-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.bot-seq-step { display: flex; gap: 10px; align-items: baseline; font: 600 13px/16px var(--sans); letter-spacing: -.01em; color: var(--ink); }
.bot-seq-step b { font: 500 11px/16px var(--mono); letter-spacing: .06em; color: var(--valseq-signal); }

/* 01 Observe: the checkpoint tape */
.bot-seq-tape { position: relative; height: calc(var(--seq-row) * 11); overflow: hidden; }
.bot-seq-tape::before, .bot-seq-tape::after { content: ''; position: absolute; left: 0; right: 0; z-index: 2; height: 56px; pointer-events: none; }
.bot-seq-tape::before { top: 0; background: linear-gradient(var(--seq-panel), transparent); }
.bot-seq-tape::after { bottom: 0; background: linear-gradient(transparent, var(--seq-panel)); }
.bot-seq-row { position: absolute; left: 0; right: 0; display: grid; grid-template-columns: 14px 11ch minmax(0, 1fr) auto; gap: 12px; align-items: center; height: var(--seq-row); padding-inline: 12px 16px; border-block: 1px solid transparent; color: var(--muted); font: 400 12px/1 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; will-change: transform; }
.bot-seq-row > span:nth-child(3) { overflow: hidden; text-overflow: ellipsis; }
.bot-sequence .bot-seq-row svg { width: 10px; height: 8px; }
.bot-seq-row path { fill: transparent; }
.bot-seq-row.is-match { background: var(--seq-match); border-color: var(--line-strong); color: var(--ink); transition: background-color .18s, color .18s; }
.bot-seq-row.is-match path { fill: var(--valseq-signal); }
.bot-seq-row.is-match > span:last-child { font-weight: 500; }
.bot-seq-scan { position: absolute; left: 0; right: 0; z-index: 3; height: 0; pointer-events: none; }
.bot-seq-scan::before, .bot-seq-scan::after { content: ''; position: absolute; top: -1px; width: 6px; height: 2px; background: var(--ink); }
.bot-seq-scan::before { left: 0; }
.bot-seq-scan::after { right: 0; }
.bot-seq-foot { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }

/* 02 Evaluate: the cap of the Sequence V is the control point */
.bot-seq-eval { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 24px 20px; }
.bot-sequence .bot-seq-vmark { display: block; width: 104px; height: auto; overflow: visible; flex-shrink: 0; }
.bot-seq-vmark .bot-seq-v-body, .bot-seq-vmark .bot-seq-v-cap { fill: var(--ink); }
.bot-seq-vmark .bot-seq-v-cap { transition: fill .18s; }
.bot-seq-vmark.is-docked .bot-seq-v-cap { fill: var(--valseq-signal); }
.bot-seq-rules { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; transition: opacity .2s; }
.bot-seq-rules.is-idle { opacity: .45; }
.bot-seq-rules li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; align-items: start; }
.bot-seq-tick { display: grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border: 1px solid var(--line-strong); transition: background-color .15s, border-color .15s; }
.bot-sequence .bot-seq-tick svg { width: 10px; height: 10px; stroke: var(--valseq-ivory); stroke-width: 2.4; opacity: 0; transition: opacity .15s; }
.bot-seq-rules li.is-ok .bot-seq-tick { background: var(--valseq-positive); border-color: var(--valseq-positive); }
.bot-seq-rules li.is-ok .bot-seq-tick svg { opacity: 1; }
.bot-seq-k { display: block; font: 400 10px/14px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bot-seq-v { display: block; font: 500 12px/18px var(--mono); color: var(--ink); overflow-wrap: anywhere; }

/* 03 Deliver: the Telegram chat */
.bot-seq-chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bot-seq-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; background: var(--valseq-ink); outline: 1px solid var(--line); }
.bot-sequence .bot-seq-avatar svg { width: 20px; }
.bot-seq-avatar .bot-seq-v-body { fill: var(--valseq-ivory); }
.bot-seq-avatar .bot-seq-v-cap { fill: var(--valseq-signal); }
.bot-seq-chat-name { color: var(--ink); font: 600 14px/18px var(--sans); }
.bot-seq-chat-name small { margin-left: 6px; padding: 2px 4px; border: 1px solid var(--line-strong); color: var(--muted); font: 400 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.bot-seq-chat-sub { color: var(--muted); font: 400 11px/16px var(--mono); }
.bot-seq-chat-sub i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: var(--valseq-positive); vertical-align: 1px; }
.bot-seq-viewport { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.bot-seq-msgs { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.bot-seq-msg { align-self: flex-start; width: min(100%, 300px); padding: 12px 14px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px 12px 12px 2px; color: var(--ink); }
.bot-seq-msg-cat { display: flex; align-items: center; gap: 8px; margin-bottom: 6px !important; color: var(--muted); font: 400 10px/14px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.bot-sequence .bot-seq-msg-cat svg { width: 14px; height: 14px; flex-shrink: 0; stroke: var(--valseq-signal); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bot-seq-msg-title { font: 600 16px/22px var(--sans); letter-spacing: -.02em; }
.bot-seq-msg-detail { margin: 2px 0 8px !important; color: var(--muted); font-size: 13px; line-height: 20px; }
.bot-seq-msg dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin-bottom: 8px; padding-top: 8px; border-top: 1px solid var(--line); font: 400 11px/16px var(--mono); font-variant-numeric: tabular-nums; }
.bot-seq-msg dt { color: var(--muted); }
.bot-seq-msg dd { text-align: right; overflow-wrap: anywhere; }
.bot-seq-msg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font: 400 11px/16px var(--mono); font-variant-numeric: tabular-nums; }
.bot-seq-msg-foot span { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--valseq-signal); text-underline-offset: 3px; }
.bot-seq-input { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.bot-seq-input span:last-child { font: 400 11px/16px var(--mono); }

/* The trace */
.bot-sequence .bot-seq-wires { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.bot-sequence .bot-seq-wire { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 5; opacity: .7; }
.bot-sequence .bot-seq-trace { stroke: var(--valseq-signal); stroke-width: 2; }
.bot-sequence .bot-seq-packet { fill: var(--valseq-signal); }

/* Controls and notes */
.bot-seq-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px; margin-top: 20px; }
.bot-seq-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--ink); border-radius: var(--radius-control); background: transparent; color: var(--ink); font: 500 13px/1 var(--sans); }
.bot-seq-toggle:hover { background: var(--ink); color: var(--bg); }
.bot-sequence .bot-seq-toggle svg { width: 12px; height: 12px; fill: currentColor; }
.bot-seq-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 56px; margin: 56px 0 0; padding: 0; list-style: none; }
.bot-seq-notes li { padding-top: 20px; border-top: 1px solid var(--line-strong); }
.bot-seq-notes h3 { margin: 8px 0; color: var(--ink); font: 600 18px/24px var(--sans); letter-spacing: -.025em; }
.bot-seq-notes p { color: var(--muted); font-size: 14px; line-height: 22px; }

@media (max-width: 1000px) {
  .bot-seq-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px 32px; }
  .bot-seq-panel-eval { grid-column: 1 / -1; grid-row: 2; }
  .bot-seq-panel-chat { grid-column: 2; grid-row: 1; }
  .bot-seq-eval { flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: 32px; }
  .bot-seq-rules { flex: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) { .bot-sequence { padding-block: 48px 56px; } }
@media (max-width: 720px) {
  .bot-seq-stage { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .bot-seq-panel-eval, .bot-seq-panel-chat { grid-column: 1; grid-row: auto; }
  .bot-seq-panel-chat { height: 340px; }
  .bot-seq-tape { height: calc(var(--seq-row) * 6); }
  .bot-seq-tape::after { display: none; }
  .bot-seq-row { grid-template-columns: 10px 12ch minmax(0, 1fr) auto; gap: 8px; padding-inline: 10px 12px; font-size: 11px; }
  .bot-seq-eval { gap: 20px; padding: 20px 16px; }
  .bot-sequence .bot-seq-vmark { align-self: flex-start; width: 72px; margin-top: 4px; }
  .bot-seq-rules { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .bot-seq-notes { grid-template-columns: 1fr; margin-top: 40px; }
}
@media (forced-colors: active) {
  .bot-sequence .bot-seq-trace { stroke: Highlight; }
  .bot-sequence .bot-seq-packet { fill: Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  .bot-sequence * { transition: none !important; }
}
