/* Safis  -  minimal, high signal-to-noise */

:root {
  --fg: #1a1a1a;
  --fg-muted: #6b7280;
  --bg: #ffffff;
  --bg-section: #fafafa;
  --accent: #1d4ed8;
  --favorable: #047857;
  --unfavorable: #b91c1c;
  --borderline: #92400e;
  --ptc-line: #6b7280;
  --offer-below: #047857;
  --offer-above: #d1d5db;
  --aggregation: #7c3aed;       /* NOPEC */
  --aggregation-2: #0e7c6b;    /* Columbus  -  Crameri batlow teal */
  --rule: #e5e7eb;
  --term-1: 213, 63%, 45%;  /* blue  -  utility default rate */
  --term-2: 160, 60%, 40%;  /* teal  -  fixed rate */
  --term-3: 32, 70%, 48%;   /* amber  -  spread */
  --term-4: 280, 50%, 50%;  /* violet  -  cancellation fee */
  --term-5: 340, 55%, 48%;  /* rose  -  NOPEC */
  --term-6: 15, 75%, 50%;   /* orange  -  introductory rate */
  --term-7: 250, 55%, 55%;  /* indigo  -  EIA-861 */
  --intro-line: #5266a5;    /* Crameri managua t=0.66  -  slate blue */
  --actual-rate: #b16243;   /* Crameri managua t=0.25  -  burnt copper */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
header {
  margin-bottom: 3rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

header .pronunciation {
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
  margin-top: 0.15rem;
}

header .subtitle {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--fg);
  margin-top: 0.35rem;
}

header .scope-disclaimer {
  font-size: 0.6875rem;
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.4;
  margin-top: 0.25rem;
  max-width: 36rem;
}

header .scope {
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  margin-top: 0.15rem;
}

.territory-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  width: fit-content;
}

.territory-btn {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.3em 0.75em;
  border: none;
  background: var(--bg);
  color: var(--fg-muted);
  cursor: pointer;
}

.territory-btn + .territory-btn {
  border-left: 1px solid var(--rule);
}

.territory-btn.active {
  background: var(--fg);
  color: var(--bg);
}

.territory-btn:hover:not(.active) {
  background: var(--bg-section);
}

/* Site preamble */
.site-preamble {
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

.site-preamble p + p {
  margin-top: 0.5rem;
}

/* Section group headers  -  announce content groups */
.section-group-header {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  padding: 2rem 0 1rem;
  margin-top: 1rem;
  border-top: 2px solid var(--fg);
}

/* Sticky territory selector  -  shows buttons when header scrolls out */
.sticky-territory {
  position: sticky;
  top: 0;
  z-index: 51;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0 0.15rem;
  transition: opacity 0.15s;
  opacity: 0;
  pointer-events: none;
}

.sticky-territory.visible {
  opacity: 1;
  pointer-events: auto;
}

.territory-selector-sticky {
  margin-top: 0;
}

.territory-selector-sticky .territory-btn {
  font-size: 0.5625rem;
  padding: 0.2em 0.5em;
}

.sticky-territory-label {
  font-size: 0.5625rem;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}

/* Sticky section label  -  sits below territory label */
.sticky-label {
  position: sticky;
  top: 1.4rem;
  z-index: 50;
  background: var(--bg);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  padding: 0.2rem 0 0.4rem;
  border-bottom: 1px solid var(--rule);
  transition: opacity 0.15s;
  opacity: 0;
  pointer-events: none;
}

.sticky-label.visible {
  opacity: 1;
}

/* Sections */
main > section {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}

main > section:last-child {
  border-bottom: none;
}

/* Section headings  -  quiet navigational aids, not content */
main > section > h2 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
}

/* Claim  -  the primary message */
.claim {
  margin-bottom: 1.5rem;
}

.claim-signal {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2em 0.6em;
  border-radius: 2px;
  margin-bottom: 0.5rem;
}

.claim-signal[data-signal="favorable"] {
  background: var(--favorable);
  color: white;
}

