/* AI usage metering page — ledger card, comparison panels, steps, code tabs, table, acts grid */

/* More breathing room between sections on this page than the pillar default */
:root {
  --pillar-section-y: 3rem;
  --pillar-section-y-end: 1.5rem;
}

/* —— Ledger card (hero, right column) —— */
.ledger-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'] .ledger-card {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}
.ledger-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;
}
.ledger-card-head b {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ledger-card-tag {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}
.ledger-head-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 52px minmax(56px, 1.15fr) 72px 80px;
  gap: 0.7rem;
  padding: 0.55rem 0.95rem 0;
  font-size: 11px;
  color: var(--muted);
}
.ledger-head-row span:nth-child(4) {
  text-align: right;
}
.ledger-rows {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.4rem 0.2rem;
}
.ledger-rows li {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 52px minmax(56px, 1.15fr) 72px 80px;
  gap: 0.7rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.86rem;
}
.ledger-rows li:hover {
  background: rgba(20, 26, 40, 0.035);
}
html[data-theme='dark'] .ledger-rows li:hover {
  background: rgba(231, 237, 255, 0.04);
}
.ledger-rows li.cur {
  background: var(--callout-bg);
}
.ledger-rows .id {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger-rows .plan {
  font-size: 12px;
  color: var(--muted);
}
.ledger-mini {
  height: 8px;
  border-radius: 999px;
  background: rgba(20, 26, 40, 0.06);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
html[data-theme='dark'] .ledger-mini {
  background: rgba(231, 237, 255, 0.05);
}
.ledger-mini i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--blue);
  border-radius: 999px;
}
.ledger-mini i.over {
  background: var(--rose);
}
.ledger-rows .u {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.ledger-status {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  padding: 3px 0;
}
.ledger-status.allow {
  background: var(--ok-bg);
  color: var(--ok-ink);
}
.ledger-status.route {
  background: var(--callout-bg);
  color: var(--blue);
}
.ledger-status.block {
  background: color-mix(in srgb, var(--rose) 14%, transparent);
  color: var(--rose);
}
.ledger-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: 100px;
}
html[data-theme='dark'] .ledger-decision {
  background: rgba(231, 237, 255, 0.03);
}
.ledger-decision.block {
  background: color-mix(in srgb, var(--rose) 9%, transparent);
  border-color: transparent;
}
.ledger-decision b {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}
.ledger-decision p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.ledger-card-foot {
  padding: 0.55rem 0.95rem 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .ledger-head-row,
  .ledger-rows li {
    grid-template-columns: minmax(0, 1fr) 68px 76px;
  }
  .ledger-head-row span:nth-child(2),
  .ledger-head-row span:nth-child(3),
  .ledger-rows .plan,
  .ledger-rows .mini-cell {
    display: none;
  }
}

/* —— Problem story: two-panel comparison —— */
.compare-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
  border-top: 1px solid var(--line);
}
.compare-section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.compare-section .lede {
  margin: 0;
  max-width: 42em;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}
.compare-section .lede + .lede {
  margin-top: 0.85rem;
}
.compare-section .lede strong {
  color: var(--ink);
}
.compare-panels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.compare-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 1.1rem 1.1rem 1.2rem;
}
.compare-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  letter-spacing: -0.015em;
}
.compare-panel .cap {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.compare-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'] .compare-log {
  background: rgba(231, 237, 255, 0.03);
}
.compare-log em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}

/* —— Metered table —— */
.metered-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.metered-section h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.metered-section .sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  max-width: 42em;
  font-size: 0.98rem;
  line-height: 1.6;
}
.metered-section .sub.note-line {
  margin: 1.35rem 0 0;
  font-size: 0.9rem;
}
.data-table {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
  background: var(--card);
}
.data-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  padding: 1rem 1.35rem;
  background: rgba(20, 26, 40, 0.025);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
html[data-theme='dark'] .data-table th {
  background: rgba(231, 237, 255, 0.03);
}
.data-table td {
  padding: 1.05rem 1.35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--muted);
  line-height: 1.6;
}
.data-table td:first-child {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.data-table a {
  color: var(--blue);
}

/* —— How it works steps (shares shape with agent-meter page) —— */
.how-section .step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}
.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;
  color: var(--muted);
  max-width: 36em;
  font-size: 0.92rem;
  line-height: 1.55;
}

/* —— Code block with language tabs —— */
.code-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 1rem 0 0;
}
.code-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem 0.35rem 0.5rem;
  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-tabs {
  display: inline-flex;
  gap: 2px;
}
.code-tabs button {
  border: 0;
  background: transparent;
  padding: 0.3rem 0.65rem;
  border-radius: 7px;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.code-tabs button[aria-pressed='true'] {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
}
.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: 1.5rem;
  padding: 1.1rem 1.35rem;
  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.4rem;
  color: var(--callout-ink);
  font-size: 0.92rem;
}
.how-note p {
  margin: 0;
  color: var(--callout-ink);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* —— Actions grid —— */
.acts-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.acts-section h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.acts-section .sub {
  margin: 0 0 2rem;
  color: var(--muted);
  max-width: 42em;
  font-size: 0.98rem;
  line-height: 1.6;
}
.acts-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}
.acts-grid div {
  padding: 1.5rem 1.35rem;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.acts-grid div:last-child {
  border-right: 0;
}
.acts-grid b {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}
.acts-grid span {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  display: block;
}
.acts-grid a {
  color: var(--blue);
}

@media (max-width: 980px) {
  .compare-panels {
    grid-template-columns: 1fr;
  }
  .acts-grid {
    grid-template-columns: 1fr 1fr;
  }
  .acts-grid div {
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 560px) {
  .acts-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Cross-sell links (3-up) —— */
.cross-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}
.cross-links a {
  display: block;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 1.35rem 1.35rem;
  color: var(--ink);
  text-decoration: none;
}
.cross-links a:hover {
  border-color: var(--blue);
}
.cross-links b {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
}
.cross-links span {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
@media (max-width: 760px) {
  .cross-links {
    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);
}
