:root {
  --im-ink: #18262b;
  --im-muted: #526269;
  --im-line: #ccd7d9;
  --im-paper: #ffffff;
  --im-ground: #f3f6f5;
  --im-red: #a33431;
  --im-teal: #0d6b67;
  --im-blue: #315e9d;
  --im-gold: #886300;
  --im-violet: #6e4d87;
  --im-green: #34724f;
}

.im-body {
  color: var(--im-ink);
  background: var(--im-ground);
}

.im-page {
  --bg-red: var(--im-red);
  --bg-green: var(--im-green);
  --bg-blue: var(--im-blue);
  --bg-gold: var(--im-gold);
  --bg-violet: var(--im-violet);
  --bg-ground: var(--im-ground);
  --bg-line: var(--im-line);
}

.im-page p,
.im-page li,
.im-page dd,
.im-page td,
.im-page th {
  font-size: 1.08rem;
  line-height: 1.72;
}

.im-page h2 {
  letter-spacing: 0;
}

.im-hero {
  border-top-color: var(--im-teal);
}

.im-kicker {
  color: var(--im-teal);
}

.im-live {
  border-left-color: var(--im-red);
}

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

.im-live-metrics dd {
  color: var(--im-red);
  overflow-wrap: anywhere;
}

.im-observed {
  display: block;
  margin-top: 7px;
  color: var(--im-muted);
  font-size: 1rem;
}

.im-error {
  color: var(--im-red);
  font-weight: 750;
}

.im-boundary-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 28px;
  padding: 34px clamp(22px, 4vw, 58px);
  border-top: 1px solid var(--im-line);
  border-bottom: 1px solid var(--im-line);
  background: var(--im-paper);
}

.im-boundary-banner h2 {
  margin: 4px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.72rem, 2.5vw, 2.35rem);
}

.im-boundary-banner p {
  max-width: 920px;
  margin: 0;
  color: var(--im-muted);
}

.im-boundary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--im-line);
  border-top: 4px solid var(--im-blue);
}

.im-boundary-strip span {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--im-line);
  border-bottom: 1px solid var(--im-line);
}

.im-boundary-strip span:nth-child(2n) { border-right: 0; }
.im-boundary-strip span:nth-last-child(-n + 2) { border-bottom: 0; }

.im-boundary-strip b,
.im-boundary-strip i {
  display: block;
}

.im-boundary-strip b {
  color: var(--im-red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
}

.im-boundary-strip i {
  margin-top: 5px;
  color: var(--im-ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 1rem;
  font-style: normal;
  overflow-wrap: anywhere;
}

.im-tabs {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
}

.im-tabs button[aria-selected="true"] {
  color: #fff;
  background: var(--im-teal);
  border-color: var(--im-teal);
}

.im-pipeline {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, auto));
  align-items: stretch;
  margin: 0 0 28px;
  border-top: 4px solid var(--im-teal);
  background: var(--im-paper);
}

.im-pipeline > div {
  min-width: 0;
  padding: 20px 15px;
  border: 1px solid var(--im-line);
  border-top: 0;
}

.im-pipeline > i {
  align-self: center;
  width: 22px;
  color: var(--im-muted);
}

.im-pipeline strong,
.im-pipeline span {
  display: block;
}

.im-pipeline strong {
  margin-bottom: 7px;
  color: var(--im-teal);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.16rem;
}

.im-pipeline span {
  color: var(--im-muted);
  font-size: 1rem;
  line-height: 1.52;
}

.im-principles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 28px;
  border: 1px solid var(--im-line);
  background: var(--im-paper);
}

.im-principles > div {
  min-height: 130px;
  padding: 20px;
  border-right: 1px solid var(--im-line);
}

.im-principles > div:last-child { border-right: 0; }

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