.claim-signal[data-signal="unfavorable"] {
  background: var(--unfavorable);
  color: white;
}

.claim-signal[data-signal="borderline"] {
  background: var(--borderline);
  color: white;
}

.claim-headline {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.35;
}

.claim-evidence {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-top: 0.35rem;
}

.claim-disclaimer {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
  overflow: hidden;
  white-space: nowrap;
}

.claim-disclaimer span {
  display: inline-block;
  font-size: 0.6875rem;
  color: var(--fg-muted);
  line-height: 1.45;
  letter-spacing: 0.01em;
  will-change: transform;
  animation: disclaimer-scroll 60s linear infinite;
}

.marquee-sep {
  display: inline-block;
  width: 2rem;
}

@keyframes disclaimer-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

.claim-lines {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.claim-line {
  display: block;
}

.claim-summary {
  font-size: 1.125rem;
  line-height: 1.4;
}

/* Context  -  secondary explanation */
.context {
  color: var(--fg-muted);
  font-size: 0.8125rem;
  margin-top: 0.75rem;
}

/* Signal numbers (market-signal component) */
.signal-numbers {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 1.5rem 0;
}

.signal-number {
  display: flex;
  flex-direction: column;
}

.signal-connector {
  font-size: 1.125rem;
  color: var(--fg-muted);
  align-self: center;
  padding: 0 1rem;
  padding-bottom: 0.75rem;
}

.number-value {
  font-size: 1.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.number-value[data-favorable="true"] {
  color: var(--favorable);
}

.number-value[data-favorable="false"] {
  color: var(--unfavorable);
}

.number-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.15rem;
}

@media (max-width: 640px) {
  .signal-numbers {
    flex-direction: column;
    gap: 1rem;
  }
  .signal-connector {
    display: none;
  }
  .number-value {
    font-size: 1.5rem;
  }
}

/* Chart container */
.chart {
  margin: 1.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

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

/* Quadrant labels for scatter plots */
.quadrant-labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: var(--fg-muted);
}

.qlabel {
  opacity: 0.6;
}

/* Chart subtitles and toggles */
.chart-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.chart-toggle {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.chart-toggle .chart-subtitle {
  flex: 1;
  margin-bottom: 0;
}

.toggle-buttons {
  display: flex;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.toggle-btn {
  font-family: var(--font);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3em 0.7em;
  border: none;
  background: var(--bg);
  color: var(--fg-muted);
  cursor: pointer;
}

.toggle-btn + .toggle-btn {
  border-left: 1px solid var(--rule);
}

.toggle-btn.active {
  background: var(--fg);
  color: var(--bg);
}

.toggle-btn:hover:not(.active) {
  background: var(--bg-section);
}

/* In-chart legends (scatter term colors, density gradient) */
.scatter-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.25rem;
  font-size: 0.625rem;
  color: var(--fg-muted);
}

.scatter-legend .legend-item {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.scatter-legend .legend-item.off {
  opacity: 0.3;
  text-decoration: line-through;
}

/* Density legend */
.density-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.density-label {
  font-size: 0.5625rem;
  color: var(--fg-muted);
}

.density-bar {
  width: 6rem;
  height: 0.5rem;
  border-radius: 2px;
  background: linear-gradient(to right, #fef2f3, #cab79d, #7c9b9e, #4277a2, #28468b, #1a0c64);
}

/* Custom instant tooltips */
.chart-tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.6875rem;
  font-family: var(--font);
  line-height: 1.4;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  white-space: pre-line;
  max-width: 16rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Time scrubber */
.scrubber-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.scrubber-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--rule);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.scrubber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
}

.scrubber-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: grab;
}

.scrubber-date-input {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.15rem 0.35rem;
  width: 7rem;
  text-align: center;
}

.scrubber-date-input:focus {
  outline: none;
  border-color: var(--accent);
}

.scrubber-date-invalid {
  border-color: var(--unfavorable);
  color: var(--unfavorable);
}

/* Offer detail panel - modal overlay */
.offer-detail-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.3);
  justify-content: center;
  align-items: center;
}

