:root {
  /* Premium Color Palette */
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --bg-soft: #e9ecef;
  --border: #dee2e6;
  --brand-blue: #2E4C75;
  --brand-green: #35754B;
  --rt-lmp-color: #35754B;
  --da-lmp-color: #2E4C75;

  --text: #212529;
  --text-dim: #6c757d;

  /* Deep Navy & Gold/Bronze Accents */
  --accent: #0f172a; /* Slate 900 */
  --accent-secondary: #334155; /* Slate 700 */
  --accent-highlight: #b45309; /* Amber 700 - subtle gold/bronze feel */

  --success: #15803d;
  --danger: #b91c1c;
  --warning: #b45309;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius: 20px;

  --font-serif: Georgia, serif;
}

html, body {
  height: 100%;
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif); /* Default to serif as requested */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(11, 108, 184, 0.08), transparent 25%),
    radial-gradient(circle at 85% 15%, rgba(15, 157, 88, 0.07), transparent 25%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--accent);
  margin-top: 0;
}

button, input, select, textarea {
  font-family: var(--font-serif);
}

/* Navigation */
.topnav {
  position: static;
  background: var(--bg-card);
  padding: 2.2rem 0;
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.brand img {
  height: 42px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 12px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.nav-toggle span {
  display: block;
  width: 30px;
  height: 1px;
  background: var(--accent);
  margin: 4px 0;
  border-radius: 999px;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-highlight);
}

.nav-links a.underlined {
  border-bottom: 1px solid var(--text);
}

/* Layout */
.page {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.header {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: flex-start;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-content h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.eyebrow {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: block;
}

/* Controls & Actions */
.actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: var(--bg-soft);
  color: var(--text-dim);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.2);
}

.button {
  appearance: none;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.14);
  color: var(--accent);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  box-shadow: none;
  font-size: 0.9rem;
}

.button:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(11, 108, 184, 0.35);
  color: var(--accent);
}

.button:active {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(15, 23, 42, 0.2);
  color: var(--accent);
}

.button:focus-visible {
  outline: 2px solid rgba(11, 108, 184, 0.35);
  outline-offset: 2px;
}

/* Choice chips */
.choice-chips {
  display: inline-flex;
  gap: 0.75rem;
}

.chip-btn {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: #fff;
  padding: 0.55rem 1.4rem;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-serif);
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chip-btn:hover {
  border-color: rgba(11, 108, 184, 0.35);
}

.chip-btn[aria-selected="true"] {
  background: var(--brand-blue);
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}

.chip-btn[aria-selected="true"]:hover {
  border-color: rgba(11, 108, 184, 0.35);
}

.chip-btn:focus-visible {
  outline: 2px solid rgba(11, 108, 184, 0.35);
  outline-offset: 2px;
}

/* Dashboard Cards */
.card {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: none;
  margin-bottom: 2rem;
}

.price-glance {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: stretch;
  margin-bottom: 0.5rem;
}

.price-table {
  width: 100%;
  display: grid;
  grid-auto-rows: auto;
  row-gap: 0.2rem;
}

.price-row {
  display: grid;
  grid-template-columns: auto minmax(200px, 1fr);
  align-items: baseline;
  column-gap: 0.75rem;
  padding: 0.15rem 0;
}

.price-row.rt .price-value {
  color: var(--brand-green);
}

.price-row.da .price-value {
  color: var(--brand-blue);
}

.price-row.ozp .price-value {
  color: var(--brand-blue);
}

.price-date {
  margin-top: 0.15rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.price-block {
  position: relative;
  flex: 1 1 260px;
  padding: 0.5rem 0;
}

.price-block .price-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.price-value {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.price-unit {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-weight: 600;
}

.price-meta {
  margin-top: 0.3rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.price-table .price-value {
  font-size: 1.5rem;
}

.price-block.rt {
}

.price-block.rt .price-value {
  color: var(--brand-green);
}

.price-block.da {
}

.price-block.da .price-value {
  color: var(--brand-blue);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.toolbar .label {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text);
  font-size: 1.1rem;
}

.toolbar .muted {
  font-family: var(--font-serif);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.legend {
  display: inline-flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
  font-family: var(--font-serif);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rt-lmp-color);
  box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.12);
}

.legend-swatch.da {
  background: var(--da-lmp-color);
  box-shadow: 0 0 0 3px rgba(46, 76, 117, 0.15);
}

.legend-bottom {
  margin-top: 1rem;
  gap: 1rem;
}

.lmp-toolbar {
  align-items: center;
  gap: 1rem;
}

.lmp-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text);
}

.legend-inline {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.legend-separator {
  color: var(--text-dim);
  font-family: var(--font-serif);
  font-weight: 600;
}

.chart-wrap {
  position: relative;
  height: 500px;
  width: 100%;
}

.chart-wrap canvas {
  display: block;
}

/* Autocomplete */
.autocomplete {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.autocomplete-label {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.autocomplete input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.autocomplete input:focus {
  outline: none;
  border-color: rgba(15, 23, 42, 0.2);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

.autocomplete input[aria-invalid="true"] {
  border-color: rgba(185, 28, 28, 0.6);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15);
}

.input-error {
  margin-top: 0.35rem;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
}

.input-error[hidden] {
  display: none;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  padding: 4px;
}

.suggestions[hidden] {
  display: none;
}

.suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9rem;
}

.suggestion:hover,
.suggestion:focus {
  background: var(--bg-soft);
  outline: none;
}

.suggestion-label {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.suggestion-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.autocomplete.inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 480px;
}

.autocomplete.inline .autocomplete-label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.autocomplete.inline input {
  flex: 1;
  margin: 0;
}

.node-control.hidden {
  display: none;
}

.select-like {
  position: relative;
  min-width: 240px;
}

.dropdown-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-dim);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  margin-top: 4rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .topnav {
    padding: 1rem 0;
  }

  .topnav-inner {
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0.75rem 1.25rem 1rem;
    background: var(--bg-card);
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: var(--shadow);
    border-top: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 1rem;
  }

  .page {
    padding: 1.25rem 1rem 2rem;
  }

  .header {
    gap: 1rem;
  }

  .controls-row {
    align-items: flex-start;
  }

  .controls-left,
  .controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .controls-right {
    justify-content: flex-start;
  }

  .choice-chips {
    width: 100%;
    flex-direction: column;
  }

  .choice-chips .chip-btn {
    flex: none;
    width: 100%;
    text-align: center;
  }

  .select-like {
    min-width: 0;
    width: 100%;
  }

  .price-glance {
    flex-direction: column;
    gap: 0.75rem;
  }

  .price-table {
    row-gap: 0.1rem;
  }

  .price-row {
    grid-template-columns: 1fr;
    row-gap: 0.2rem;
  }

  .price-block {
    flex: 1 1 auto;
  }

  .price-value {
    font-size: 1.6rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1.25rem;
  }

  .chart-wrap {
    height: auto;
  }
}
