.tej-roadmap-cta {
  margin: 1rem 0 1.5rem;
  padding: 1.25rem 1.35rem;
  border: 2px solid #1769aa;
  border-radius: .85rem;
  background: #edf6fc;
  box-shadow: 0 .55rem 1.5rem rgba(30, 43, 85, .08);
}

.tej-roadmap-cta h2 { margin-top: 0; }
.tej-roadmap-cta p:last-child { margin-bottom: 0; }

.tej-roadmap-filter-row {
  display: grid;
  grid-template-columns: minmax(15rem, 1.4fr) repeat(3, minmax(10rem, .6fr));
  gap: .75rem;
  margin: 1rem 0;
}

.tej-roadmap-filter-row label { font-weight: 700; }
.tej-roadmap-filter-row input,
.tej-roadmap-filter-row select {
  width: 100%;
  margin-top: .25rem;
  padding: .65rem .7rem;
  border: 1px solid #687783;
  border-radius: .35rem;
  background: #fff;
}

.tej-roadmap-unit-summary {
  max-width: 100%;
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  border-left: .35rem solid #1e2b55;
  background: #f7f8fa;
  overflow-x: auto;
}

.tej-roadmap-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem;
}

.tej-roadmap-module {
  min-width: 0;
  max-width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid #d9dee2;
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 .4rem 1.2rem rgba(30, 43, 85, .06);
  overflow-wrap: anywhere;
}

.tej-roadmap-module[hidden] { display: none; }
.tej-roadmap-module h3 { margin-top: 0; }
.tej-roadmap-module details { margin-top: .75rem; }
.tej-roadmap-module summary { cursor: pointer; font-weight: 700; }
.tej-roadmap-module table { font-size: .9rem; }
.tej-roadmap-module details { overflow-x: auto; }
.tej-roadmap-result-count { font-weight: 700; }

