:root {
  --nsw: #66b7ff;
  --qld: #5fd0a0;
  --sa: #f8a95b;
  --vic: #b49af9;
}

/* Site-wide light theme refinements for the dashboard visual. */
.dashboard-panel {
  background: #ffffff;
  border-color: #d8e1ed;
  box-shadow: 0 14px 34px rgba(24, 47, 78, 0.09);
}

.dashboard-panel::before { background: none; }
.view-controls button,
.axis-controls input,
.axis-controls select,
.week-arrow,
.chart-legend button {
  color: #526278;
  background: #f8fafc;
  border-color: #d6e0eb;
}

.view-controls button:hover,
.view-controls button:focus-visible,
.view-controls button.is-active,
.week-arrow:hover:not(:disabled),
.week-arrow:focus-visible,
.chart-legend button:hover,
.chart-legend button.is-active {
  color: #153f78;
  background: #e9f2ff;
  border-color: #bcd2ef;
}

.weekly-chart-scroll {
  background: #ffffff;
  border-color: #dce4ef;
  scrollbar-color: #b8c5d6 transparent;
}

.day-band { fill: rgba(37, 99, 199, 0.035); }
.day-guide,
.price-grid-line { stroke: rgba(71, 89, 112, 0.18); }
.weekday-label,
.axis-price-label { fill: #52657e; }
.hour-label { fill: #7a899c; }
.zero-axis-label { fill: #c43f50; }
.positive-price-area { fill: rgba(37, 99, 199, 0.055); }
.daily-spread-point { stroke: #ffffff; }
.daily-spread-label { stroke: #ffffff; }
.metric-box-bg { fill: #fbfcfe; stroke: #dbe4ef; }
.metric-day-title { fill: #24344b; }
.metric-section-divider { stroke: #dbe4ef; }
.metric-section-title,
.metric-observed-title,
.metric-significance-title,
.metric-rank-label { fill: #66778e; }
.metric-label,
.metric-observed-value,
.metric-significance-value { fill: #26364d; }
.metric-observed-box { fill: #f7f9fc; stroke: #cbd7e5; }
.metric-significance-box { stroke: #cbd7e5; }
.metric-vertical-rank-bar { fill: #e4eaf2; }
.metric-vertical-rank-bar.is-filled.quality-3,
.metric-vertical-rank-bar.is-filled.significance-none { fill: #64748b; }
.metric-significance-value { stroke: #ffffff; }
.metric-incomplete { fill: #8492a5; }
.metric-rank-bar { fill: #e4eaf2; }
.metric-rank-bar.is-filled { fill: #7b8ba0; }
.latest-value-line,
.hover-line { stroke: rgba(38, 54, 77, 0.72); }
.chart-tooltip {
  color: #42526b;
  background: rgba(255, 255, 255, 0.97);
  border-color: #d5dfeb;
  box-shadow: 0 12px 30px rgba(24, 47, 78, 0.16);
}
.chart-legend [data-region]::before { background: #26364d; }
.chart-legend [data-comparison]::before { border-top-color: #6f8caf; }
.chart-legend [data-comparison="last_year"]::before { border-top-color: #4d6685; }
.chart-legend [data-comparison="last_three_years"]::before { border-top-color: #26364d; }

.dashboard-page {
  color: var(--text-primary);
  margin: 0;
  padding: 0;
}

.dashboard-page > main {
  flex: 0 0 auto;
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.dashboard-freshness {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.feed-status {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: 26px;
  padding: 2px 5px;
  border: 1px solid rgba(132, 153, 183, 0.24);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(132, 153, 183, 0.06);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.feed-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(248, 169, 91, 0.1);
}

.feed-status.is-live {
  color: var(--green);
  border-color: rgba(95, 208, 160, 0.32);
  background: rgba(95, 208, 160, 0.07);
}

.feed-status.is-live span {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(95, 208, 160, 0.11), 0 0 13px rgba(95, 208, 160, 0.48);
}

.feed-status.is-history {
  color: #9dbce8;
  border-color: rgba(114, 167, 255, 0.28);
  background: rgba(114, 167, 255, 0.07);
}

.feed-status.is-history span {
  background: #72a7ff;
  box-shadow: 0 0 0 4px rgba(114, 167, 255, 0.1);
}

.feed-status.is-error {
  color: var(--red);
  border-color: rgba(255, 107, 122, 0.3);
}

.feed-status.is-error span {
  background: var(--red);
}

.dashboard-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(199, 216, 240, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(18, 33, 58, 0.86), rgba(11, 22, 40, 0.9)),
    var(--bg-card);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.2);
}

.dashboard-panel::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.025), transparent 38%);
  content: "";
  pointer-events: none;
}

.weekly-price-panel {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.panel-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  margin: 0;
}

.panel-heading h3 {
  margin: 0;
  padding: 3px 4px;
  font: 600 1rem/1.2 "Montserrat", "Inter", sans-serif;
  letter-spacing: -0.018em;
}

.panel-heading .dashboard-freshness {
  margin: 0;
}

.chart-legend [data-region]::before { background: #f5f8ff; }

.chart-legend [data-comparison]::before {
  height: 0;
  border-top: 2px dashed #d3e4ff;
  background: none;
}

.chart-legend [data-comparison="last_year"]::before {
  border-top-color: #7f8b9b;
  border-top-style: dashed;
}

.chart-legend [data-comparison="last_three_years"]::before {
  border-top-color: #3f4855;
  border-top-style: dashed;
}

.weekly-chart-wrap {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 2px 4px;
}

.view-controls button {
  margin: 0;
  padding: 2px 6px;
  border: 1px solid rgba(199, 216, 240, 0.12);
  border-radius: 0;
  color: var(--text-muted);
  background: rgba(4, 11, 24, 0.28);
  font: 600 0.63rem/1.5 "Inter", sans-serif;
  cursor: pointer;
}

.view-controls button:first-child { border-radius: 6px 0 0 6px; }
.view-controls button:last-child { border-radius: 0 6px 6px 0; }
.view-controls button + button { border-left-width: 0; }

.view-controls button:hover,
.view-controls button:focus-visible,
.view-controls button.is-active {
  color: var(--text-primary);
  background: rgba(245, 248, 255, 0.1);
}

.view-controls button:focus-visible {
  outline: 2px solid rgba(245, 248, 255, 0.45);
  outline-offset: 1px;
}

.chart-meta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.week-navigation {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 0;
  padding: 2px 4px;
}

#week-label {
  position: absolute;
  left: 50%;
  padding: 2px 4px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.period-arrows {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.axis-controls {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 2px 4px;
}

.axis-controls label {
  margin: 0;
  padding: 2px 3px;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 600;
}

.axis-controls input,
.axis-controls select {
  width: 58px;
  margin: 0;
  padding: 1px 3px;
  border: 1px solid rgba(199, 216, 240, 0.16);
  border-radius: 5px;
  color: var(--text-primary);
  background: rgba(4, 11, 24, 0.42);
  font: 600 0.65rem/1.5 "Inter", sans-serif;
  text-align: center;
}

.axis-controls input:focus-visible,
.axis-controls select:focus-visible {
  outline: 2px solid rgba(102, 183, 255, 0.48);
  outline-offset: 1px;
}

.axis-controls input[aria-invalid="true"] {
  border-color: var(--red);
}

.week-arrow {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 2px;
  border: 1px solid rgba(199, 216, 240, 0.16);
  border-radius: 7px;
  color: var(--text-secondary);
  background: rgba(199, 216, 240, 0.04);
  font: 600 0.85rem/1 "Inter", sans-serif;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.week-arrow:hover:not(:disabled),
.week-arrow:focus-visible {
  color: var(--text-primary);
  border-color: rgba(102, 183, 255, 0.42);
  background: rgba(102, 183, 255, 0.09);
}

.week-arrow:focus-visible {
  outline: 2px solid rgba(102, 183, 255, 0.48);
  outline-offset: 2px;
}

.week-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.weekly-chart-scroll {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(199, 216, 240, 0.08);
  border-radius: 10px;
  background: rgba(4, 11, 24, 0.28);
  scrollbar-color: rgba(114, 167, 255, 0.35) transparent;
}

.price-chart {
  display: block;
  width: max(100%, 860px);
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
  overflow: visible;
  cursor: crosshair;
}

.day-band {
  fill: rgba(114, 167, 255, 0.025);
}

.day-guide,
.price-grid-line {
  stroke: rgba(199, 216, 240, 0.1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.zero-reference-line {
  stroke: rgba(248, 81, 73, 0.62);
  stroke-width: 1.25;
  stroke-dasharray: 6 5;
  vector-effect: non-scaling-stroke;
}

.weekday-label,
.axis-price-label {
  fill: rgba(199, 216, 240, 0.62);
  font: 600 11px "Inter", sans-serif;
  letter-spacing: 0.08em;
}

.hour-label {
  fill: rgba(199, 216, 240, 0.4);
  font: 500 8px "Inter", sans-serif;
  letter-spacing: 0.04em;
}

.axis-price-label {
  fill: rgba(199, 216, 240, 0.52);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.zero-axis-label {
  fill: rgba(255, 139, 150, 0.9);
  font-weight: 700;
}

.spike-tier-reference {
  stroke: rgba(255, 92, 108, 0.5);
  stroke-width: 0.8;
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}

.spike-tier-label {
  fill: rgba(255, 124, 137, 0.82);
  font: 600 6.5px "Inter", sans-serif;
  letter-spacing: 0.02em;
}

.price-chart polyline {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.price-chart polyline.comparison-line {
  stroke-width: 1;
  opacity: 0.72;
}

.positive-price-area {
  fill: rgba(199, 216, 240, 0.045);
}

.negative-price-area {
  fill: rgba(248, 81, 73, 0.1);
}

.spike-segment {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.spike-segment.tier-1 { stroke: #ff5c6c; }
.spike-segment.tier-2 { stroke: #f8a95b; }
.spike-segment.tier-3 { stroke: #ffd0a1; }

.daily-spread-line {
  stroke: rgba(95, 208, 160, 0.78);
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.daily-spread-point {
  fill: #5fd0a0;
  stroke: rgba(11, 22, 40, 0.9);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.daily-spread-label {
  fill: rgba(111, 224, 176, 0.92);
  font: 600 6px "Inter", sans-serif;
  paint-order: stroke;
  stroke: rgba(11, 22, 40, 0.9);
  stroke-width: 2px;
  stroke-linejoin: round;
}

.metric-box-bg {
  fill: rgba(4, 11, 24, 0.18);
  stroke: rgba(199, 216, 240, 0.1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.metric-day-title {
  fill: rgba(245, 248, 255, 0.86);
  font: 700 11px "Inter", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-section-divider {
  stroke: rgba(199, 216, 240, 0.1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.metric-section-title {
  fill: rgba(199, 216, 240, 0.56);
  font: 700 8px "Inter", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metric-label {
  fill: rgba(245, 248, 255, 0.8);
  font: 600 7.5px "Inter", sans-serif;
}

.metric-observed-title {
  fill: rgba(199, 216, 240, 0.62);
  font: 600 6.7px "Inter", sans-serif;
  text-transform: uppercase;
}

.metric-observed-box {
  fill: rgba(132, 153, 183, 0.08);
  stroke: rgba(199, 216, 240, 0.24);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}

.metric-observed-value {
  fill: #f5f8ff;
  font: 700 9px "Inter", sans-serif;
  pointer-events: none;
}

.metric-rank-label {
  fill: rgba(199, 216, 240, 0.48);
  font: 500 8px "Inter", sans-serif;
}

.metric-significance-title {
  fill: rgba(199, 216, 240, 0.62);
  font: 600 6.7px "Inter", sans-serif;
  text-transform: uppercase;
}

.metric-significance-box {
  fill: transparent;
  stroke: rgba(199, 216, 240, 0.24);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}

.metric-vertical-rank-bar {
  fill: rgba(245, 248, 255, 0.14);
  pointer-events: none;
}

.metric-vertical-rank-bar.is-filled.quality-1 { fill: #ff6b7a; }
.metric-vertical-rank-bar.is-filled.quality-2 { fill: #f8915b; }
.metric-vertical-rank-bar.is-filled.quality-3 { fill: #f5f8ff; }
.metric-vertical-rank-bar.is-filled.quality-4 { fill: #f8915b; }
.metric-vertical-rank-bar.is-filled.quality-5 { fill: #ff6b7a; }

.metric-vertical-rank-bar.is-filled.significance-none { fill: #f5f8ff; }
.metric-vertical-rank-bar.is-filled.significance-some { fill: #ff6b7a; }
.metric-vertical-rank-bar.is-filled.significance-high { fill: #ff6b7a; }

.metric-significance-value {
  fill: #f5f8ff;
  font: 700 7px "Inter", sans-serif;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(4, 11, 24, 0.8);
  stroke-width: 1.4px;
}

.metric-incomplete {
  fill: rgba(199, 216, 240, 0.42);
  font: 600 6px "Inter", sans-serif;
  letter-spacing: 0.025em;
}

.metric-rank-bar {
  fill: rgba(199, 216, 240, 0.09);
}

.metric-rank-bar.is-filled {
  fill: rgba(199, 216, 240, 0.66);
}

.latest-value-line {
  opacity: 0;
  stroke: rgba(245, 248, 255, 0.72);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.latest-value-line.is-visible {
  opacity: 1;
}

.hover-line {
  opacity: 0;
  stroke: rgba(245, 248, 255, 0.6);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.hover-line.is-visible {
  opacity: 1;
}

.chart-tooltip {
  position: absolute;
  top: 54px;
  z-index: 4;
  display: grid;
  min-width: 138px;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(199, 216, 240, 0.2);
  border-radius: 8px;
  color: var(--text-secondary);
  background: rgba(7, 14, 27, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  font-size: 0.64rem;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.08s ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-tooltip strong {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.65rem;
  font-weight: 600;
}

.chart-tooltip span {
  display: flex;
  align-items: center;
  gap: 0;
}

.chart-tooltip span::before {
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--series-color);
  content: "";
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  padding: 2px 4px;
  color: var(--text-muted);
  font-size: 0.56rem;
}

.chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 4px;
  color: var(--text-muted);
  background: transparent;
  font: inherit;
  opacity: 0.42;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.chart-legend button::before {
  width: 14px;
  height: 2px;
  border-radius: 2px;
  content: "";
}

.chart-legend button:hover,
.chart-legend button:focus-visible,
.chart-legend button.is-active {
  color: var(--text-primary);
  opacity: 1;
}

.chart-legend button.is-active {
  border-color: rgba(199, 216, 240, 0.12);
  background: rgba(199, 216, 240, 0.05);
}

.chart-legend button:focus-visible {
  outline: 2px solid rgba(102, 183, 255, 0.55);
  outline-offset: 2px;
}

@media (max-width: 620px) {
  .dashboard-intro { align-items: flex-start; flex-direction: column; gap: 0; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading .dashboard-freshness { justify-content: flex-start; margin: 0; }
  .weekly-price-panel { min-height: 0; padding: 0; }
  .chart-meta { align-items: flex-start; flex-direction: column; gap: 0; }
  .week-navigation { width: 100%; }
  #week-label { left: 50%; }
  .view-controls { overflow-x: auto; }
  .chart-legend { justify-content: flex-start; }
}

/* Light dashboard surfaces and chart chrome (kept last to override component defaults). */
.dashboard-panel {
  background: #ffffff;
  border-color: #d8e1ed;
  box-shadow: 0 14px 34px rgba(24, 47, 78, 0.09);
}
.dashboard-panel::before { background: none; }
.view-controls button,
.axis-controls input,
.axis-controls select,
.week-arrow,
.chart-legend button {
  color: #526278;
  background: #f8fafc;
  border-color: #d6e0eb;
}
.view-controls button:hover,
.view-controls button:focus-visible,
.view-controls button.is-active,
.week-arrow:hover:not(:disabled),
.week-arrow:focus-visible,
.chart-legend button:hover,
.chart-legend button.is-active {
  color: #153f78;
  background: #e9f2ff;
  border-color: #bcd2ef;
}
.weekly-chart-scroll { background: #ffffff; border-color: #dce4ef; scrollbar-color: #b8c5d6 transparent; }
.day-band { fill: rgba(37, 99, 199, 0.035); }
.day-guide, .price-grid-line { stroke: rgba(71, 89, 112, 0.18); }
.weekday-label, .axis-price-label { fill: #52657e; }
.hour-label { fill: #7a899c; }
.zero-axis-label { fill: #c43f50; }
.positive-price-area { fill: rgba(37, 99, 199, 0.055); }
.daily-spread-point, .daily-spread-label { stroke: #ffffff; }
.metric-box-bg { fill: #fbfcfe; stroke: #dbe4ef; }
.metric-day-title { fill: #24344b; }
.metric-section-divider { stroke: #dbe4ef; }
.metric-section-title,
.metric-observed-title,
.metric-significance-title,
.metric-rank-label { fill: #66778e; }
.metric-label,
.metric-observed-value,
.metric-significance-value { fill: #26364d; }
.metric-observed-box { fill: #f7f9fc; stroke: #cbd7e5; }
.metric-significance-box { stroke: #cbd7e5; }
.metric-vertical-rank-bar { fill: #e4eaf2; }
.metric-vertical-rank-bar.is-filled.quality-3,
.metric-vertical-rank-bar.is-filled.significance-none { fill: #64748b; }
.metric-significance-value { stroke: #ffffff; }
.metric-incomplete { fill: #8492a5; }
.metric-rank-bar { fill: #e4eaf2; }
.metric-rank-bar.is-filled { fill: #7b8ba0; }
.latest-value-line, .hover-line { stroke: rgba(38, 54, 77, 0.72); }
.chart-tooltip {
  color: #42526b;
  background: rgba(255, 255, 255, 0.97);
  border-color: #d5dfeb;
  box-shadow: 0 12px 30px rgba(24, 47, 78, 0.16);
}
.chart-legend [data-region]::before { background: #26364d; }
.chart-legend [data-comparison]::before { border-top-color: #6f8caf; }
.chart-legend [data-comparison="last_year"]::before { border-top-color: #4d6685; }
.chart-legend [data-comparison="last_three_years"]::before { border-top-color: #26364d; }
