:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #5d6b78;
  --line: #d9e1e8;
  --panel: #ffffff;
  --band: #f4f7fa;
  --navy: #1c3f5f;
  --teal: #16837a;
  --amber: #c4821e;
  --green: #3f7d45;
  --red: #b14b4b;
  --blue: #3c78b5;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f8fafc;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 18px 0 22px;
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 30px;
  line-height: 1.15;
}

.eyebrow-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.note-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  text-decoration: none;
}

.note-link:hover,
.note-link:focus {
  color: var(--navy);
  border-color: #b8c7d4;
  background: #f4f7fa;
}

.note-link:focus {
  outline: 2px solid rgba(60, 120, 181, 0.35);
  outline-offset: 2px;
}

.note-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.topbar-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.topnav a.is-active {
  color: #fff;
  background: var(--navy);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta span {
  border: 1px solid var(--line);
  background: #fff;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.control-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: var(--band);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
}

.control-fields {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.field select {
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 4px;
  padding: 4px;
  background: #e9eef3;
  border-radius: 7px;
}

.year-basis-toggle {
  min-width: 220px;
}

.segment {
  border: 0;
  border-radius: 5px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.segment.is-active {
  color: #fff;
  background: var(--navy);
}

.dashboard-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.switch-control-band {
  align-items: flex-start;
}

.switch-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.input-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.input-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.input-head label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.input-head strong {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.input-card input[type="range"] {
  width: 100%;
  accent-color: var(--navy);
}

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

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.kpi .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi .value {
  margin-top: 7px;
  font-size: 25px;
  font-weight: 750;
}

.kpi .sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 16px;
  margin: 16px 0;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

.title-with-info {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  cursor: help;
}

.info-tip:focus {
  outline: 2px solid rgba(60, 120, 181, 0.35);
  outline-offset: 2px;
}

.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 3;
  width: min(320px, calc(100vw - 48px));
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #17212b;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.info-tip:hover .tooltip,
.info-tip:focus .tooltip,
.info-tip:focus-within .tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chart {
  min-height: 310px;
  width: 100%;
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

.axis text,
.chart-label {
  fill: var(--muted);
  font-size: 12px;
}

.chart-value {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.grid-line {
  stroke: #e5ebf1;
  stroke-width: 1;
}

.model-flow {
  margin: 0;
  padding-left: 20px;
  color: #334150;
  line-height: 1.6;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1120px;
  font-size: 13px;
}

th {
  text-align: left;
  color: #334150;
  background: #eaf1f7;
  border-bottom: 1px solid #a9bdcf;
  padding: 9px 8px;
  white-space: nowrap;
}

td {
  border-bottom: 1px solid #edf1f5;
  padding: 8px;
  vertical-align: top;
}

th:first-child,
td:first-child {
  min-width: 82px;
  white-space: nowrap;
}

td.num,
th.num {
  text-align: right;
}

.explain {
  min-width: 420px;
  color: #3c4a57;
}

.assumption-list,
.source-list {
  display: grid;
  gap: 10px;
}

.assumption,
.source {
  border-top: 1px solid #edf1f5;
  padding-top: 10px;
}

.assumption:first-child,
.source:first-child {
  border-top: 0;
  padding-top: 0;
}

.assumption h3,
.source h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.assumption p,
.source p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.source a,
.panel-note a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.local-source {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.anchor-list {
  display: grid;
  gap: 8px;
}

.anchor-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #edf1f5;
  padding: 8px 0;
  color: #334150;
  font-size: 14px;
}

.anchor-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.anchor-row strong {
  font-size: 18px;
}

.panel-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.subhead {
  margin: 14px 0 7px;
  font-size: 13px;
  text-transform: uppercase;
  color: #334150;
}

.source-grid {
  display: grid;
  gap: 0;
  border: 1px solid #edf1f5;
  border-radius: 6px;
  overflow: hidden;
}

.source-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) minmax(88px, 0.8fr) minmax(58px, 0.5fr) minmax(130px, 1.1fr);
  gap: 8px;
  padding: 7px 9px;
  border-top: 1px solid #edf1f5;
  color: #3c4a57;
  font-size: 12px;
  line-height: 1.3;
}

.source-row:first-child {
  border-top: 0;
}

.source-row strong {
  color: var(--ink);
  font-weight: 750;
}

.source-row-head {
  background: #eaf1f7;
  color: #334150;
  font-weight: 750;
}

.sector-map-grid {
  margin-bottom: 12px;
}

.sector-map-row {
  grid-template-columns: minmax(120px, 0.85fr) minmax(170px, 1.3fr) minmax(120px, 0.9fr) minmax(190px, 1.45fr);
}

.sector-table {
  min-width: 980px;
}

.switch-table {
  min-width: 1080px;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.factor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.factor-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.factor-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.factor-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.factor-card dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.factor-card dt {
  margin: 0 0 2px;
  color: #334150;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.factor-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.factor-card dd > span {
  display: block;
}

.current-read-links {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.current-read-links li {
  display: grid;
  gap: 3px;
  padding: 7px 9px 7px 10px;
  border-left: 3px solid #123d67;
  border-radius: 6px;
  background: #edf4fb;
}

.current-read-links span {
  color: #1d4f80;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.current-read-links a {
  color: #092b4c;
  font-weight: 750;
  text-decoration: none;
}

.current-read-links a:hover {
  color: #071f38;
  text-decoration: underline;
}

.signal-groups {
  display: grid;
  gap: 18px;
}

.signal-group {
  display: grid;
  gap: 9px;
  border-top: 1px solid #edf1f5;
  padding-top: 14px;
}

.signal-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.signal-group-head h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.signal-group-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.news-card-list {
  display: grid;
  gap: 10px;
}

.news-card {
  border-top: 1px solid #edf1f5;
  padding-top: 11px;
}

.news-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.news-card-meta,
.source-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.news-card-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.news-card h3 {
  margin: 7px 0 5px;
  font-size: 15px;
  line-height: 1.3;
}

.news-card h3 a,
.news-headline a {
  color: var(--navy);
  text-decoration: none;
}

.news-card h3 a:hover,
.news-headline a:hover {
  text-decoration: underline;
}

.news-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.news-card .news-action {
  margin-top: 6px;
  color: #334150;
}

.bias-badge,
.coverage-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
}

.bias-support {
  color: #fff;
  background: var(--green);
}

.bias-cap {
  color: #fff;
  background: var(--red);
}

.bias-risk {
  color: #fff;
  background: var(--amber);
}

.bias-context {
  color: #fff;
  background: var(--blue);
}

.bias-manual {
  color: #fff;
  background: var(--muted);
}

.coverage-direct {
  color: #fff;
  background: var(--teal);
}

.coverage-indexed {
  color: #fff;
  background: var(--blue);
}

.coverage-manual {
  color: #fff;
  background: var(--muted);
}

.news-source {
  display: grid;
  gap: 5px;
}

.news-source h3 {
  margin: 0;
}

.news-source p strong {
  color: #334150;
}

.news-table {
  min-width: 1320px;
}

.news-table th:nth-child(3),
.news-table td:nth-child(3) {
  min-width: 180px;
}

.news-table th:nth-child(5),
.news-table td:nth-child(5) {
  min-width: 250px;
}

.news-table th:nth-child(6),
.news-table td:nth-child(6),
.news-table th:nth-child(7),
.news-table td:nth-child(7) {
  min-width: 260px;
}

.cheat-shell {
  width: min(1180px, calc(100vw - 32px));
}

.cheat-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  gap: 24px;
  align-items: end;
  padding: 30px 0 22px;
  border-bottom: 1px solid var(--line);
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus {
  text-decoration: underline;
}

.cheat-hero h1 {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 42px;
  line-height: 1.05;
}

.cheat-lede {
  max-width: 780px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.hero-formula {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid #b8c7d4;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.hero-formula span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

.hero-formula strong {
  color: var(--navy);
  font-size: 34px;
  line-height: 1;
}

.cheat-callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--band);
}

.cheat-callout h2,
.cheat-panel h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

.formula-pair,
.formula-stack {
  display: grid;
  gap: 8px;
}

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

.formula-pair code,
.formula-stack code,
.example-grid code {
  display: block;
  border: 1px solid #cfd9e2;
  border-radius: 6px;
  background: #fff;
  color: #223242;
  padding: 9px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.35;
}

.cheat-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric-tile {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.metric-tile strong {
  color: var(--ink);
  font-size: 23px;
  line-height: 1.1;
}

.metric-tile p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.cheat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.cheat-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow);
}

.cheat-panel.full-width {
  margin: 16px 0;
}

.cheat-panel-head {
  margin-bottom: 12px;
}

.cheat-table-wrap {
  overflow-x: auto;
}

.cheat-table {
  min-width: 0;
  font-size: 13px;
}

.cheat-table th,
.cheat-table td {
  padding: 9px;
}

.cheat-table td:nth-child(3),
.cheat-table th:nth-child(3) {
  text-align: right;
  font-weight: 750;
}

.rule-list {
  display: grid;
  gap: 0;
  border: 1px solid #edf1f5;
  border-radius: 8px;
  overflow: hidden;
}

.rule-list div {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 10px;
  border-top: 1px solid #edf1f5;
  color: #334150;
  font-size: 13px;
}

.rule-list div:first-child {
  border-top: 0;
}

.rule-list strong {
  color: var(--ink);
}

.rule-list span {
  color: var(--muted);
}

.rule-list.compact div {
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr);
}

.cheat-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.price-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.price-strip div,
.emissions-grid div {
  display: grid;
  gap: 3px;
  border: 1px solid #edf1f5;
  border-radius: 7px;
  background: #f8fafc;
  padding: 10px;
}

.price-strip span,
.emissions-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.price-strip strong,
.emissions-grid strong {
  color: var(--navy);
  font-size: 22px;
  line-height: 1.1;
}

.price-strip small,
.emissions-grid small {
  color: var(--muted);
  font-size: 12px;
}

.efficiency-bars {
  display: grid;
  gap: 10px;
}

.efficiency-bars div {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-height: 40px;
  padding: 10px;
  border: 1px solid #edf1f5;
  border-radius: 7px;
  overflow: hidden;
}

.efficiency-bars div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar);
  background: #e6f3f1;
}

.efficiency-bars span,
.efficiency-bars strong {
  position: relative;
  z-index: 1;
}

.efficiency-bars span {
  color: #334150;
  font-size: 13px;
  font-weight: 750;
}

.efficiency-bars strong {
  color: var(--teal);
  font-size: 14px;
}

.emissions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

.pitfall-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: #334150;
  font-size: 14px;
  line-height: 1.5;
}