.tej-roadmap-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.tej-badge.status-published { border-color: #22733a; background: #edf8ef; color: #174f29; }
.tej-badge.status-pilot { border-color: #8b5a00; background: #fff4d6; color: #633f00; }
.tej-badge.status-in-development { border-color: #1769aa; background: #edf6fc; color: #124c7b; }
.tej-badge.status-planned { border-color: #687783; background: #f1f3f4; color: #39434a; }
.tej-badge.status-bonus { border-color: #6f42c1; background: #f4effc; color: #4c2d85; }
.tej-badge.status-restricted-source { border-color: #9b2c2c; background: #fff0f0; color: #702020; }

@media (max-width: 900px) {
  .tej-roadmap-filter-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .tej-roadmap-filter-row,
  .tej-roadmap-module-grid { grid-template-columns: 1fr; }
}

@media print {
  .tej-roadmap-filter-row { display: none; }
  .tej-roadmap-module { break-inside: avoid; box-shadow: none; }
}
/* A readable, wrapping alternative to one long display equation for process chains. */
.tej-process-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  margin: 1rem 0;
}

.tej-process-chain__step {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--bs-border-color, #c9d2de);
  border-radius: 0.35rem;
  background: var(--bs-tertiary-bg, #f4f6f8);
  font-weight: 650;
}

.tej-process-chain__arrow {
  color: var(--bs-secondary-color, #5f6b7a);
  font-size: 1.2rem;
  line-height: 1;
}

/* Pair a complete circuit map with the KCL reasoning that defines its currents. */
.tej-current-visual {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(17rem, 0.85fr);
  gap: 1rem;
  align-items: stretch;
  margin: 1rem 0 1.5rem;
}

.tej-current-visual .ter-circuit-figure {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin: 0;
}

.tej-current-visual .ter-circuit-figure img {
  width: 100%;
  max-height: 26rem;
}

.tej-current-node-card {
  padding: 1rem;
  border: 1px solid #b8c9d8;
  border-radius: 0.65rem;
  background: linear-gradient(180deg, #f7fbff 0%, #eef6fc 100%);
}

.tej-current-node-card h4 {
  margin-top: 0;
  color: #17324d;
}

.tej-current-flow {
  display: grid;
  gap: 0.55rem;
  margin: 0.8rem 0 1rem;
}

.tej-current-flow__row {
  display: grid;
  grid-template-columns: 2.75rem 4.5rem 1fr;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-left: 0.35rem solid #1769aa;
  border-radius: 0.4rem;
  background: #fff;
}

.tej-current-flow__row.is-entering {
  border-left-color: #2c7a4b;
}

.tej-current-flow__tag {
  display: inline-flex;
  justify-content: center;
  padding: 0.2rem 0.35rem;
  border-radius: 999px;
  background: #17324d;
  color: #fff;
  font-weight: 800;
}

.tej-current-equation {
  padding: 0.8rem;
  border: 2px solid #e97828;
  border-radius: 0.5rem;
  background: #fff;
  text-align: center;
}

.tej-current-equation mjx-container[display="true"] {
  margin: 0.45rem 0 !important;
}

@media (max-width: 860px) {
  .tej-current-visual {
    grid-template-columns: 1fr;
  }
}

/* Put each isolated loop directly beside the signed KVL terms it produces. */
.tej-loop-equation-visual {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.85fr);
  gap: 1rem;
  align-items: stretch;
  margin: 1rem 0 1.5rem;
}

.tej-loop-equation-visual .ter-circuit-figure {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin: 0;
}

.tej-loop-equation-visual .ter-circuit-figure img {
  width: 100%;
  max-height: 25rem;
  object-fit: contain;
}

.tej-loop-sign-card {
  padding: 1rem;
  border: 1px solid #c7d1dc;
  border-radius: 0.65rem;
  background: #f7f9fb;
}

.tej-loop-sign-card h4 {
  margin-top: 0;
  color: #17324d;
}

.tej-loop-sign-list {
  display: grid;
  gap: 0.55rem;
  margin: 0.8rem 0 1rem;
}

.tej-loop-sign-row {
  display: grid;
  grid-template-columns: 3.7rem 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.65rem 0.7rem;
  border-left: 0.35rem solid #b64040;
  border-radius: 0.4rem;
  background: #fff;
}

.tej-loop-sign-row.is-rise {
  border-left-color: #2c7a4b;
}

.tej-loop-sign-symbol {
  font-weight: 800;
  color: #17324d;
}

.tej-loop-sign-row strong {
  color: #17324d;
  white-space: nowrap;
}

.tej-loop-sign-equation {
  padding: 0.65rem;
  border: 2px solid #e97828;
  border-radius: 0.5rem;
  background: #fff;
  text-align: center;
}

.tej-loop-sign-equation mjx-container[display="true"] {
  margin: 0.35rem 0 !important;
}

.tej-matrix-bridge-figure {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border: 1px solid #c7d1dc;
  border-radius: 0.65rem;
  background: #fff;
  box-shadow: 0 0.35rem 1rem rgba(30, 43, 85, 0.07);
  text-align: center;
}

.tej-matrix-bridge-figure img {
  width: 100%;
  height: auto;
}

.tej-matrix-bridge-figure figcaption {
  margin-top: 0.75rem;
}

@media (max-width: 860px) {
  .tej-loop-equation-visual {
    grid-template-columns: 1fr;
  }
}

/* Keep long code and comparison tables inside the lesson column on phones. */
main.content,
main.content > section,
main.content div.sourceCode,
main.content pre.sourceCode {
  min-width: 0;
  max-width: 100%;
}

main.content div.sourceCode,
main.content pre.sourceCode,
.tej-table-scroll {
  overflow-x: auto;
}

.tej-table-scroll {
  max-width: 100%;
  margin: 0.75rem 0 1rem;
}

.tej-table-scroll table {
  min-width: 42rem;
  margin-bottom: 0;
}

main.content p code,
main.content li code,
main.content h1 code,
main.content h2 code,
main.content h3 code {
  white-space: normal;
  overflow-wrap: anywhere;
}
