:root {
  --ink: #161a14;
  --muted: #626c5b;
  --line: rgba(140, 200, 11, 0.26);
  --panel: #fffdf6;
  --panel-soft: #f6f0df;
  --page: #f1ecd9;
  --field: #5f870a;
  --field-dark: #050505;
  --field-soft: #e7f5bf;
  --orange: #ff6a00;
  --lime: #8cc80b;
  --profit-green: #1f8f2e;
  --loss-red: #d71920;
  --red: #f4c1ad;
  --red-ink: #89341f;
  --shadow: 0 14px 34px rgba(54, 43, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  background:
    radial-gradient(circle at 20% 8%, rgba(140, 200, 11, 0.16), transparent 28rem),
    radial-gradient(circle at 85% 18%, rgba(255, 106, 0, 0.14), transparent 24rem),
    linear-gradient(180deg, rgba(5, 5, 5, 0.06), rgba(255, 106, 0, 0.06) 280px, transparent 520px),
    var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 92px auto auto 50%;
  z-index: -1;
  width: min(760px, 82vw);
  aspect-ratio: 1;
  background: url("../assets/trailblazer-logo.png") center / contain no-repeat;
  opacity: 0.045;
  transform: translateX(-50%);
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 253, 246, 0.22);
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(12px);
  padding: 11px 30px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fffdf6;
  font-weight: 950;
  text-decoration: none;
}

.brand-link img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.site-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.site-links a {
  border: 1px solid rgba(255, 253, 246, 0.38);
  border-radius: 999px;
  padding: 8px 12px;
  color: #fffdf6;
  font-size: 0.88rem;
  font-weight: 850;
  text-decoration: none;
}

.site-links a.active,
.site-links a:hover,
.site-links a:focus-visible {
  background: var(--lime);
  color: var(--field-dark);
  outline: 0;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  border-radius: 8px;
  padding: 24px;
  background: linear-gradient(135deg, #050505, #253707 58%, #ff6a00);
  color: #fffdf6;
  box-shadow: var(--shadow);
}

.topbar p {
  margin: 6px 0 0;
  color: #efe8d4;
  font-weight: 700;
}

.eyebrow {
  display: block;
  margin: 0 0 4px;
  color: var(--lime);
  font-size: 0.8rem;
  font-weight: 950;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.28rem;
}

.dashboard-logo {
  width: clamp(90px, 11vw, 140px);
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.42));
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.home-link,
.feedback-button,
.version-note,
.top-actions button {
  border: 1px solid rgba(140, 200, 11, 0.42);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.94);
  padding: 10px 14px;
  color: var(--field-dark);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
}

.dashboard-intro,
.tool-info-bar,
.summary-strip,
.calculator-grid,
.results-grid,
.site-footer {
  margin-top: 16px;
}

.dashboard-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.62fr);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 5px solid var(--orange);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.96);
  box-shadow: var(--shadow);
  padding: 16px;
}

.dashboard-intro span {
  display: block;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.dashboard-intro strong {
  display: block;
  margin-top: 5px;
  color: var(--field-dark);
  font-size: clamp(1.05rem, 1.5vw, 1.36rem);
  line-height: 1.25;
}

.dashboard-intro p {
  margin: 0;
  border-left: 4px solid var(--lime);
  padding-left: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.4;
}

.tool-info-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: start;
}

.how-to-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.96);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.how-to-card summary {
  cursor: pointer;
  color: var(--field-dark);
  font-weight: 950;
}

.how-to-card ol {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-weight: 720;
  line-height: 1.45;
}

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

.summary-tile,
.panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.summary-tile {
  min-height: 104px;
  padding: 16px;
  border-top: 4px solid var(--lime);
  background: linear-gradient(180deg, #fffdf6, #f8f2de);
}

.summary-tile.loss {
  border-top-color: var(--orange);
}

.summary-tile.good {
  border-top-color: var(--field);
}

.summary-tile span,
.result-card span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-tile strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.2rem, 2vw, 1.85rem);
  font-weight: 950;
  line-height: 1.08;
}

.summary-tile.good strong {
  color: var(--profit-green);
  text-shadow: 0 0 5px rgba(31, 143, 46, 0.18);
}

.summary-tile.loss strong {
  color: var(--loss-red);
  text-shadow: 0 0 10px rgba(215, 25, 32, 0.22);
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.step-panel {
  position: relative;
  overflow: visible;
}

.step-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 8px 0 0 8px;
  background: var(--lime);
}

.step-field::before,
.step-hay::before {
  background: var(--field);
}

.step-revenue::before,
.step-haul::before {
  background: var(--orange);
}

.step-costs::before,
.step-fuel::before,
.step-target::before {
  background: #c8a01e;
}

.wide-panel {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.section-title h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
}

.section-title h2 span {
  display: inline-grid;
  place-items: center;
  min-width: 62px;
  border-radius: 999px;
  background: var(--field-dark);
  padding: 5px 9px;
  color: #fffdf6;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

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

.profile-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto auto;
  gap: 10px;
  align-items: end;
}

.compact-profile {
  grid-template-columns: minmax(160px, 0.8fr) minmax(180px, 1fr) auto auto;
  margin-bottom: 12px;
}

.profile-controls button {
  min-height: 44px;
  border: 1px solid rgba(95, 135, 10, 0.54);
  border-radius: 7px;
  background: #fffdf0;
  color: var(--field-dark);
  padding: 0 12px;
  font-weight: 900;
}