.im-principles strong {
  margin-bottom: 8px;
  color: var(--im-red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.32rem;
}

.im-principles span {
  color: var(--im-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.im-boundary-cases {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 36px;
  border: 1px solid var(--im-line);
  background: var(--im-paper);
}

.im-boundary-cases article {
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--im-line);
  border-bottom: 1px solid var(--im-line);
}

.im-boundary-cases article:nth-child(2n) { border-right: 0; }
.im-boundary-cases article:nth-last-child(-n + 2) { border-bottom: 0; }

.im-boundary-cases header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.im-boundary-cases strong {
  color: var(--im-red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.34rem;
}

.im-boundary-cases code {
  color: var(--im-blue);
  font-size: 1.03rem;
  overflow-wrap: anywhere;
}

.im-boundary-cases p {
  margin: 10px 0 0;
  color: var(--im-muted);
}

.im-domain-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0 0 26px;
  border: 1px solid var(--im-line);
  background: var(--im-paper);
}

.im-domain-summary > div {
  min-height: 116px;
  padding: 18px;
  border-top: 5px solid var(--im-teal);
  border-right: 1px solid var(--im-line);
}

.im-domain-summary > div:nth-child(2) { border-top-color: var(--im-red); }
.im-domain-summary > div:nth-child(3) { border-top-color: var(--im-gold); }
.im-domain-summary > div:nth-child(4) { border-top-color: var(--im-blue); }
.im-domain-summary > div:nth-child(5) { border-top-color: var(--im-violet); }
.im-domain-summary > div:nth-child(6) { border-top-color: var(--im-green); border-right: 0; }

.im-domain-summary dt {
  color: var(--im-muted);
  font-size: 1rem;
  font-weight: 760;
}

.im-domain-summary dd {
  margin: 8px 0 0;
  color: var(--im-red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.52rem;
  font-weight: 700;
}

.im-domain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin: 0 0 28px;
}

.im-domain-grid > section {
  min-width: 0;
  border-top: 4px solid var(--im-blue);
  background: var(--im-paper);
}

.im-domain-grid > section:nth-child(2) { border-top-color: var(--im-violet); }

.im-domain-grid h3,
.im-table-section > h3 {
  margin: 0;
  padding: 20px 22px;
  border: 1px solid var(--im-line);
  border-top: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.48rem;
}

.im-layer-list,
.im-chain-list,
.im-source-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--im-line);
  border-top: 0;
}

.im-layer-list li,
.im-chain-list li,
.im-source-list li {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 1.4fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 70px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--im-line);
}

.im-layer-list li:last-child,
.im-chain-list li:last-child,
.im-source-list li:last-child { border-bottom: 0; }

.im-chain-list li {
  grid-template-columns: minmax(0, 1.55fr) auto;
}

.im-chain-list strong {
  display: block;
  color: var(--im-ink);
  font-size: 1.04rem;
}

.im-chain-list small,
.im-layer-list small,
.im-source-list small {
  display: block;
  margin-top: 3px;
  color: var(--im-muted);
  font-size: 0.94rem;
}

.im-bar-track {
  display: block;
  width: 100%;
  height: 11px;
  overflow: hidden;
  background: #e5ebec;
}

.im-bar-track i {
  display: block;
  height: 100%;
  background: var(--im-teal);
}

.im-table-section {
  margin: 0 0 30px;
  border-top: 4px solid var(--im-gold);
}

.im-table-shell {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--im-line);
  border-top: 0;
  background: var(--im-paper);
}

.im-data-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.im-data-table th {
  padding: 14px 15px;
  color: #fff;
  background: var(--im-ink);
  font-size: 0.98rem;
  font-weight: 760;
  text-align: left;
  white-space: nowrap;
}

.im-data-table td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--im-line);
  vertical-align: top;
}

.im-data-table tbody tr:last-child td { border-bottom: 0; }
.im-data-table tbody tr:hover { background: #f3f7f6; }

.im-data-table strong,
.im-data-table small {
  display: block;
}

.im-data-table strong {
  color: var(--im-teal);
}

.im-data-table small {
  margin-top: 4px;
  color: var(--im-muted);
  font-size: 0.92rem;
  line-height: 1.46;
}

.im-data-table code {
  color: var(--im-blue);
  font-size: 0.95rem;
  white-space: normal;
}

.im-score {
  display: inline-block;
  min-width: 58px;
  padding: 4px 8px;
  color: #fff;
  background: var(--im-teal);
  font-weight: 780;
  text-align: center;
}

.im-score[data-band="high"] { background: var(--im-violet); }
.im-score[data-band="medium"] { background: var(--im-blue); }
.im-score[data-band="low"] { background: var(--im-gold); }
.im-missing { color: var(--im-muted); font-style: italic; }

.im-formula-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 30px;
  border: 1px solid var(--im-line);
  border-top: 4px solid var(--im-teal);
  background: var(--im-paper);
}

.im-formula-band > div {
  min-width: 0;
  padding: 22px;
  border-right: 1px solid var(--im-line);
}

