:root {
  --bg: #f3efe4;
  --bg-accent: #f7c58c;
  --paper: rgba(255, 250, 240, 0.82);
  --paper-strong: rgba(255, 248, 234, 0.95);
  --ink: #1d1b16;
  --muted: #62584a;
  --line: rgba(55, 41, 23, 0.12);
  --teal: #167f74;
  --teal-soft: rgba(22, 127, 116, 0.14);
  --coral: #ec6b4d;
  --peak: #f18d53;
  --offpeak: #83b7a5;
  --shadow: 0 24px 80px rgba(83, 52, 17, 0.15);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Space Grotesk", "Avenir Next", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 28%),
    radial-gradient(circle at right 15% top 10%, rgba(241, 141, 83, 0.28), transparent 20%),
    linear-gradient(135deg, #f1ecdd 0%, #f3efe4 52%, #e5eee8 100%);
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero,
.layout {
  display: grid;
  gap: 24px;
}

.hero {
  grid-template-columns: 1fr;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.panel,
.chart-card {
  backdrop-filter: blur(14px);
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: var(--radius-xl);
  padding: 32px 36px;
}

.eyebrow,
.summary-label,
.chart-header p,
.panel-header p,
.footnote {
  color: var(--muted);
  font-size: 0.92rem;
}

h1,
h2,
h3,
.summary-value,
.hero-card-value {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 500;
  letter-spacing: -0.03em;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5.4vw, 4.8rem);
  line-height: 0.92;
  margin: 0 0 14px;
}

h2 {
  font-size: 1.6rem;
}

h3 {
  font-size: 1.15rem;
}

.hero-text {
  font-size: 1rem;
  line-height: 1.5;
  max-width: none;
  width: 100%;
}

.layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.panel {
  border-radius: var(--radius-xl);
  padding: 28px;
}

.vehicle-panel {
  margin-bottom: 24px;
}

.controls-panel {
  position: static;
}

.panel-header {
  margin-bottom: 22px;
}

.panel-header h2 {
  margin-bottom: 8px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.manual-tariff-fields {
  display: contents;
}

.managed-tariff-note {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(22, 127, 116, 0.08);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

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

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 0.93rem;
  color: var(--muted);
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--paper-strong);
}

input:focus,
select:focus {
  outline: 2px solid rgba(22, 127, 116, 0.3);
  border-color: rgba(22, 127, 116, 0.3);
}

.input-with-suffix {
  position: relative;
}

.input-with-suffix input {
  padding-right: 72px;
}

.input-with-suffix span {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--muted);
}

.slider-field {
  display: grid;
  gap: 10px;
}

.slider-readout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  height: 28px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(22, 127, 116, 0.24), rgba(22, 127, 116, 0.58));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #167f74;
  border: 3px solid rgba(255, 248, 234, 0.95);
  box-shadow: 0 6px 18px rgba(22, 127, 116, 0.25);
  margin-top: -6px;
}

input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(22, 127, 116, 0.24), rgba(22, 127, 116, 0.58));
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #167f74;
  border: 3px solid rgba(255, 248, 234, 0.95);
  box-shadow: 0 6px 18px rgba(22, 127, 116, 0.25);
}

.footnote {
  margin: 20px 0 0;
  line-height: 1.55;
}

.field-helper {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.forecast-tabs {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(22, 127, 116, 0.08);
}

.forecast-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 9px 16px;
  cursor: pointer;
}

.forecast-tab.is-active {
  background: rgba(255, 248, 234, 0.98);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(29, 27, 22, 0.08);
}

.annual-days-field {
  margin-bottom: 18px;
}

.forecast-tabs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.estimate-note {
  position: relative;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(236, 107, 77, 0.06);
  border: 1px solid rgba(236, 107, 77, 0.12);
}

.estimate-note-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.8);
  color: var(--muted);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.estimate-note-title {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 700;
}

.estimate-note-body {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

.assumptions-inline {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.metric-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.46));
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-md);
  padding: 16px;
}

.metric-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-value {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.metric-detail {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.vehicle-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 22px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(16, 66, 61, 0.08);
}

.vehicle-selection-summary {
  margin: 20px 0 0;
}

.forecast-summary {
  grid-template-columns: 1fr;
}

.summary-value {
  font-size: 1.3rem;
  margin-top: 6px;
}

.summary-subvalue {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.assumptions-footer-text {
  margin-top: 16px;
}

.help-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(98, 88, 74, 0.35);
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.92);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1;
  cursor: help;
  padding: 0;
}

.help-icon::after,
.help-icon::before {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.help-icon::after {
  content: attr(data-tooltip);
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  width: min(260px, 70vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(29, 27, 22, 0.94);
  color: #fff9f0;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 10px 30px rgba(29, 27, 22, 0.2);
  z-index: 5;
}

.help-icon::before {
  content: "";
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid rgba(29, 27, 22, 0.94);
  z-index: 5;
}

.help-icon:hover::after,
.help-icon:hover::before,
.help-icon:focus-visible::after,
.help-icon:focus-visible::before {
  opacity: 1;
}

.chart-stack {
  display: grid;
  gap: 18px;
}

.chart-card {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.chart-header {
  margin-bottom: 10px;
}

.chart-header h3 {
  margin-bottom: 6px;
}

.chart-surface {
  min-height: 240px;
  position: relative;
}

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

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

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

.chart-annotation-text {
  font-family: var(--font-body);
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.bar {
  cursor: pointer;
  transition: opacity 120ms ease, transform 120ms ease;
}

.bar:hover {
  opacity: 0.92;
}

.selected-outline {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}

.cheapest-outline {
  fill: none;
  stroke: #ec6b4d;
  stroke-width: 2;
}

.cumulative-hit-target {
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(29, 27, 22, 0.92);
  color: #fff9f0;
  font-size: 0.84rem;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(29, 27, 22, 0.25);
}

.chart-summary {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 0.96rem;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

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

.legend-chip {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 999px;
  margin-right: 6px;
}

.page-footer {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.page-footer p {
  margin: 0;
}

.page-footer a {
  color: inherit;
  text-decoration-color: rgba(98, 88, 74, 0.45);
  text-underline-offset: 3px;
}

.page-footer a:hover {
  text-decoration-color: currentColor;
}

@media (max-width: 1080px) {
  .hero,
  .layout,
  .metrics-grid,
  .vehicle-summary,
  .vehicle-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 22px;
  }

  h1 {
    font-size: 3rem;
  }
}
