.pj-body {
  --pj-ink: #17202a;
  --pj-muted: #5b6672;
  --pj-line: #d9dee5;
  --pj-paper: #ffffff;
  --pj-soft: #f5f7f9;
  --pj-red: #b42318;
  --pj-red-soft: #fff1ef;
  --pj-teal: #0f766e;
  --pj-teal-soft: #eaf8f6;
  --pj-gold: #9a6700;
  --pj-gold-soft: #fff8df;
  color: var(--pj-ink);
}

.pj-page {
  font-size: 18px;
}

.pj-page p,
.pj-page li,
.pj-page dd,
.pj-page summary,
.pj-page blockquote {
  line-height: 1.72;
}

.pj-hero {
  border-top: 5px solid var(--pj-red);
}

.pj-kicker {
  color: var(--pj-red);
}

.pj-live {
  border-left: 5px solid var(--pj-teal);
}

.pj-live-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pj-live-metrics div {
  min-height: 94px;
}

.pj-live-metrics dd {
  color: var(--pj-red);
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.pj-tabs {
  grid-template-columns: repeat(9, minmax(145px, 1fr));
}

.pj-tabs button {
  min-height: 56px;
  font-size: 1rem;
}

.pj-pipeline {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, auto));
  align-items: stretch;
  gap: 8px;
  margin: 24px 0;
}

.pj-pipeline > div {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--pj-line);
  border-top: 4px solid var(--pj-teal);
  border-radius: 6px;
  background: var(--pj-paper);
}

.pj-pipeline > div:nth-of-type(2n) {
  border-top-color: var(--pj-red);
}

.pj-pipeline strong {
  font-size: 1.02rem;
}

.pj-pipeline span {
  color: var(--pj-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.pj-pipeline > svg {
  align-self: center;
  width: 18px;
  color: #8c96a1;
}

.pj-principles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 28px;
}

.pj-principles div {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--pj-line);
  border-radius: 6px;
  background: var(--pj-soft);
}

.pj-principles strong,
.pj-principles span {
  display: block;
}

.pj-principles strong {
  margin-bottom: 6px;
  color: var(--pj-red);
  font-size: 1.06rem;
}

.pj-principles span {
  color: var(--pj-muted);
  font-size: 0.96rem;
}

.pj-index-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 24px 0;
}

.pj-index-card {
  padding: 22px;
  border: 1px solid var(--pj-line);
  border-radius: 8px;
  background: var(--pj-paper);
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.06);
}

.pj-index-card > header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.pj-index-card header p {
  margin: 0 0 4px;
  color: var(--pj-muted);
  font-size: 0.93rem;
}

.pj-index-card header h3 {
  margin: 0;
  font-size: 1.24rem;
}

.pj-score-ring {
  --pj-score: 0;
  display: grid;
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  place-content: center;
  border: 9px solid #e7ebef;
  border-color: var(--pj-teal) #e7ebef var(--pj-red) #e7ebef;
  border-radius: 50%;
  text-align: center;
  transform: rotate(calc((var(--pj-score) - 50) * 0.7deg));
}

.pj-score-ring strong,
.pj-score-ring span {
  transform: rotate(calc((var(--pj-score) - 50) * -0.7deg));
}

.pj-score-ring strong {
  color: var(--pj-red);
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pj-score-ring span {
  margin-top: 4px;
  color: var(--pj-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.pj-index-card .math-display {
  margin: 16px 0;
  overflow-x: auto;
  font-size: 1.04rem;
}

.pj-index-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0 0;
}

.pj-index-card dl div {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--pj-line);
  border-radius: 5px;
  background: var(--pj-soft);
}

.pj-index-card dt {
  color: var(--pj-muted);
  font-size: 0.9rem;
}

.pj-index-card dd {
  margin: 0;
  color: var(--pj-red);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pj-live-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 30px;
}

.pj-live-summary div {
  min-height: 86px;
  padding: 15px;
  border: 1px solid var(--pj-line);
  border-left: 4px solid var(--pj-gold);
  border-radius: 6px;
  background: var(--pj-gold-soft);
}

.pj-live-summary span,
.pj-live-summary strong {
  display: block;
}

.pj-live-summary span {
  color: var(--pj-muted);
  font-size: 0.92rem;
}

.pj-live-summary strong {
  margin-top: 6px;
  color: var(--pj-ink);
  font-size: 1.32rem;
  font-variant-numeric: tabular-nums;
}

.pj-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 30px;
}