.im-formula-band > div:last-child { border-right: 0; }
.im-formula-band h3 { margin: 0 0 12px; font-size: 1.32rem; }

.im-semantic-method {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, auto));
  align-items: stretch;
  margin: 0 0 22px;
  border-top: 4px solid var(--im-blue);
  background: var(--im-paper);
}

.im-semantic-method > div {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--im-line);
  border-top: 0;
}

.im-semantic-method > i { align-self: center; width: 22px; color: var(--im-muted); }
.im-semantic-method span { color: var(--im-red); font-size: 1rem; font-weight: 800; }
.im-semantic-method strong { display: block; margin-top: 4px; font-size: 1.18rem; }
.im-semantic-method p { margin: 7px 0 0; color: var(--im-muted); font-size: 1rem; line-height: 1.5; }
.im-semantic-equation { margin: 0 0 28px; }

.im-phrase-overview {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.35fr) minmax(250px, 0.8fr);
  gap: 22px;
  margin: 0 0 26px;
}

.im-phrase-overview > div {
  min-width: 0;
  min-height: 300px;
  border: 1px solid var(--im-line);
  background: var(--im-paper);
}

.im-phrase-score {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  border-top: 5px solid var(--im-teal);
  text-align: center;
}

.im-phrase-score[data-domain="verbal"] { border-top-color: var(--im-blue); }
.im-phrase-score h3 { margin: 0 0 10px; font-size: 1.46rem; }
.im-phrase-score > strong { color: var(--im-red); font-family: Georgia, "Times New Roman", serif; font-size: 3.2rem; line-height: 1; }
.im-phrase-score > span { margin: 10px 0 18px; color: var(--im-muted); font-size: 1.04rem; }
.im-phrase-score dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 1px solid var(--im-line); }
.im-phrase-score dl > div { padding: 10px; border-right: 1px solid var(--im-line); border-bottom: 1px solid var(--im-line); }
.im-phrase-score dl > div:nth-child(2n) { border-right: 0; }
.im-phrase-score dl > div:nth-last-child(-n + 2) { border-bottom: 0; }
.im-phrase-score dt { color: var(--im-muted); font-size: 0.88rem; }
.im-phrase-score dd { margin: 4px 0 0; font-size: 1.16rem; font-weight: 780; }

.im-phrase-formula {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  border-top: 5px solid var(--im-gold) !important;
}

.im-phrase-formula h3 { margin: 0 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: 1.65rem; }
.im-phrase-formula p { margin: 18px 0 0; color: var(--im-muted); }

.im-source-mix { margin: 0 0 34px; border-top: 4px solid var(--im-violet); }
.im-source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.im-source-list li { border-right: 1px solid var(--im-line); }
.im-source-list li:nth-child(2n) { border-right: 0; }

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

.im-model-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--im-line);
  border-top: 5px solid var(--im-teal);
  background: var(--im-paper);
}

.im-model-card:nth-child(4n + 2) { border-top-color: var(--im-blue); }
.im-model-card:nth-child(4n + 3) { border-top-color: var(--im-gold); }
.im-model-card:nth-child(4n) { border-top-color: var(--im-violet); }

.im-model-card header { display: flex; gap: 14px; align-items: flex-start; }
.im-model-card header span { color: var(--im-red); font-size: 1rem; font-weight: 850; }
.im-model-card h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.46rem; }
.im-model-card > p { color: var(--im-muted); }
.im-reading-note { margin: 18px 0 0; padding: 15px; border-left: 4px solid var(--im-gold); background: var(--im-ground); }

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

.im-chart-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--im-line);
  background: var(--im-paper);
}

.im-chart-card figcaption {
  display: flex;
  gap: 14px;
  min-height: 150px;
  padding: 22px;
  border-top: 5px solid var(--im-teal);
  border-bottom: 1px solid var(--im-line);
}

.im-chart-card:nth-child(4n + 2) figcaption { border-top-color: var(--im-blue); }
.im-chart-card:nth-child(4n + 3) figcaption { border-top-color: var(--im-gold); }
.im-chart-card:nth-child(4n) figcaption { border-top-color: var(--im-violet); }
.im-chart-card figcaption > span { color: var(--im-red); font-weight: 850; }
.im-chart-card h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.42rem; }
.im-chart-card figcaption p { margin: 8px 0 0; color: var(--im-muted); font-size: 1rem; line-height: 1.5; }

.im-chart-stage {
  display: grid;
  width: 100%;
  min-height: 390px;
  place-items: center;
  padding: 18px;
  overflow: hidden;
}

