#lab {
  max-width: 1580px;
  margin: auto;
  padding: 36px 40px;
}
h1 {
  font-size: clamp(30px, 3vw, 49px);
  letter-spacing: -1.8px;
  margin: 10px 0;
}
.lab-top {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
}
.lab-top p {
  max-width: 760px;
}
.lab-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid #252b29;
  margin: 28px 0;
}
.lab-stats > div {
  padding: 18px;
  border-right: 1px solid #d7d9d4;
}
.lab-stats b {
  font-size: 30px;
  display: block;
  font-variant-numeric: tabular-nums;
}
.lab-stats span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
#lab-controls {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 14px;
}
#lab label {
  font-size: 10px;
  letter-spacing: 0.8px;
  display: block;
  font-weight: 700;
}
#lab select,
#lab input {
  width: 100%;
  padding: 12px;
  border: 1px solid #bbbfb8;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: #202523;
  margin-top: 7px;
}
#lab button {
  cursor: pointer;
  border: 1px solid #bbbfb8;
  padding: 9px 13px;
  background: white;
  color: #202523;
}
#lab button:hover,
#lab button:focus-visible {
  border-color: #c62920;
  background: #f6efeb;
}
#lab button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.range-controls {
  display: flex;
  gap: 18px;
  align-items: end;
  margin: 18px 0;
}
.range-controls label {
  width: 170px;
}
.compare-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  border-block: 1px solid #202523;
}
.market-picker {
  padding: 20px 20px 20px 0;
  border-right: 1px solid #d1d5ce;
}
.market-picker p {
  font-size: 11px;
  color: #5b655f;
}
#markets {
  max-height: 380px;
  overflow: auto;
  margin-top: 14px;
}
#markets label {
  display: flex;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 400;
  line-height: 1.6;
  padding: 7px;
}
#markets input {
  width: auto;
  margin: 0;
}
.lab-chart {
  padding: 24px;
  min-width: 0;
}
#finding h2 {
  font-size: 24px;
  margin: 0 0 8px;
}
#finding p {
  font-size: 13px;
  color: #59645c;
}
#legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  margin-block: 20px;
}
#legend i {
  display: inline-block;
  width: 16px;
  border-top: 3px solid;
  margin-right: 6px;
}
#chart svg {
  width: 100%;
  height: auto;
  max-height: 400px;
  display: block;
}
#chart-note,
#export-note {
  font-size: 11px;
  color: #5b655f;
  line-height: 1.6;
}
.lab-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 40px 0 20px;
}
.section-title p {
  font-size: 12px;
}
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #202523;
}
.monitor-card {
  padding: 22px;
  border-bottom: 1px solid #bbbfb8;
  border-right: 1px solid #d8dcd5;
  min-width: 0;
}
.monitor-card button {
  width: 100%;
  text-align: left;
  border: 0 !important;
  padding: 0 !important;
}
.monitor-card h3 {
  font-size: 16px;
  margin: 4px 0;
}
.monitor-card p {
  font-size: 11px;
  color: #59645c;
}
.monitor-card strong {
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}
.monitor-card svg {
  width: 100%;
  height: 130px;
}
.source-panel {
  margin-top: 40px;
  border-top: 2px solid #202523;
  padding-top: 20px;
}
.source-panel details {
  border-bottom: 1px solid #d1d5ce;
  padding: 16px 0;
}
.source-panel summary {
  cursor: pointer;
}
.source-panel p {
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.source-panel code {
  font-size: 10px;
  overflow-wrap: anywhere;
}
#report-panel {
  margin-top: 35px;
  border-top: 3px solid #c62920;
  padding: 25px;
  background: #fff;
}
#report-panel article {
  border-top: 1px solid #aaa;
  padding: 20px 0;
}
#report-panel p {
  line-height: 1.7;
}
#table {
  max-height: 400px;
  margin-top: 20px;
  overflow: auto;
}
#table th,
#table td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  font-size: 12px;
  white-space: nowrap;
}
#notice {
  font-size: 12px;
}
dialog {
  max-width: 620px;
  padding: 30px;
  line-height: 1.6;
}
dialog a {
  color: #b8221a;
}
footer {
  margin-top: 36px;
  border-top: 1px solid #bbb;
  padding-top: 16px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.lab-top a {
  white-space: nowrap;
}
#coverage a {
  color: inherit;
}
@media (max-width: 850px) {
  #lab {
    padding: 20px;
  }
  .compare-layout {
    grid-template-columns: 1fr;
  }
  .market-picker {
    border-right: 0;
    border-bottom: 1px solid #ddd;
    padding: 14px 0;
  }
  #markets {
    max-height: 160px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  #lab-controls {
    grid-template-columns: 1fr;
  }
  .monitor-grid {
    grid-template-columns: 1fr 1fr;
  }
  .lab-top {
    display: block;
  }
  .lab-stats {
    grid-template-columns: 1fr 1fr;
  }
  .lab-chart {
    padding: 20px 0;
  }
  .range-controls {
    flex-wrap: wrap;
  }
  .section-title {
    display: block;
  }
}
@media (max-width: 500px) {
  .monitor-grid {
    grid-template-columns: 1fr;
  }
  .mast {
    gap: 12px;
    padding: 16px;
  }
  .mast .mono {
    display: none;
  }
  #lab {
    padding: 16px;
  }
  .range-controls label {
    width: 42%;
  }
  .monitor-card {
    padding: 20px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  body > *:not(main),
  #lab > *:not(#content),
  #content > *:not(#report-panel) {
    display: none !important;
  }
  #report-panel {
    display: block !important;
    border: 0;
    padding: 0;
  }
  #report-panel button {
    display: none;
  }
  #lab {
    padding: 0;
  }
  #report-panel article {
    break-inside: avoid;
  }
  @page {
    size: A4;
    margin: 18mm;
  }
}

