/* Agent metering page — run card, loop story, walkthrough steps, code block */

/* —— Run card (hero, right column) —— */
.run-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(13, 18, 30, 0.055);
  display: flex;
  flex-direction: column;
  height: 100%;
}
html[data-theme='dark'] .run-card {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}
.run-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.run-card-head b {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.run-card-tag {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}
.run-rows {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.4rem 0.2rem;
}
.run-rows li {
  display: grid;
  grid-template-columns: 20px 1fr auto 86px;
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s, opacity 0.15s;
}
.run-rows li:hover {
  background: rgba(20, 26, 40, 0.035);
}
html[data-theme='dark'] .run-rows li:hover {
  background: rgba(231, 237, 255, 0.04);
}
.run-rows li.cur {
  background: var(--callout-bg);
}
.run-rows li.future {
  opacity: 0.38;
}
.run-rows .n {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}
.run-rows .t {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
}
.run-status {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  padding: 3px 0;
}
.run-status.allow {
  background: var(--ok-bg);
  color: var(--ok-ink);
}
.run-status.route {
  background: var(--callout-bg);
  color: var(--blue);
}
.run-status.block {
  background: color-mix(in srgb, var(--rose) 14%, transparent);
  color: var(--rose);
}

.run-ledger {
  padding: 0.35rem 0.95rem 0.2rem;
}
.run-ledger .lab {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.45rem;
  color: var(--ink);
}
.run-ledger .lab span:last-child {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
}
.run-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(20, 26, 40, 0.06);
  border: 1px solid var(--line);
}
html[data-theme='dark'] .run-bar {
  background: rgba(231, 237, 255, 0.05);
}
.run-bar .run-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--blue);
  transition: width 0.25s ease, background 0.2s;
}
.run-bar .run-fill.over {
  background: var(--rose);
}
.run-bar .run-tick {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--ink);
  opacity: 0.45;
}
.run-tick-labels {
  position: relative;
  height: 20px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 0.5rem;
}
.run-tick-labels span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.run-decision {
  margin: 0.4rem 0.95rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(20, 26, 40, 0.025);
  border: 1px solid var(--line);
  min-height: 104px;
}
html[data-theme='dark'] .run-decision {
  background: rgba(231, 237, 255, 0.03);
}
.run-decision b {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}
.run-decision p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.run-decision.block {
  background: color-mix(in srgb, var(--rose) 9%, transparent);
  border-color: transparent;
}

.run-scrub {
  padding: 0.8rem 0.95rem 0.3rem;
}
.run-scrub label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.run-scrub input[type='range'] {
  width: 100%;
  accent-color: var(--blue);
  margin: 0;
}
.run-card-foot {
  padding: 0.55rem 0.95rem 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* —— Loop story section —— */
.loop-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
  border-top: 1px solid var(--line);
}
.loop-section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.loop-section .lede {
  margin: 0;
  max-width: 42em;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}
.loop-section .lede + .lede {
  margin-top: 0.85rem;
}
.loop-section .lede strong {
  color: var(--ink);
}
.loop-panels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.loop-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 1.1rem 1.1rem 1.2rem;
}
.loop-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  letter-spacing: -0.015em;
}
.loop-panel .cap {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.loop-log {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.85;
  color: var(--muted);
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: rgba(20, 26, 40, 0.025);
  border-radius: 10px;
  overflow-x: auto;
  white-space: pre;
}
html[data-theme='dark'] .loop-log {
  background: rgba(231, 237, 255, 0.03);
}
.loop-log em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}

/* —— How-it-works steps —— */
.how-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.how-section h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.how-section .sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  max-width: 38em;
  font-size: 0.98rem;
}
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}
.step-list > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 1rem;
  padding: 0 0 1.75rem;
  position: relative;
}
.step-list > li::before {
  content: counter(step);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 1;
}
.step-list > li::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.step-list > li:last-child::after {
  display: none;
}
.step-list h3 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.step-list p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  max-width: 36em;
  font-size: 0.92rem;
  line-height: 1.55;
}
.step-list code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88em;
  background: rgba(20, 26, 40, 0.06);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
html[data-theme='dark'] .step-list code {
  background: rgba(231, 237, 255, 0.08);
}

.code-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 0.4rem 0 0;
}
.code-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: rgba(20, 26, 40, 0.025);
}
html[data-theme='dark'] .code-block-head {
  background: rgba(231, 237, 255, 0.03);
}
.code-copy {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
.code-copy:hover {
  background: var(--card);
  color: var(--ink);
}
.code-block pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--ink);
}
.code-block pre .tok-kw {
  color: #8b52c4;
}
.code-block pre .tok-str {
  color: #1f7f57;
}
.code-block pre .tok-cm {
  color: var(--muted);
}
html[data-theme='dark'] .code-block pre .tok-kw {
  color: #c9a2f2;
}
html[data-theme='dark'] .code-block pre .tok-str {
  color: #8fd8b0;
}

.how-note {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--callout-border);
  border-left: 3px solid var(--blue);
  border-radius: 12px;
  background: var(--callout-bg);
  max-width: 42em;
}
.how-note b {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--callout-ink);
  font-size: 0.92rem;
}
.how-note p {
  margin: 0;
  color: var(--callout-ink);
  font-size: 0.88rem;
  line-height: 1.5;
  opacity: 0.9;
}

/* —— Cross-sell links —— */
.cross-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.cross-links a {
  display: block;
  flex: 1 1 280px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.cross-links a:hover {
  border-color: var(--blue);
}
.cross-links b {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.92rem;
}
.cross-links span {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 1000px) {
  .loop-panels {
    grid-template-columns: 1fr;
  }
}

/* —— Dark closer CTA (page-specific: shared .cta-band is a light card elsewhere) —— */
.cta-band {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
}
.cta-band p {
  color: color-mix(in srgb, var(--btn-primary-ink) 70%, transparent);
}
.cta-band .btn-primary {
  background: var(--btn-primary-ink);
  color: var(--btn-primary-bg);
  border-color: var(--btn-primary-ink);
}
.cta-band .docs-link {
  color: color-mix(in srgb, var(--btn-primary-ink) 78%, transparent);
}
.cta-band .docs-link:hover {
  color: var(--btn-primary-ink);
  border-bottom-color: color-mix(in srgb, var(--btn-primary-ink) 40%, transparent);
}