.im-chart-stage svg { display: block; width: 100%; height: auto; max-height: 390px; }
.im-chart-stage[data-im-chart$="-network"] { min-height: 440px; }
.im-chart-stage[data-im-chart$="-network"] svg { max-height: 430px; }
.im-chart-stage text { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: var(--im-ink); }
.im-chart-stage .im-grid-line { stroke: #dce4e5; stroke-width: 1; }
.im-chart-stage .im-axis-label { fill: var(--im-muted); font-size: 13px; }
.im-chart-stage .im-value-label { font-size: 13px; font-weight: 750; }
.im-chart-stage .im-node-label { font-size: 12px; font-weight: 700; }
.im-chart-card > .im-reading-note { margin: 0; border-left: 0; border-top: 1px solid var(--im-line); }

.im-insights article { align-items: flex-start; }
.im-glossary { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.im-local-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0;
  padding: 18px;
  border-left: 4px solid var(--im-blue);
  background: var(--im-ground);
}

.im-local-note i { flex: 0 0 auto; width: 22px; color: var(--im-blue); }
.im-local-note span { font-size: 1.05rem; line-height: 1.65; }
.im-loading { margin: 0; padding: 22px; color: var(--im-muted); }

@media (max-width: 1180px) {
  .im-domain-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .im-domain-summary > div:nth-child(3) { border-right: 0; }
  .im-domain-summary > div:nth-child(-n + 3) { border-bottom: 1px solid var(--im-line); }
  .im-pipeline { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .im-pipeline > i { display: none; }
  .im-semantic-method { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .im-semantic-method > i { display: none; }
  .im-phrase-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .im-phrase-formula { grid-column: 1 / -1; grid-row: 1; min-height: 230px !important; }
}

@media (max-width: 900px) {
  .im-boundary-banner,
  .im-domain-grid,
  .im-model-grid,
  .im-chart-grid,
  .im-phrase-overview {
    grid-template-columns: 1fr;
  }
  .im-boundary-banner { padding: 28px 20px; }
  .im-principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .im-principles > div:nth-child(2) { border-right: 0; }
  .im-principles > div:nth-child(-n + 2) { border-bottom: 1px solid var(--im-line); }
  .im-formula-band { grid-template-columns: 1fr; }
  .im-formula-band > div { border-right: 0; border-bottom: 1px solid var(--im-line); }
  .im-formula-band > div:last-child { border-bottom: 0; }
  .im-source-list { grid-template-columns: 1fr; }
  .im-source-list li { border-right: 0; }
  .im-phrase-formula { grid-column: auto; grid-row: auto; }
  .im-glossary { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .im-page p,
  .im-page li,
  .im-page dd,
  .im-page td,
  .im-page th {
    font-size: 1.04rem;
    line-height: 1.66;
  }
  .im-live-metrics,
  .im-domain-summary,
  .im-boundary-strip,
  .im-boundary-cases,
  .im-principles,
  .im-semantic-method {
    grid-template-columns: 1fr;
  }
  .im-live-metrics > div,
  .im-domain-summary > div,
  .im-boundary-strip span,
  .im-boundary-cases article,
  .im-principles > div {
    border-right: 0;
    border-bottom: 1px solid var(--im-line);
  }
  .im-live-metrics > div:last-child,
  .im-domain-summary > div:last-child,
  .im-boundary-strip span:last-child,
  .im-boundary-cases article:last-child,
  .im-principles > div:last-child { border-bottom: 0; }
  .im-pipeline { grid-template-columns: 1fr; }
  .im-layer-list li,
  .im-source-list li { grid-template-columns: 1fr; gap: 7px; }
  .im-chart-stage { min-height: 315px; padding: 8px; }
  .im-chart-stage[data-im-chart$="-network"] {
    display: block;
    min-height: 420px;
    overflow-x: auto;
  }
  .im-chart-stage[data-im-chart$="-network"] svg {
    width: 680px;
    min-width: 680px;
    max-height: none;
  }
  .im-chart-card figcaption { min-height: 0; }
  .im-phrase-score dl { grid-template-columns: 1fr; }
  .im-phrase-score dl > div { border-right: 0; }
  .im-phrase-score dl > div:nth-last-child(-n + 2) { border-bottom: 1px solid var(--im-line); }
  .im-phrase-score dl > div:last-child { border-bottom: 0; }
}