.cheat-sources {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.cheat-sources p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.cheat-sources a {
  color: var(--blue);
}

.secondary-button {
  min-height: 36px;
  border: 1px solid #b8c7d4;
  border-radius: 6px;
  padding: 7px 11px;
  color: var(--navy);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button:hover,
.secondary-button:focus {
  border-color: var(--navy);
  background: #edf4f8;
}

.secondary-button:focus,
.number-field input:focus,
.curve-field input:focus {
  outline: 2px solid rgba(60, 120, 181, 0.28);
  outline-offset: 2px;
}

.storage-control-band .control-fields {
  align-items: end;
}

.storage-input-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.78fr) minmax(0, 1.22fr);
  gap: 16px;
  margin: 16px 0;
}

.storage-assumptions-panel,
.curve-editor-panel {
  min-width: 0;
}

.storage-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.number-field,
.curve-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.number-field label,
.curve-field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.number-field > div {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.number-field input,
.curve-field input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  color: var(--ink);
  background: #fff;
}

.number-field input {
  border: 0;
  border-radius: 0;
}

.number-field span {
  padding: 0 9px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.curve-unit {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--band);
  font-size: 12px;
  font-weight: 700;
}

.curve-input-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 10px;
}

.model-error {
  margin: 16px 0;
  border: 1px solid #d7a5a5;
  border-radius: 7px;
  padding: 10px 12px;
  color: #7f3030;
  background: #fff5f5;
  font-size: 13px;
  font-weight: 650;
}

