body.is-ai .study>h1:first-child::before {
      content: "Applied AI · Case study · Agentic system design";
    }

    .study>h1 em,
    .topic-title em {
      color: var(--accent);
    }

    .topic-section,
    .part-section {
      min-width: 0;
    }

    .code-tab-label {
      display: block;
      margin: 14px 0 6px;
      color: var(--muted);
      font: 700 11px ui-monospace, monospace;
    }

    .figure {
      min-width: 0;
      max-width: 100%;
      margin: 22px 0;
      overflow: hidden;
    }

    .figure svg {
      display: block;
      width: 100%;
      max-width: 100%;
      height: auto;
      font-family: inherit;
    }

    .figure figcaption {
      margin-top: 10px;
      color: var(--muted);
      font-size: 13px;
    }

    .mermaid-fig .mermaid {
      overflow-x: auto;
    }

    .casefile {
      margin: 20px 0;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
    }

    .casefile-head {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 24px;
      padding: 12px 16px;
      color: var(--muted);
      background: var(--surface-raised);
      border-bottom: 1px solid var(--line);
      font: 12px ui-monospace, monospace;
    }

    .casefile-body {
      padding: 18px;
    }

    .casefile-body p {
      margin: 0;
      color: var(--text);
      font-size: 16px;
      line-height: 1.9;
    }

    mark {
      padding: 0 2px;
      color: inherit;
      background: transparent;
      border-bottom: 2px solid;
    }

    mark.up {
      border-color: var(--green);
    }

    mark.rej {
      border-color: var(--red);
    }

    mark.esc {
      border-color: var(--violet);
    }

    mark.drop {
      color: var(--muted);
      border-bottom-style: dotted;
      border-color: var(--line);
    }

    .gid {
      color: var(--muted);
      font: 600 10px ui-monospace, monospace;
    }

    .v {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 4px;
      font: 600 10px ui-monospace, monospace;
      text-transform: uppercase;
    }

    .v.up {
      color: var(--green);
      background: rgba(115, 201, 145, .13);
    }

    .v.rej {
      color: var(--red);
      background: rgba(244, 135, 113, .13);
    }

    .v.esc {
      color: var(--violet);
      background: rgba(197, 134, 192, .13);
    }

    .v.drop {
      color: var(--muted);
      background: var(--surface-raised);
    }

    .tally {
      display: grid;
      gap: 8px;
      margin: 18px 0;
    }

    .trow {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 12px 14px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 8px;
    }

    .tclaim {
      min-width: 0;
    }

    .tclaim .ev {
      display: block;
      color: var(--muted);
      font: 12px ui-monospace, monospace;
    }

    .tvotes {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
    }

    .dots {
      display: flex;
      gap: 3px;
    }

    .dot {
      width: 9px;
      height: 18px;
      border-radius: 2px;
    }

    .dot.up {
      background: var(--green);
    }

    .dot.rej {
      background: var(--red);
    }

    .dot.esc {
      background: var(--violet);
    }

    .conf,
    .amt {
      font: 12px ui-monospace, monospace;
      white-space: nowrap;
    }


    .stage-card {
      min-width: 0;
      margin: 18px 0;
      padding: 16px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 6px;
    }

    .stage-card.callout-warn {
      background: var(--surface-raised);
    }

    .stage-title {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 8px 12px;
      margin-bottom: 12px;
    }

    .stage-title h4 {
      margin: 0;
    }

    .stage-cost {
      margin-left: auto;
      color: var(--muted);
      font: 12px ui-monospace, monospace;
    }

    .stage-io {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      margin: 0;
    }

    .stage-io>div {
      min-width: 0;
      padding: 12px;
      background: var(--page);
      border: 1px solid var(--line);
      border-radius: 6px;
    }

    .stage-io dt {
      margin-bottom: 5px;
      color: var(--accent-bright);
      font: 700 11px ui-monospace, monospace;
      text-transform: uppercase;
    }

    .stage-io dd {
      margin: 0;
    }

    .stage-io pre {
      max-width: 100%;
      overflow-x: auto;
      margin: 6px 0 0;
      padding: 8px;
      color: var(--text);
      background: var(--code);
      font: 11px/1.5 ui-monospace, monospace;
      white-space: pre;
    }

    .stage-note {
      margin-top: 12px;
    }

    .annos {
      padding-left: 0;
      list-style: none;
    }

    .annos li {
      display: grid;
      grid-template-columns: 24px minmax(0, 1fr);
      gap: 8px;
      margin: 0 0 12px;
    }


    @media(max-width:700px) {
      .stage-io {
        grid-template-columns: 1fr;
      }

      .trow {
        grid-template-columns: 1fr;
      }

      .tvotes {
        justify-content: flex-start;
      }
    }

    .card-grid .big {
      display: block;
      color: var(--text);
      font-size: 24px;
      font-weight: 700;
      line-height: 1.2;
    }