.offer-detail-panel.open {
  display: flex;
}

.offer-detail-content {
  background: var(--bg);
  border-radius: 6px;
  padding: 1.5rem;
  max-width: 28rem;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.offer-detail-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.offer-detail-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.25rem;
  color: var(--fg-muted);
  cursor: pointer;
  line-height: 1;
}

.offer-detail-close:hover {
  color: var(--fg);
}

.offer-detail-table {
  width: 100%;
  font-size: 0.8125rem;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.offer-detail-table td {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--rule);
}

.offer-detail-table td:first-child {
  color: var(--fg-muted);
  width: 45%;
}

.offer-detail-table td.rate {
  font-family: var(--font-mono);
}

.offer-detail-raw {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.75rem;
}

.offer-detail-raw summary {
  cursor: pointer;
  font-weight: 500;
}

.offer-detail-raw pre {
  background: var(--bg-section);
  padding: 0.75rem;
  border-radius: 3px;
  overflow-x: auto;
  font-size: 0.6875rem;
  line-height: 1.4;
  margin-top: 0.5rem;
}

/* Observable Plot overrides  -  reduce noise */
.chart svg {
  font-family: var(--font);
}

.chart [aria-label="x-axis tick label"],
.chart [aria-label="y-axis tick label"] {
  font-size: 11px;
  fill: var(--fg-muted);
}

/* Detail / drill-down */
.detail {
  margin-top: 1rem;
}

.detail-toggle {
  font-size: 0.8125rem;
  color: var(--accent);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font);
}

.detail-toggle:hover {
  text-decoration: underline;
}

.detail-content {
  display: none;
  margin-top: 1rem;
}

.detail-content.open {
  display: block;
}

/* Offer table (drill-down) */
.offer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.offer-table th {
  text-align: left;
  font-weight: 600;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--rule);
  padding: 0.4rem 0.75rem 0.4rem 0;
}

.offer-table td {
  padding: 0.3rem 0.75rem 0.3rem 0;
  border-bottom: 1px solid var(--rule);
}

.offer-table .rate {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.offer-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.offer-table th.sortable:hover {
  color: var(--fg);
}

.offer-table .below { color: var(--favorable); }
.offer-table .above { color: var(--fg-muted); }
.offer-table .unknown { color: var(--unfavorable); font-weight: 600; }

.offer-details-btn {
  padding: 0.15em 0.5em;
  font-size: 0.75rem;
  font-family: var(--font);
  color: var(--fg-muted);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
}

.offer-details-btn:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

/* Intro transparency table */
.intro-table td:first-child { max-width: 12rem; }

.ratio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ratio-bar {
  display: inline-block;
  height: 0.5rem;
  border-radius: 1px;
  min-width: 2px;
}

.ratio-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: nowrap;
}

.intro-table-note {
  margin-top: 0.75rem;
}

/* Intro transparency table with sparklines */
.intro-table-wrap {
  margin: 1.5rem 0;
}

.intro-spark-table {
  table-layout: fixed;
}

.intro-spark-table .supplier-cell {
  width: 18%;
  font-weight: 500;
  font-size: 0.75rem;
}

.intro-spark-table .intro-rate {
  color: var(--intro-line);
}

.intro-spark-table .sparkline-col {
  width: 38%;
}

.sparkline-hint {
  font-size: 0.5625rem;
  font-weight: 400;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}

.intro-spark-table .sparkline-cell {
  padding: 0.15rem 0;
  vertical-align: middle;
  touch-action: none;
  user-select: none;
}

.sparkline-clip {
  overflow: hidden;
  position: relative;
  padding-bottom: 2px;
}

.sparkline-clip svg {
  display: block;
  height: auto;
}

.intro-spark-table .no-data {
  font-size: 0.6875rem;
  color: var(--fg-muted);
  font-style: italic;
}

.rate-with-gap {
  white-space: nowrap;
  position: relative;
}

