:root {
  --primary: #bf1922;
  --primary-dark: #99131b;
  --primary-soft: #fdf2f2;

  --heading: #1d2547;
  --text: #3c4657;
  --muted: #535e71;

  --background: #fbf8f3;
  --panel: #ffffff;
  --panel-soft: #f8f4ef;

  --border: #e2ddd5;
  --border-strong: #d4cec5;

  --shadow: 0 12px 32px rgba(29, 37, 71, 0.08);

  --radius: 18px;
  --radius-small: 12px;

  --space-small: 12px;
  --space-medium: 20px;
  --space-large: 32px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 32px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--heading);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 3vw, 2.65rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

h3 {
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

p {
  margin-bottom: 0;
  color: var(--muted);
}

/* --------------------------------------------------
   MAIN LAYOUT
--------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1.45fr)
    minmax(420px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: var(--space-large);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.calculator-panel {
  display: grid;
  gap: 28px;
}

.results-panel {
  position: sticky;
  top: 24px;
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header h2 {
  margin-bottom: 8px;
}

.panel-header p {
  max-width: 760px;
}

/* --------------------------------------------------
   INPUT SECTIONS
--------------------------------------------------- */

.input-section,
.calculation-method {
  min-width: 0;
}

.section-divider {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

.full-width {
  grid-column: 1 / -1;
}

/* --------------------------------------------------
   FORM CONTROLS
--------------------------------------------------- */

label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--heading);
  font-size: 0.84rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

input:hover,
select:hover {
  border-color: #bdb6ad;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(191, 25, 34, 0.14);
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
}

/* --------------------------------------------------
   INFORMATION BOX
--------------------------------------------------- */

.information-box {
  padding: 20px;
  color: var(--text);
  background: var(--panel-soft);
  border-left: 4px solid var(--primary);
  border-radius:
    0
    var(--radius-small)
    var(--radius-small)
    0;
}

.information-box h3 {
  margin-bottom: 12px;
}

.information-box p {
  margin-bottom: 14px;
  line-height: 1.6;
}

.information-box p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------
   RESULT CARDS
--------------------------------------------------- */

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-card,
.summary-card {
  min-width: 0;
  padding: 18px;
  background: #fffdfb;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.result-card .icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  margin-bottom: 13px;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.result-card p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.result-card strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--heading);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

/* --------------------------------------------------
   SUMMARY CARD
--------------------------------------------------- */

.summary-card {
  margin-top: 16px;
}

.summary-card h3 {
  margin-bottom: 14px;
}

dl {
  display: grid;
  gap: 0;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

dl div:first-child {
  padding-top: 0;
}

dl div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 0.86rem;
}

dd {
  margin: 0;
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: right;
}

/* --------------------------------------------------
   OODPVCS RESULTS TABLE
--------------------------------------------------- */

.results-table-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.results-table-heading h3 {
  margin-bottom: 6px;
}

.results-table-heading p {
  margin-bottom: 18px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.results-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.results-table thead {
  background: var(--panel-soft);
}

.results-table th {
  padding: 12px;
  color: var(--heading);
  background: var(--panel-soft);
  border-bottom: 2px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  vertical-align: bottom;
}

.results-table td {
  padding: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
  text-align: left;
  vertical-align: top;
}

.results-table tbody tr:last-child td {
  border-bottom: 0;
}

.results-table tbody tr:hover {
  background: #fcfaf7;
}

.results-table tbody td:last-child {
  color: var(--heading);
  font-weight: 700;
}

.results-table tr.selected-row td {
  background: rgba(191, 25, 34, 0.08);
  font-weight: 700;
}

.results-table tr.selected-row td:first-child {
  box-shadow: inset 4px 0 0 var(--primary);
}

/* --------------------------------------------------
   RESULTS BRANDING
--------------------------------------------------- */

.results-branding {
  width: 100%;
  min-width: 0;
  margin-top: 20px;
  padding: 16px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.results-branding img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

/* --------------------------------------------------
   OPTIONAL HELP TEXT
--------------------------------------------------- */

.field-help {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------
   TABLET
--------------------------------------------------- */

@media (max-width: 1120px) {
  .app {
    padding: 24px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .results-panel {
    position: static;
    order: -1;
  }

  .panel {
    padding: 26px;
  }

  .results-table {
    min-width: 720px;
  }
}

/* --------------------------------------------------
   MOBILE
--------------------------------------------------- */

@media (max-width: 680px) {
  .app {
    padding: 16px;
  }

  .panel {
    padding: 20px;
    border-radius: 14px;
  }

  .calculator-panel {
    gap: 24px;
  }

  .section-divider {
    padding-top: 24px;
  }

  .form-grid,
  .result-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .full-width {
    grid-column: auto;
  }

  dl div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  dd {
    text-align: left;
  }

  .table-wrap {
    border-radius: 10px;
  }

  .results-table {
    min-width: 660px;
    font-size: 0.8rem;
  }

  .results-table th,
  .results-table td {
    padding: 10px;
  }

  .information-box {
    padding: 18px;
  }

  .results-branding {
    padding: 12px;
  }
}