.profile-controls button:hover,
.profile-controls button:focus-visible {
  background: var(--field-soft);
  outline: 0;
}

.status-note {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--field);
  font-size: 0.88rem;
  font-weight: 850;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

[hidden],
.is-hidden {
  display: none !important;
}

input,
select,
textarea {
  min-height: 44px;
  width: 100%;
  border: 1px solid rgba(31, 95, 47, 0.24);
  border-radius: 7px;
  background: #fffdf0;
  color: var(--ink);
  padding: 0 12px;
}

textarea {
  min-height: 74px;
  padding: 10px 12px;
  resize: vertical;
}

.help-button {
  position: relative;
  display: inline-grid;
  width: 28px;
  height: 22px;
  min-height: 0;
  place-items: center;
  border: 2px solid #c2a83a;
  border-radius: 5px;
  background:
    linear-gradient(0deg, rgba(116, 91, 0, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116, 91, 0, 0.18) 1px, transparent 1px),
    #f5df70;
  background-size: 100% 7px, 9px 100%, auto;
  box-shadow: 0 1px 3px rgba(22, 26, 20, 0.18);
  color: #050505;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
  vertical-align: middle;
}

.help-button::after {
  content: attr(data-help);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  z-index: 160;
  width: min(280px, 72vw);
  border: 1px solid rgba(22, 26, 20, 0.18);
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: 0 12px 28px rgba(22, 26, 20, 0.22);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.help-button:hover::after,
.help-button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
}

.unit-input input {
  border-radius: 7px 0 0 7px;
}

.unit-input span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 7px 7px 0;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
  align-items: end;
}

.check-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid rgba(31, 95, 47, 0.18);
  border-radius: 7px;
  background: #fffdf0;
  padding: 0 12px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.panel-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.4;
}

.section-title + .panel-note {
  margin-top: 0;
  margin-bottom: 12px;
}

.hay-cut-grid {
  display: grid;
  gap: 12px;
}

.cut-entry-controls {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.cut-entry-controls button {
  min-height: 44px;
  border: 1px solid rgba(95, 135, 10, 0.54);
  border-radius: 7px;
  background: #fffdf0;
  padding: 0 12px;
  color: var(--field-dark);
  font-weight: 900;
}

.hay-cut-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.cut-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--field-dark);
  font-size: 1rem;
  font-weight: 950;
}

.cut-toggle input {
  width: auto;
  min-height: auto;
}

.hay-unit-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.unit-toggle {
  display: flex;
  width: auto;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(95, 135, 10, 0.36);
  border-radius: 7px;
  background: #fffdf0;
  padding: 8px 11px;
  color: var(--field-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.unit-toggle input {
  width: 17px;
  min-height: 17px;
}

.unit-toggle:has(input:checked) {
  border-color: rgba(95, 135, 10, 0.72);
  background: var(--field-soft);
}

.hay-unit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.unit-empty-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.cut-note {
  margin-top: 12px;
}

.hay-unit-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf0;
  padding: 10px;
}

.hay-unit-entry strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.86rem;
}

.hay-unit-entry label {
  margin-top: 8px;
}

.cut-summary {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-weight: 750;
}

.cut-summary p {
  margin: 0 0 7px;
}

.year-progress {
  display: grid;
  grid-template-columns: 1.1fr repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.progress-card {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.94);
  box-shadow: var(--shadow);
  padding: 13px;
}

.progress-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.progress-card strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 1.05rem;
}

.progress-card.entered {
  border-top: 4px solid var(--field);
}

.progress-card.open,
.progress-card.selected {
  border-top: 4px solid var(--orange);
}

.progress-card.empty {
  opacity: 0.72;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
}

.result-card {
  padding: 16px;
}

.result-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.4vw, 2.2rem);
}

.result-card > strong {
  font-weight: 950;
}

.result-card.good > strong {
  color: var(--profit-green);
  text-shadow: 0 0 6px rgba(31, 143, 46, 0.2);
}

.result-card.loss > strong {
  color: var(--loss-red);
  text-shadow: 0 0 12px rgba(215, 25, 32, 0.24);
}

.breakdown {
  display: grid;
  gap: 8px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  color: var(--muted);
  font-weight: 800;
}

.breakdown-row:last-child {
  border-bottom: 0;
}

.breakdown-row strong {
  color: var(--ink);
}

.unit-economics {
  margin-top: 14px;
}

.hay-year-table {
  display: grid;
  gap: 0;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hay-year-head,
.hay-year-row {
  display: grid;
  grid-template-columns: 0.7fr 1.5fr 0.8fr 1.4fr;
  gap: 10px;
  padding: 9px 10px;
}

.hay-year-head {
  background: var(--field-dark);
  color: #fffdf6;
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.hay-year-row {
  background: #fffdf0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.site-footer {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .topbar,
  .dashboard-intro,
  .tool-info-bar,
  .profile-controls,
  .compact-profile,
  .cut-entry-controls,
  .calculator-grid,
  .results-grid,
  .year-progress {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 640px) {
  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 11px 16px;
  }

  .app-shell {
    width: min(100% - 22px, 1420px);
  }

  .form-grid,
  .cost-grid,
  .summary-strip,
  .hay-unit-grid,
  .hay-year-head,
  .hay-year-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  body::before,
  .site-nav,
  .top-actions,
  .tool-info-bar,
  .help-button {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .panel,
  .summary-tile,
  .result-card,
  .progress-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