.gap-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--unfavorable);
  border: 1.5px solid var(--unfavorable);
  border-radius: 50%;
  margin-left: 0.3rem;
  vertical-align: middle;
  cursor: help;
  opacity: 0.7;
}

.gap-indicator:hover {
  opacity: 1;
}

.eia-year-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 400;
  color: var(--fg-muted);
  margin-left: 0.25rem;
}

.legend-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.2rem;
  vertical-align: middle;
  border-radius: 1px;
}

.legend-swatch-line {
  height: 0.15rem;
}

.swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 0.15rem;
}

/* Archive table */
.archive-table td:first-child {
  max-width: 11rem;
  width: 30%;
  vertical-align: middle;
}

.archive-spark-cell {
  vertical-align: middle;
  padding: 0.25rem 0;
  height: 4.5rem;
}

.archive-spark-cell svg {
  display: block;
  width: 100%;
  height: auto;
}

.archive-meta {
  font-size: 0.625rem;
  color: var(--fg-muted);
  font-weight: 400;
}

.archive-active td {
  font-weight: 500;
}

.archive-now {
  display: inline-block;
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--intro-line);
  background: hsla(220, 95%, 18%, 0.1);
  padding: 0.05em 0.35em;
  border-radius: 2px;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.archive-eia-year {
  font-size: 0.625rem;
  color: var(--fg-muted);
}

/* Verification list */
.verification-list {
  font-size: 0.8125rem;
  line-height: 1.5;
  padding-left: 1.25rem;
  margin-top: 0.75rem;
}

.verification-list li {
  margin-bottom: 0.75rem;
}

.verification-list a {
  color: var(--accent);
  font-size: 0.75rem;
}

/* Metadata line */
.metadata {
  margin-top: 1.5rem;
  font-size: 0.6875rem;
  color: var(--fg-muted);
}

/* Footer */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

footer a {
  color: var(--fg-muted);
}

/* Support panel  -  persistent, bottom-left */
.support {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 100;
  font-size: 0.8125rem;
}

.support-toggle {
  display: block;
  padding: 0.35em 0.75em;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}

.support-toggle:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.support-toggle .arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

.support.open .support-toggle .arrow {
  transform: rotate(180deg);
}

.support-panel {
  display: none;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.35rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  width: 16rem;
}

.support-panel p {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--fg);
}

.support-btn {
  display: block;
  text-align: center;
  padding: 0.5em 1em;
  margin: 0.75rem 0;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--bg);
  background: var(--fg);
  border-radius: 3px;
  text-decoration: none;
}

.support-btn:hover {
  opacity: 0.85;
}

.support-fine-print {
  font-size: 0.6875rem !important;
  color: var(--fg-muted) !important;
}

.support-fine-print a {
  color: var(--fg-muted);
}

.support.open .support-panel {
  display: block;
}

.support.open .support-toggle {
  color: var(--fg);
  border-color: var(--fg-muted);
}

@media (max-width: 640px) {
  .support {
    left: 0.5rem;
    bottom: 0.5rem;
  }
}

/* Glossary  -  persistent, collapsed by default */
.glossary {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  font-size: 0.8125rem;
}

.glossary-toggle {
  display: block;
  margin-left: auto;
  padding: 0.35em 0.75em;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}

.glossary-toggle:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.glossary-panel {
  display: none;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.35rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  width: 18rem;
}

.glossary.open .glossary-panel {
  display: block;
}

