:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --bg-strong: #e9f0ee;
  --surface: #ffffff;
  --surface-soft: #f8fbfa;
  --surface-warm: #fbf7f2;
  --ink: #151a1d;
  --ink-soft: #314046;
  --muted: #69787e;
  --line: #d9e2df;
  --line-strong: #c6d4d1;
  --teal: #0e877b;
  --teal-dark: #075d55;
  --brick: #b3543f;
  --gold: #c99432;
  --blue: #245e78;
  --shadow-sm: 0 6px 18px rgba(21, 26, 29, 0.07);
  --shadow-md: 0 18px 46px rgba(21, 26, 29, 0.1);
  --shadow-focus: 0 0 0 4px rgba(14, 135, 123, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 320px;
  background: linear-gradient(180deg, #eef5f3 0%, rgba(244, 247, 246, 0) 100%);
  content: "";
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px 40px;
  border-bottom: 1px solid rgba(217, 226, 223, 0.82);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 88px;
  height: 50px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.primary-button {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 12px 24px rgba(14, 135, 123, 0.2);
}

.primary-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.ghost-button {
  color: var(--teal-dark);
  background: #eef6f4;
  border-color: #cde0dc;
}

.ghost-button:hover {
  background: #e4f0ed;
  border-color: #b8d2cd;
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.print-masthead {
  display: none;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(330px, 0.86fr) minmax(620px, 1.14fr);
  gap: 28px;
  align-items: end;
  padding: 28px 0 26px;
}

.summary-copy {
  min-width: 0;
}

.summary-copy h1,
.section-heading h2,
.result-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.summary-copy h1 {
  max-width: 720px;
  font-size: 3.45rem;
  font-weight: 850;
  line-height: 1.02;
}

.summary-copy p:last-child {
  max-width: 660px;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brick);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.kpi-card {
  position: relative;
  min-height: 120px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.kpi-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--teal);
  content: "";
}

.kpi-card:nth-child(2)::before {
  background: var(--brick);
}

.kpi-card:nth-child(3)::before {
  background: var(--gold);
}

.kpi-card:nth-child(4)::before {
  background: var(--blue);
}

.kpi-card span,
.metric-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.kpi-card strong {
  display: block;
  margin-top: 18px;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 850;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 470px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.input-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-md);
}

.input-panel {
  position: sticky;
  top: 100px;
  padding: 24px;
}

.results-panel {
  padding: 24px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.section-heading h2,
.result-header h2 {
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 830;
  line-height: 1.2;
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #35454a;
  font-size: 0.82rem;
  font-weight: 780;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

select {
  appearance: auto;
}

input::placeholder {
  color: #8a969a;
}

input:hover,
select:hover {
  border-color: #adc5c0;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: var(--shadow-focus);
}

.corner-grid {
  display: grid;
  grid-template-columns: 96px repeat(6, minmax(54px, 1fr));
  gap: 6px;
  overflow-x: auto;
  padding: 1px 1px 4px;
}

.corner-head,
.corner-row.label,
.corner-cell {
  min-width: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.corner-head {
  padding: 8px 6px;
  color: var(--ink-soft);
  background: #edf5f3;
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.corner-row.label {
  display: flex;
  align-items: center;
  min-width: 96px;
  padding: 8px;
  color: var(--teal-dark);
  background: #f4faf8;
  font-size: 0.76rem;
  font-weight: 850;
}

.corner-cell {
  display: grid;
  gap: 6px;
  padding: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 0.72rem;
  text-align: center;
}

.corner-cell input {
  min-height: 36px;
  padding: 6px;
  text-align: right;
}

.result-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.date-chip {
  flex: 0 0 auto;
  border: 1px solid #cde0dc;
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--teal-dark);
  background: #f2faf8;
  font-size: 0.84rem;
  font-weight: 850;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.offer-wrap {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 13px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #203136;
  background: #e7f0ed;
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

tbody td {
  color: #172126;
}

tbody tr:nth-child(even):not(.section-row) td {
  background: #fbfdfc;
}

tbody tr:hover td {
  background: #f5faf8;
}

.muted-row td {
  color: #839297;
}

.section-row td {
  color: var(--teal-dark);
  background: #f1f8f6;
  font-weight: 850;
  text-align: left;
}

tfoot td {
  border-bottom: 0;
  color: #fff;
  background: var(--teal-dark);
  font-size: 1rem;
  font-weight: 900;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.metric-item {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.metric-item strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 830;
  overflow-wrap: anywhere;
}

.price-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.price-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 15px 16px;
  color: var(--teal-dark);
  font-weight: 900;
  cursor: pointer;
}

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

.price-grid h3 {
  margin: 4px 0 10px;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.table-wrap.small table {
  min-width: 520px;
  font-size: 0.85rem;
}

.table-wrap.small th,
.table-wrap.small td {
  padding: 8px 9px;
}

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

.product-strip img {
  width: 100%;
  aspect-ratio: 5 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 1240px) {
  .summary-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .summary-copy h1 {
    font-size: 3rem;
  }

  .input-panel {
    position: static;
  }
}

@media (max-width: 980px) {
  .topbar {
    padding-right: 24px;
    padding-left: 24px;
  }

  .kpi-grid,
  .metric-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .price-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  main {
    width: min(100% - 20px, 1480px);
    padding-top: 18px;
    padding-bottom: 34px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
    padding: 12px 14px;
  }

  .brand {
    gap: 10px;
  }

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

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }

  .summary-band {
    gap: 20px;
    padding-top: 18px;
  }

  .summary-copy h1 {
    font-size: 2.28rem;
  }

  .summary-copy p:last-child {
    font-size: 0.98rem;
  }

  .kpi-grid,
  .field-grid,
  .metric-list,
  .product-strip {
    grid-template-columns: 1fr;
  }

  .input-panel,
  .results-panel {
    padding: 16px;
  }

  .result-header {
    align-items: stretch;
    flex-direction: column;
  }

  .date-chip {
    width: fit-content;
  }
}

@media (max-width: 440px) {
  .summary-copy h1 {
    font-size: 2rem;
  }

  .kpi-card {
    min-height: 104px;
  }

  .kpi-card strong {
    font-size: 1.34rem;
  }

  .primary-button,
  .ghost-button {
    padding: 0 12px;
  }
}

@media print {
  @page {
    margin: 14mm;
  }

  :root {
    --line: #cfd8d5;
    --shadow-sm: none;
    --shadow-md: none;
  }

  html,
  body {
    background: #fff;
  }

  body {
    color: #111;
    font-size: 10pt;
  }

  body::before,
  .topbar,
  .input-panel,
  .product-strip,
  .price-details {
    display: none;
  }

  main {
    width: 100%;
    padding: 0;
  }

  .print-masthead {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10mm;
    padding-bottom: 6mm;
    border-bottom: 2px solid #0b6259;
  }

  .print-masthead img {
    width: 28mm;
    height: auto;
  }

  .print-masthead strong,
  .print-masthead span {
    display: block;
  }

  .print-masthead strong {
    font-size: 16pt;
  }

  .print-masthead span {
    color: #566;
    font-size: 9pt;
  }

  .summary-band,
  .workspace {
    display: block;
  }

  .summary-band {
    padding: 0 0 8mm;
  }

  .summary-copy {
    margin-bottom: 6mm;
  }

  .summary-copy h1 {
    font-size: 21pt;
    line-height: 1.15;
  }

  .summary-copy p:last-child {
    margin-top: 3mm;
    color: #333;
    font-size: 9pt;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .kpi-card {
    min-height: 25mm;
    padding: 4mm;
    box-shadow: none;
    break-inside: avoid;
  }

  .kpi-card strong {
    margin-top: 3mm;
    font-size: 13pt;
  }

  .results-panel {
    padding: 0;
    border: 0;
    background: #fff;
    box-shadow: none;
    overflow: visible;
  }

  .result-header {
    margin-bottom: 5mm;
  }

  .date-chip {
    background: #fff;
  }

  .table-wrap {
    overflow: visible;
    border-radius: 0;
  }

  table {
    min-width: 0;
    font-size: 8.5pt;
  }

  th,
  td {
    padding: 2.3mm 2mm;
  }

  thead th {
    position: static;
    background: #eaf1ef !important;
  }

  tbody tr:hover td {
    background: inherit;
  }

  .metric-list {
    grid-template-columns: repeat(4, 1fr);
    margin-top: 6mm;
    break-inside: avoid;
  }

  .metric-item {
    min-height: 18mm;
    padding: 3mm;
    background: #fff;
  }
}