.pj-type-card {
  min-height: 185px;
  padding: 18px;
  border: 1px solid var(--pj-line);
  border-top: 4px solid var(--pj-red);
  border-radius: 7px;
  background: var(--pj-paper);
}

.pj-type-card:nth-child(2n) {
  border-top-color: var(--pj-teal);
}

.pj-type-card h3 {
  min-height: 52px;
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.42;
}

.pj-type-card > strong {
  display: block;
  color: var(--pj-red);
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
}

.pj-type-card > span {
  color: var(--pj-muted);
  font-size: 0.9rem;
}

.pj-type-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.pj-type-card dl div {
  padding: 7px;
  background: var(--pj-soft);
}

.pj-type-card dt {
  color: var(--pj-muted);
  font-size: 0.78rem;
}

.pj-type-card dd {
  margin: 2px 0 0;
  font-weight: 750;
}

.pj-component-layout,
.pj-horizon-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0 30px;
}

.pj-component-layout > section,
.pj-horizon-layout > section {
  padding: 20px;
  border: 1px solid var(--pj-line);
  border-radius: 8px;
  background: var(--pj-paper);
}

.pj-component-layout h3,
.pj-horizon-layout h3 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}

.pj-row-list {
  display: grid;
  gap: 10px;
}

.pj-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 2fr) 68px;
  align-items: center;
  gap: 10px;
}

.pj-row-label {
  overflow: hidden;
  font-size: 0.91rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pj-row-track {
  position: relative;
  height: 13px;
  overflow: hidden;
  border-radius: 4px;
  background: #e6eaee;
}

.pj-row-fill {
  display: block;
  width: var(--pj-width, 0%);
  height: 100%;
  background: var(--pj-teal);
}

.pj-row:nth-child(2n) .pj-row-fill {
  background: var(--pj-red);
}

.pj-row-value {
  text-align: right;
  font-size: 0.91rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.pj-model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0 30px;
}

.pj-model-card {
  padding: 22px;
  border: 1px solid var(--pj-line);
  border-radius: 8px;
  background: var(--pj-paper);
}

.pj-model-card > header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.pj-model-card > header > span,
.pj-chart-card figcaption > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 5px;
  background: var(--pj-red);
  color: #fff;
  font-weight: 800;
}

.pj-model-card header p,
.pj-model-card header h3 {
  margin: 0;
}

.pj-model-card header p {
  color: var(--pj-teal);
  font-size: 0.88rem;
  font-weight: 700;
}

.pj-model-card header h3 {
  margin-top: 3px;
  font-size: 1.22rem;
}

.pj-model-card .math-display {
  margin: 18px 0;
  overflow-x: auto;
}

.pj-model-card dl {
  display: grid;
  gap: 10px;
}

.pj-model-card dl div {
  padding: 12px;
  border-left: 4px solid var(--pj-teal);
  background: var(--pj-soft);
}

.pj-model-card dt {
  margin-bottom: 4px;
  color: var(--pj-red);
  font-weight: 800;
}

.pj-model-card dd {
  margin: 0;
}

.pj-model-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.pj-model-flow div {
  padding: 10px;
  border: 1px solid var(--pj-line);
  border-radius: 5px;
}

.pj-model-flow strong,
.pj-model-flow span {
  display: block;
}

.pj-model-flow strong {
  color: var(--pj-teal);
  font-size: 0.9rem;
}