@media print {
  #report-panel.restricted {
    display: none !important;
  }
}

/* Research terminal 03 — evidence-led hierarchy and linked chart inspection. */
body {
  background: #f5f5f0;
}
.mast {
  border-top: 5px solid var(--red);
  background: #fff;
}
#lab {
  max-width: 1760px;
  padding: 32px 44px;
}
.lab-top h1 {
  font-size: clamp(34px, 4vw, 64px);
  line-height: 1.04;
  letter-spacing: -2.6px;
  font-weight: 600;
}
.lab-top .eyebrow {
  color: var(--red);
  letter-spacing: 1.7px;
  font-size: 10px;
}
#intro {
  font-size: 15px;
  color: #56645a;
  margin: 18px 0 0;
}
#back {
  border-bottom: 1px solid #adb7ad;
  padding-bottom: 5px;
  font-size: 12px;
}
.lab-stats {
  margin: 30px 0 0;
  background: #202925;
  color: #fff;
  border: 0;
}
.lab-stats > div {
  padding: 18px 24px;
  border-color: #465047;
}
.lab-stats b {
  font-size: clamp(23px, 2.7vw, 38px);
  font-weight: 400;
  letter-spacing: -1.2px;
}
.lab-stats span {
  font-size: 9px;
  color: #bdc7be;
  letter-spacing: 1.25px;
}
.research-desks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 24px;
  border-bottom: 1px solid #c5cec3;
}
.research-desks > span {
  font: 9px var(--mono);
  letter-spacing: 1px;
  color: #667369;
  margin-right: 20px;
}
#lab .research-desks button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 17px 15px 14px;
  font-size: 12px;
}
#lab .research-desks button[aria-pressed="true"] {
  border-bottom-color: var(--red);
  color: #ad211a;
  font-weight: bold;
}
#lab-controls {
  grid-template-columns: minmax(170px, 1fr) minmax(270px, 2.2fr) minmax(
      190px,
      1fr
    );
}
#lab select {
  border-color: #c7cfc4;
  border-radius: 0;
}
.range-controls {
  margin: 14px 0 22px;
  gap: 12px;
}
.range-controls label {
  width: 150px;
}
#notice {
  margin-left: auto;
  max-width: 380px;
}
.compare-layout {
  background: white;
  grid-template-columns: 230px minmax(0, 1fr);
  border: 1px solid #c7cfc4;
  border-top: 3px solid #202925;
}
.market-picker {
  padding: 24px 16px;
  background: #eff2eb;
}
#markets {
  max-height: 640px;
}
#markets label {
  border-bottom: 1px solid #dce2d7;
  padding: 10px 3px;
}
#markets label:has(input:checked) {
  font-weight: 700;
  color: #a92019;
}
#markets label:has(input:disabled) {
  opacity: 0.55;
}
input[type="checkbox"],
input[type="range"] {
  accent-color: var(--red);
}
.lab-chart {
  padding: 26px 30px;
}
#finding h2 {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 500;
  letter-spacing: -0.7px;
  max-width: 900px;
}
#finding p {
  font: 10px/1.7 var(--mono);
  color: #637366;
}
#legend {
  margin: 20px 0 8px;
  gap: 10px 20px;
  font-size: 11px;
}
#chart {
  min-height: 350px;
}
#chart.interactive {
  height: 410px;
}
#chart.interactive svg {
  max-height: none;
  height: 100%;
}
.chart-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #e3e8df;
  padding: 8px 0;
}
#chart-help {
  font-size: 10px;
  color: #637366;
  max-width: 700px;
}
#lab #reset-range {
  flex: none;
  font-size: 10px;
  padding: 6px 10px;
}
.period-inspector {
  background: #f3f5ef;
  padding: 16px 18px;
  margin: 8px 0 16px;
  border: 1px solid #e1e6dc;
}
.inspector-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#inspect-date {
  font: 12px var(--mono);
  color: #9e211b;
}
#lab #period-inspect {
  padding: 0;
  width: 100%;
  height: 20px;
  border: 0;
  margin: 9px 0;
  background: none;
}
#inspect-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
#inspect-values > div {
  border-left: 2px solid var(--series);
  padding-left: 10px;
  min-width: 0;
}
#inspect-values span {
  display: block;
  font-size: 10px;
  color: #526356;
  overflow-wrap: anywhere;
}
#inspect-values b {
  display: block;
  font: 19px/1.8 var(--mono);
  letter-spacing: -0.7px;
}
#inspect-values small {
  display: block;
  font-size: 9px;
  line-height: 1.5;
  color: #637366;
}
#chart-note,
#export-note {
  font-size: 10px;
}
#lab .lab-actions button {
  font-size: 11px;
  padding: 9px 12px;
}
#lab #report {
  background: #202925;
  color: #fff;
  border-color: #202925;
}
.section-title {
  margin: 38px 0 18px;
  gap: 20px;
}
.section-title h2 {
  font-weight: 500;
  font-size: 27px;
  letter-spacing: -0.8px;
  margin: 6px 0;
}
.section-title .eyebrow {
  color: #6c796d;
  font: 9px var(--mono);
  letter-spacing: 1.1px;
}
#snapshot-note {
  max-width: 470px;
  text-align: right;
  font: 10px/1.7 var(--mono);
  color: #647163;
}
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  border-top: 1px solid #202925;
  background: #fff;
}
.reading {
  padding: 20px 18px 14px;
  border-right: 1px solid #dce2d7;
  border-bottom: 1px solid #dce2d7;
  min-width: 0;
  position: relative;
}
.reading::before {
  content: "";
  display: block;
  width: 23px;
  height: 3px;
  background: var(--series);
  margin-bottom: 12px;
}
.reading h3 {
  font-size: 12px;
  min-height: 36px;
  margin: 0 0 10px;
  font-weight: 500;
}
.reading strong {
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 400;
  letter-spacing: -1px;
}
.reading .change {
  font: 12px var(--mono);
  margin: 8px 0;
}
.reading .change span {
  font: 9px var(--sans);
  color: #657365;
}
.reading-spark svg {
  width: 100%;
  height: 80px;
}
.reading-spark text,
.reading-spark line {
  display: none;
}
.reading-spark path {
  stroke: var(--series);
  stroke-width: 2;
}
.reading small {
  font-size: 9px;
  color: #687466;
  overflow-wrap: anywhere;
}
.method-note {
  color: #657365;
  font-size: 11px;
  max-width: 900px;
  line-height: 1.7;
}
.heat-scroll {
  overflow: auto;
  max-height: 430px;
  border: 1px solid #ccd5c8;
  background: white;
  scrollbar-color: #b6c2b1 #eff2eb;
}
.heat-scroll table {
  border-collapse: separate;
  border-spacing: 3px;
  width: 100%;
  font: 10px var(--mono);
}
.heat-scroll caption {
  text-align: left;
  padding: 12px;
  color: #647363;
  font: 10px var(--sans);
}
.heat-scroll th {
  padding: 9px 10px;
  font-weight: 400;
  white-space: nowrap;
  color: #54644f;
}
.heat-scroll tbody th {
  min-width: 155px;
  max-width: 220px;
  white-space: normal;
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  font: 11px var(--sans);
}
.heat-scroll td {
  min-width: 55px;
  padding: 15px 8px;
  text-align: center;
}
.heat-scroll td:hover {
  outline: 2px solid #202925;
  outline-offset: -2px;
}
.monitor-grid {
  background: #fff;
}
.monitor-card {
  padding: 24px;
  position: relative;
}
.monitor-card:hover {
  background: #fafbf7;
}
.monitor-card button {
  background: transparent !important;
}
.monitor-card h3 {
  min-height: 40px;
  font-weight: 500;
  line-height: 1.35;
}
.monitor-card strong {
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -1px;
}
.monitor-card .eyebrow {
  font: 9px var(--mono);
  color: #9d2c24;
}
.monitor-card svg {
  height: 150px;
  margin-top: 10px;
}
.source-panel {
  background: #eef1e9;
  padding: 25px;
}
.source-panel h2 {
  font-weight: 500;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
.heat-scroll:focus-visible {
  outline: 2px solid #a6221b;
  outline-offset: 3px;
}
@media (min-width: 1450px) {
  .monitor-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1000px) {
  #lab {
    padding: 26px;
  }
  .compare-layout {
    grid-template-columns: 195px minmax(0, 1fr);
  }
  .lab-chart {
    padding: 22px 18px;
  }
  .research-desks > span {
    width: 100%;
    margin-top: 15px;
  }
}
@media (max-width: 850px) {
  #lab {
    padding: 20px;
  }
  .compare-layout {
    grid-template-columns: 1fr;
  }
  #lab-controls {
    grid-template-columns: 1fr;
  }
  .market-picker {
    padding: 18px;
  }
  #markets {
    max-height: 160px;
  }
  #snapshot-note {
    text-align: left;
  }
  #notice {
    margin-left: 0;
  }
  .lab-chart {
    padding: 20px 16px;
  }
  .lab-top h1 {
    letter-spacing: -1.6px;
  }
  .snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lab-stats > div {
    padding: 16px;
  }
  .research-desks button {
    flex-grow: 1;
  }
}
@media (max-width: 500px) {
  #lab {
    padding: 14px;
  }
  .lab-chart {
    padding: 18px 10px;
  }
  #chart.interactive {
    height: 330px;
  }
  .chart-tools {
    align-items: start;
    gap: 8px;
  }
  .period-inspector {
    padding: 12px;
  }
  #inspect-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #lab .research-desks button {
    font-size: 10px;
    padding: 13px 10px;
  }
  .reading {
    padding: 16px 12px;
  }
  .section-title h2 {
    font-size: 23px;
  }
  .source-panel {
    padding: 20px 14px;
  }
  .monitor-card {
    padding: 20px;
  }
}

/* Keep the first screen focused on the instrument. */
#lab {
  padding-top: 24px;
}
.lab-top h1 {
  font-size: clamp(32px, 3.4vw, 51px);
}
#intro {
  margin-top: 12px;
}
.lab-stats {
  margin-top: 22px;
}
.lab-stats > div {
  padding: 12px 24px;
}
.lab-stats b {
  font-size: clamp(23px, 2.4vw, 33px);
}
@media (max-width: 500px) {
  .lab-stats > div {
    padding: 14px;
  }
}
.reading-spark circle { fill: var(--series); }
