:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #627083;
  --line: #d7dee8;
  --surface: #ffffff;
  --page: #f3f6f2;
  --accent: #2f6f5e;
  --accent-strong: #1f5346;
  --warm: #b86b2b;
  --danger: #a33a32;
  --shadow: 0 24px 70px rgba(23, 33, 43, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(47, 111, 94, 0.09), transparent 42%),
    linear-gradient(315deg, rgba(184, 107, 43, 0.1), transparent 38%),
    var(--page);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 24px;
  align-items: center;
}

.calculator,
.result-panel {
  background: var(--surface);
  border: 1px solid rgba(215, 222, 232, 0.85);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.calculator {
  padding: 32px;
}

.result-panel {
  min-height: 450px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro,
.result-header {
  margin-bottom: 28px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 680px;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 1;
}

h2 {
  font-size: 1.15rem;
}

.tool {
  display: grid;
  gap: 22px;
}

.input-type {
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: #eef3ef;
}

.input-type legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.input-type label {
  min-height: 48px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.input-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.input-type label:has(input:checked) {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(23, 33, 43, 0.08);
}

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

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 720;
}

.field input {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 111, 94, 0.14);
}

.rate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
}

.icon-button,
.primary,
.secondary {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  font-weight: 820;
  cursor: pointer;
}

.icon-button {
  min-height: 54px;
  color: #ffffff;
  background: var(--accent);
}

.icon-button:hover,
.primary:hover {
  background: var(--accent-strong);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary {
  flex: 1 1 260px;
  padding: 0 20px;
  color: #ffffff;
  background: var(--accent);
}

.secondary {
  flex: 0 0 110px;
  padding: 0 18px;
  color: var(--ink);
  background: #e7edf4;
}

.status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status.error {
  color: var(--danger);
}

.kernel-price {
  display: block;
  min-height: 96px;
  margin: 8px 0 28px;
  color: var(--accent-strong);
  font-size: clamp(3rem, 7vw, 5.8rem);
  font-weight: 850;
  line-height: 1;
}

.breakdown {
  margin: 0;
  border-top: 1px solid var(--line);
}

.breakdown div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.breakdown dt {
  color: var(--muted);
  font-weight: 680;
}

.breakdown dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
}

@media (max-width: 860px) {
  .shell {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .result-panel {
    min-height: 320px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 18px 0;
  }

  .calculator,
  .result-panel {
    padding: 20px;
  }

  .input-type,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary {
    width: 100%;
    flex-basis: auto;
  }
}
