:root {
  --bg: #f7f7f7;
  --paper: #ffffff;
  --ink: #050505;
  --muted: #606060;
  --line: #e1e1e1;
  --line-dark: #111111;
  --soft: #f2f2f2;
  --green: #0f7a43;
  --red: #a22d2d;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.condition-note {
  margin: 14px 0 0;
  padding: 12px;
  color: #333;
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 68px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand,
.app-header nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  background: #000;
  border-radius: 6px;
}

.app-header nav {
  gap: 4px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.app-header nav a {
  padding: 9px 12px;
  color: #333;
  border-radius: 6px;
  font-size: 14px;
}

.app-header nav a:hover {
  background: var(--soft);
}

.black-button {
  justify-self: end;
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: #000;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(440px, 0.92fr) minmax(520px, 1.08fr);
  gap: 24px;
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px;
}

.left-pane,
.right-pane {
  min-width: 0;
}

.intro,
.input-section,
.report-paper {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.intro {
  padding: 28px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 16px;
  font-size: 52px;
  line-height: 0.98;
  letter-spacing: 0;
}

.intro p {
  max-width: 820px;
  margin-bottom: 0;
  color: #3f3f3f;
  font-size: 17px;
  line-height: 1.55;
}

.input-section {
  padding: 22px;
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 18px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

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

label {
  display: grid;
  gap: 7px;
  color: #333;
  font-size: 13px;
  font-weight: 620;
}

.price-preview {
  align-self: end;
  min-height: 42px;
  padding: 10px 11px;
  color: #333;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.35;
}

.price-preview strong {
  display: block;
  color: #000;
  font-size: 14px;
}

.price-preview span {
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:focus,
select:focus {
  outline: 2px solid #000;
  outline-offset: 1px;
}

.source-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.source-item,
.metric-row > div,
.payment-item,
.evidence-item,
.comparison-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.source-item {
  padding: 12px;
}

.source-item span,
.metric-row span,
.payment-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.source-item a {
  display: inline-block;
  margin-top: 7px;
  border-bottom: 1px solid #000;
  font-size: 13px;
  font-weight: 650;
}

.right-pane {
  position: sticky;
  top: 92px;
  align-self: start;
}

.report-paper {
  padding: 28px;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-dark);
}

.report-header h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

#reportDate {
  color: var(--muted);
  white-space: nowrap;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.metric-row > div {
  padding: 15px;
}

.metric-row strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.1;
}

.report-section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.report-section:first-of-type {
  border-top: 0;
}

.report-section h3 {
  margin-bottom: 12px;
  font-size: 17px;
  letter-spacing: 0;
}

.report-section p {
  color: #333;
  line-height: 1.58;
}

table {
  width: 100%;
  border-collapse: collapse;
}

td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

td:last-child {
  text-align: right;
  font-weight: 680;
}

.chart-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#roiChart {
  display: block;
  width: 100%;
  min-height: 280px;
  background: #fff;
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

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

.comparison-card {
  padding: 15px;
}

.comparison-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.comparison-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.comparison-card p {
  margin: 8px 0 0;
  color: #444;
  font-size: 13px;
  line-height: 1.45;
}

.comparison-card.busbar {
  border-color: rgba(15, 122, 67, 0.45);
}

.comparison-card.cableReel {
  border-color: rgba(0, 0, 0, 0.45);
}

.payment-item {
  padding: 12px;
}

.payment-item strong {
  display: block;
  margin-top: 6px;
}

.evidence-list {
  display: grid;
  gap: 8px;
}

.evidence-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.evidence-item p {
  margin: 0;
  font-size: 14px;
}

.evidence-item a {
  border-bottom: 1px solid #000;
  font-size: 13px;
  font-weight: 650;
}

.axis {
  stroke: #111;
  stroke-width: 1;
}

.grid-line {
  stroke: #e7e7e7;
  stroke-width: 1;
}

.investment-line {
  fill: none;
  stroke: var(--red);
  stroke-width: 3;
}

.saving-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
}

.chart-label {
  fill: #555;
  font-size: 12px;
}

.bubble-title {
  fill: #111;
  font-size: 13px;
  font-weight: 700;
}

.bubble-value {
  fill: #fff;
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .right-pane {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .app-header nav {
    overflow-x: auto;
  }

  .black-button {
    justify-self: start;
  }

  .workspace {
    padding: 14px;
  }

  h1 {
    font-size: 38px;
  }

  .form-grid,
  .source-strip,
  .metric-row,
  .comparison-grid,
  .payment-grid {
    grid-template-columns: 1fr;
  }
}

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

  .app-header,
  .left-pane {
    display: none;
  }

  .workspace {
    display: block;
    max-width: none;
    padding: 0;
  }

  .right-pane {
    position: static;
  }

  .report-paper {
    border: 0;
    padding: 0;
  }
}