.pj-model-flow span {
  margin-top: 4px;
  color: var(--pj-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.pj-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.pj-chart-card {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--pj-line);
  border-radius: 8px;
  background: var(--pj-paper);
}

.pj-chart-card figcaption {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.pj-chart-card figcaption h3,
.pj-chart-card figcaption p {
  margin: 0;
}

.pj-chart-card figcaption h3 {
  font-size: 1.16rem;
}

.pj-chart-card figcaption p {
  margin-top: 7px;
  color: var(--pj-muted);
  font-size: 0.92rem;
}

.pj-chart-stage {
  min-height: 285px;
  margin: 18px 0;
  padding: 12px;
  border: 1px solid var(--pj-line);
  border-radius: 6px;
  background: var(--pj-soft);
}

.pj-chart-stage svg {
  display: block;
  width: 100%;
  height: 260px;
  overflow: visible;
}

.pj-reading-note {
  margin: 0;
  padding: 13px;
  border-left: 4px solid var(--pj-gold);
  background: var(--pj-gold-soft);
  color: #4d4636;
  font-size: 0.9rem;
}

.pj-witness-status {
  margin: 0 0 18px;
  padding: 12px 15px;
  border: 1px solid var(--pj-line);
  border-radius: 6px;
  background: var(--pj-teal-soft);
  color: #0b5e58;
  font-weight: 700;
}

.pj-witness-grid .bg-witness {
  border-radius: 8px;
}

.pj-witness-grid blockquote {
  font-size: 1.03rem;
}

.pj-insights article {
  border-radius: 7px;
}

.pj-glossary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pj-local-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--pj-line);
  border-radius: 6px;
  background: var(--pj-soft);
}

.pj-local-note svg {
  width: 20px;
  flex: 0 0 20px;
  color: var(--pj-teal);
}

.pj-loading {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--pj-muted);
  text-align: center;
}

.pj-error {
  padding: 14px;
  border: 1px solid #f1b8b3;
  border-radius: 6px;
  background: var(--pj-red-soft);
  color: #8c1d18;
}

.pj-observed {
  color: var(--pj-muted);
  font-size: 0.92rem;
}

@media (max-width: 1180px) {
  .pj-tabs {
    grid-template-columns: repeat(5, minmax(150px, 1fr));
  }

  .pj-live-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pj-pipeline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pj-pipeline > svg {
    display: none;
  }

  .pj-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .pj-page {
    font-size: 17px;
  }

  .pj-tabs {
    grid-template-columns: repeat(3, minmax(145px, 1fr));
  }

  .pj-index-grid,
  .pj-model-grid,
  .pj-chart-grid,
  .pj-component-layout,
  .pj-horizon-layout {
    grid-template-columns: 1fr;
  }

  .pj-principles,
  .pj-live-summary,
  .pj-glossary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .pj-page {
    font-size: 16px;
  }

  .pj-live-metrics,
  .pj-tabs,
  .pj-pipeline,
  .pj-principles,
  .pj-type-grid,
  .pj-live-summary,
  .pj-glossary {
    grid-template-columns: 1fr;
  }

  .pj-index-card,
  .pj-model-card,
  .pj-chart-card,
  .pj-component-layout > section,
  .pj-horizon-layout > section {
    padding: 16px;
  }

  .pj-index-card > header {
    align-items: flex-start;
  }

  .pj-index-card dl,
  .pj-model-flow {
    grid-template-columns: 1fr;
  }

  .pj-row {
    grid-template-columns: minmax(105px, 1.1fr) minmax(80px, 1.6fr) 55px;
    gap: 7px;
  }

  .pj-row-label {
    white-space: normal;
  }

  .pj-chart-stage {
    min-height: 250px;
    padding: 6px;
  }

  .pj-chart-stage svg {
    height: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pj-score-ring,
  .pj-row-fill {
    transition: none !important;
  }
}
