: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;

  --suitable: #287a46;
  --suitable-soft: #edf8f1;

  --warning: #9a6400;
  --warning-soft: #fff7df;

  --insufficient: #bf1922;
  --insufficient-soft: #fdf2f2;

  --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(1440px, 100%);
  margin: 0 auto;
  padding: 32px;
}

/* Typography */

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: 750;
  line-height: 1.2;
}

h3 {
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 750;
  line-height: 1.3;
}

p {
  margin-bottom: 0;
  color: var(--muted);
}

/* Main layout */

.layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1.55fr)
    minmax(350px, 0.75fr);
  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: 26px;
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header p {
  max-width: 720px;
}

/* Calculator sections */

.camera-configuration,
.calculation-settings {
  min-width: 0;
}

.calculation-settings {
  padding-top: 24px;
  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 labels and 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;
}

/* Range and number input pairs */

.slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
  align-items: center;
}

.slider-row input[type="number"] {
  text-align: center;
}

input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: #d9d5cf;
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  appearance: none;
  background: var(--primary);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(29, 37, 71, 0.25);
}

input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow:
    0 0 0 3px rgba(191, 25, 34, 0.16),
    0 1px 4px rgba(29, 37, 71, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: #d9d5cf;
  border: 0;
  border-radius: 999px;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--primary);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(29, 37, 71, 0.25);
}

input[type="range"]:focus::-moz-range-thumb {
  box-shadow:
    0 0 0 3px rgba(191, 25, 34, 0.16),
    0 1px 4px rgba(29, 37, 71, 0.25);
}

/* Input unit wrapper */

.input-with-unit {
  position: relative;
}

.input-with-unit span {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
  transform: translateY(-50%);
}

.input-with-unit:has(span) input {
  padding-right: 62px;
}

/* Scene activity guidance */

.scene-complexity-help {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  color: var(--text);
  background: var(--panel-soft);
  border-left: 4px solid var(--primary);
  border-radius:
    0
    var(--radius-small)
    var(--radius-small)
    0;
  font-size: 0.86rem;
  line-height: 1.55;
}

.scene-complexity-help strong {
  color: var(--heading);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
}

.scene-complexity-help span {
  display: block;
  color: var(--muted);
}

/* Results panel */

.results-panel {
  position: sticky;
  top: 24px;
}

.results-panel > h2 {
  margin-bottom: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-card,
.summary-card {
  min-width: 0;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.result-card {
  background: #fffdfb;
}

.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-weight: 700;
}

.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.35rem, 2vw, 1.85rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.summary-card {
  margin-top: 16px;
  background: #fffdfb;
}

.summary-card h3 {
  margin-bottom: 8px;
}

.table-introduction {
  margin-bottom: 16px;
  font-size: 0.84rem;
  line-height: 1.55;
}

/* Ethernet utilisation table */

.utilisation-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.utilisation-table {
  width: 100%;
  min-width: 240px;
  border-collapse: collapse;
  background: #ffffff;
}

.utilisation-table th,
.utilisation-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  line-height: 1.4;
}

.utilisation-table thead th {
  color: var(--heading);
  background: var(--panel-soft);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
  font-weight: 750;
  text-align: left;
}

.utilisation-table thead th:last-child {
  text-align: right;
}

.utilisation-table tbody th {
  color: var(--heading);
  font-weight: 700;
  text-align: left;
}

.utilisation-table tbody td {
  color: var(--heading);
  font-weight: 750;
  text-align: right;
}

.utilisation-table tr:last-child th,
.utilisation-table tr:last-child td {
  border-bottom: 0;
}

/* Utilisation status cells */

.utilisation-suitable {
  color: var(--suitable) !important;
  background: var(--suitable-soft);
}

.utilisation-warning {
  color: var(--warning) !important;
  background: var(--warning-soft);
}

.utilisation-insufficient {
  color: var(--insufficient) !important;
  background: var(--insufficient-soft);
}

/* Utilisation key */

.utilisation-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 15px;
}

.utilisation-key > span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.status-indicator {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-suitable {
  background: var(--suitable);
}

.status-warning {
  background: var(--warning);
}

.status-insufficient {
  background: var(--insufficient);
}

/* Results branding */

.results-branding {
  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;
}

/* Engineering disclaimer */

.recommendation-helper {
  margin-top: 14px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Buttons retained for reuse */

.btn {
  min-height: 42px;
  padding: 10px 16px;
  color: var(--heading);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  color: var(--primary);
  background: #ffffff;
  border-color: var(--primary);
}

.btn-secondary:hover {
  background: var(--primary-soft);
}

.btn-muted {
  color: var(--text);
  background: var(--panel-soft);
  border-color: var(--border);
}

/* Tablet */

@media (max-width: 1040px) {
  .app {
    padding: 24px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .results-panel {
    position: static;
    order: -1;
  }

  .panel {
    padding: 26px;
  }
}

/* Mobile */

@media (max-width: 680px) {
  .app {
    padding: 16px;
  }

  h1 {
    font-size: 2rem;
  }

  .panel {
    padding: 20px;
    border-radius: 14px;
  }

  .form-grid,
  .result-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .slider-row {
    grid-template-columns: minmax(0, 1fr) 82px;
  }

  .utilisation-key {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 420px) {
  .utilisation-table th,
  .utilisation-table td {
    padding: 11px 12px;
    font-size: 0.82rem;
  }

  .result-card strong {
    font-size: 1.35rem;
  }
}