.storage-kpis .kpi.is-inject {
  border-top: 3px solid var(--teal);
}

.storage-kpis .kpi.is-withdraw {
  border-top: 3px solid var(--amber);
}

.storage-kpis .kpi.is-hold {
  border-top: 3px solid #7d8994;
}

.storage-chart {
  min-height: 350px;
}

.storage-chart svg {
  overflow: visible;
}

.axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.action-axis-title {
  font-weight: 750;
  text-transform: uppercase;
}

.price-line,
.inventory-line {
  fill: none;
  stroke: var(--navy);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.price-point,
.inventory-point {
  fill: #fff;
  stroke: var(--navy);
  stroke-width: 2;
}

.action-zero {
  stroke: #aab7c3;
  stroke-width: 1;
}

.inject-bar {
  fill: var(--teal);
}

.withdraw-bar {
  fill: var(--amber);
}

.hold-bar {
  fill: #b9c3cb;
}

.inventory-area {
  fill: rgba(22, 131, 122, 0.12);
}

.inventory-line {
  stroke: var(--teal);
}

.inventory-point {
  stroke: var(--teal);
}

.minimum-line {
  stroke: var(--red);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.storage-legend {
  justify-content: flex-end;
  margin-top: -3px;
}

.storage-legend i {
  font-style: normal;
}

.price-swatch {
  background: var(--navy);
}

.injection-swatch,
.inventory-swatch {
  background: var(--teal);
}

.withdrawal-swatch {
  background: var(--amber);
}

.minimum-swatch {
  background: var(--red);
}

.storage-table {
  min-width: 940px;
}

.action-badge {
  display: inline-block;
  min-width: 70px;
  border-radius: 5px;
  padding: 4px 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.action-badge.is-inject {
  color: #0c625b;
  background: #e3f3f1;
}

.action-badge.is-withdraw {
  color: #83530e;
  background: #fff1da;
}

.action-badge.is-hold {
  color: #53616d;
  background: #edf1f4;
}

.positive-value {
  color: var(--green);
  font-weight: 700;
}

.negative-value {
  color: var(--red);
  font-weight: 700;
}

.method-copy {
  margin: 0 0 10px;
  color: #334150;
  font-size: 14px;
  line-height: 1.55;
}

.method-copy:last-child {
  margin-bottom: 0;
}

@media (max-width: 980px) {
  .topbar,
  .control-band {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-items: start;
  }

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

  .kpi-grid,
  .factor-grid,
  .cheat-hero,
  .cheat-layout,
    .cheat-metric-grid,
    .switch-input-grid,
    .storage-input-layout,
    .two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .cheat-callout {
    align-items: stretch;
    flex-direction: column;
  }

  .formula-pair,
  .example-grid,
  .emissions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 12px;
  }

  .topnav {
    width: 100%;
  }

  .topnav a {
    flex: 1 1 auto;
    justify-content: center;
  }

  .storage-field-grid,
  .curve-input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .storage-chart {
    min-height: 280px;
    overflow-x: auto;
  }

  .storage-chart svg {
    min-width: 680px;
  }

  .cheat-hero h1 {
    font-size: 34px;
  }

  .price-strip,
  .rule-list div,
  .rule-list.compact div {
    grid-template-columns: 1fr;
  }

  .tooltip {
    left: auto;
    right: 0;
    transform: translateY(4px);
  }

  .info-tip:hover .tooltip,
  .info-tip:focus .tooltip,
  .info-tip:focus-within .tooltip {
    transform: translateY(0);
  }

  .source-row {
    grid-template-columns: 1fr 0.8fr;
  }

  .source-row span:nth-child(3),
  .source-row span:nth-child(4) {
    color: var(--muted);
  }
}

/* Standalone explainer and dashboard modes on qrlow.me. */
.dash-blog {
  width: min(960px, 100%);
  margin-right: auto;
  margin-left: auto;
  padding-right: 24px;
  padding-left: 24px;
  padding-top: 34px;
}

.dash-blog-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.dash-blog-header h1 {
  max-width: 760px;
  font-size: clamp(38px, 6vw, 66px);
  letter-spacing: -0.035em;
}

.dash-blog-deck {
  max-width: 720px;
  margin: 16px 0 0;
  color: #3c4a57;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.55;
}

.dash-blog-actions {
  min-width: min(100%, 330px);
}

.view-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 4px;
  width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #e9eef3;
}

.view-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.view-button:hover {
  color: var(--ink);
}

.view-button:focus-visible {
  outline: 2px solid rgba(60, 120, 181, 0.45);
  outline-offset: 2px;
}

.view-button.is-active {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}

.story-copy {
  width: 100%;
  padding-right: 17px;
  padding-left: 17px;
  margin: 68px auto 30px;
  color: #293846;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.72;
}

.story-copy h2 {
  margin: 0 0 16px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.story-copy p {
  margin: 0 0 18px;
}

.story-intro {
  margin-top: 0;
  margin-bottom: 42px;
  font-size: 21px;
}

.dashboard-stream {
  display: block;
}

.dashboard-panel {
  width: min(1120px, 100%);
  margin: 0 auto 74px;
}

.dashboard-panel-wide {
  width: 100%;
}

.dash-blog[data-view="story"] .control-band,
.dash-blog[data-view="story"] .kpi-grid {
  width: min(1120px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.dash-blog[data-view="dashboard"] .explainer-only {
  display: none !important;
}

.dash-blog[data-view="dashboard"] .dash-blog-header {
  margin-bottom: 18px;
}

.dash-blog[data-view="dashboard"] .dash-blog-header h1 {
  font-size: 32px;
  letter-spacing: -0.02em;
}

.dash-blog[data-view="dashboard"] .dashboard-stream {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.dash-blog[data-view="dashboard"] .dashboard-panel {
  width: auto;
  min-width: 0;
  margin: 0;
}

.dash-blog[data-view="dashboard"] .dashboard-panel-wide {
  grid-column: 1 / -1;
}

.dash-blog[data-view="dashboard"] [data-panel="definitions"],
.dash-blog[data-view="dashboard"] [data-panel="sources"] {
  align-self: stretch;
}

@media (max-width: 980px) {
  .dash-blog[data-view="dashboard"] .dashboard-stream {
    grid-template-columns: minmax(0, 1fr);
  }

  .dash-blog[data-view="dashboard"] .dashboard-panel-wide {
    grid-column: auto;
  }

  .story-copy {
    margin-top: 54px;
  }
}

@media (max-width: 600px) {
  .dash-blog {
    padding-top: 20px;
  }

  .dash-blog-header {
    margin-bottom: 24px;
  }

  .dash-blog-actions {
    min-width: 0;
    width: 100%;
  }

  .story-copy,
  .story-intro {
    font-size: 17px;
  }

  .dashboard-panel {
    margin-bottom: 52px;
  }
}