.glossary.open .glossary-toggle {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.glossary-toggle .arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

.glossary.open .glossary-toggle .arrow {
  transform: rotate(180deg);
}

.glossary-panel dl {
  display: grid;
  gap: 0;
}

.glossary-panel dt {
  font-weight: 600;
  color: var(--fg);
  margin-top: 0.6rem;
}

.glossary-panel dt:first-child {
  margin-top: 0;
}

.glossary-panel dd {
  color: var(--fg-muted);
  line-height: 1.4;
  margin-top: 0.1rem;
}

/* Term highlighting  -  marks are invisible until activated */
mark.term-ref {
  background: none;
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
  transition: background 0.15s;
  vertical-align: baseline;
}

mark.term-ref.active { background: hsla(var(--term-1), 0.12); }
mark.term-ref[data-term="utility-default-rate"].active { background: hsla(var(--term-1), 0.12); }
mark.term-ref[data-term="fixed-rate"].active            { background: hsla(var(--term-2), 0.12); }
mark.term-ref[data-term="spread"].active                { background: hsla(var(--term-3), 0.12); }
mark.term-ref[data-term="cancellation-fee"].active      { background: hsla(var(--term-4), 0.12); }
mark.term-ref[data-term="nopec"].active                 { background: hsla(var(--term-5), 0.12); }
mark.term-ref[data-term="introductory-rate"].active      { background: hsla(var(--term-6), 0.12); }
mark.term-ref[data-term="eia-861-(avg-actual)"].active   { background: hsla(var(--term-7), 0.12); }

/* Glossary dt interactive states */
.glossary-panel dt[data-match] {
  cursor: pointer;
  padding: 0.1em 0.25em;
  margin-left: -0.25em;
  border-radius: 2px;
  border-left: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.glossary-panel dt[data-term-id="utility-default-rate"] { border-left-color: hsl(var(--term-1)); }
.glossary-panel dt[data-term-id="fixed-rate"]           { border-left-color: hsl(var(--term-2)); }
.glossary-panel dt[data-term-id="spread"]               { border-left-color: hsl(var(--term-3)); }
.glossary-panel dt[data-term-id="cancellation-fee"]     { border-left-color: hsl(var(--term-4)); }
.glossary-panel dt[data-term-id="nopec"]                { border-left-color: hsl(var(--term-5)); }
.glossary-panel dt[data-term-id="introductory-rate"]    { border-left-color: hsl(var(--term-6)); }
.glossary-panel dt[data-term-id="eia-861-(avg-actual)"] { border-left-color: hsl(var(--term-7)); }

.glossary-panel dt[data-term-id="utility-default-rate"]:hover,
.glossary-panel dt[data-term-id="utility-default-rate"].locked { background: hsla(var(--term-1), 0.10); }
.glossary-panel dt[data-term-id="fixed-rate"]:hover,
.glossary-panel dt[data-term-id="fixed-rate"].locked           { background: hsla(var(--term-2), 0.10); }
.glossary-panel dt[data-term-id="spread"]:hover,
.glossary-panel dt[data-term-id="spread"].locked               { background: hsla(var(--term-3), 0.10); }
.glossary-panel dt[data-term-id="cancellation-fee"]:hover,
.glossary-panel dt[data-term-id="cancellation-fee"].locked     { background: hsla(var(--term-4), 0.10); }
.glossary-panel dt[data-term-id="nopec"]:hover,
.glossary-panel dt[data-term-id="nopec"].locked                { background: hsla(var(--term-5), 0.10); }
.glossary-panel dt[data-term-id="introductory-rate"]:hover,
.glossary-panel dt[data-term-id="introductory-rate"].locked    { background: hsla(var(--term-6), 0.10); }
.glossary-panel dt[data-term-id="eia-861-(avg-actual)"]:hover,
.glossary-panel dt[data-term-id="eia-861-(avg-actual)"].locked { background: hsla(var(--term-7), 0.10); }

/* Responsive */
@media (max-width: 640px) {
  body {
    padding: 1rem;
  }

  header {
    margin-bottom: 2rem;
  }

  main > section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
  }

  .claim-summary {
    font-size: 1rem;
  }

  .offer-table {
    font-size: 0.75rem;
  }

  .offer-table th,
  .offer-table td {
    padding: 0.3rem 0.5rem 0.3rem 0;
  }

  .detail-toggle {
    /* Larger tap target on mobile */
    padding: 0.5rem 0;
  }

  .glossary {
    right: 0.5rem;
    bottom: 0.5rem;
  }

  .glossary-panel {
    width: calc(100vw - 1rem);
    max-height: 50vh;
  }
}
