:root {
  --bg: #eef3e8;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --text: #1e2a22;
  --muted: #586558;
  --line: rgba(34, 61, 45, 0.12);
  --brand: #1e3a8a;
  --brand-soft: #dbe7ff;
  --accent: #1d6b4f;
  --accent-soft: #dff4ea;
  --shadow: 0 22px 50px rgba(34, 61, 45, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(29, 107, 79, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(30, 58, 138, 0.14), transparent 26%),
    linear-gradient(135deg, #f7faf4 0%, var(--bg) 48%, #e8efe4 100%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel-form {
  padding: 34px;
}

.panel-result {
  position: relative;
  overflow: hidden;
  padding: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 244, 0.95)),
    linear-gradient(140deg, rgba(30, 58, 138, 0.08), rgba(29, 107, 79, 0.1));
}

.panel-result::before {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 107, 79, 0.14), transparent 70%);
}

.panel-header h1,
.result-card h2 {
  margin: 0;
  line-height: 1.12;
}

.panel-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  max-width: 12ch;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.intro {
  margin: 18px 0 0;
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.65;
}

.calculator-form {
  margin-top: 32px;
  display: grid;
  gap: 18px;
}

.field,
.toggle {
  display: grid;
  gap: 10px;
}

.field span:first-child,
.toggle span {
  font-weight: 600;
}

.input-wrap {
  position: relative;
}

input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 74px 16px 16px;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel-strong);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input[type="number"]:focus {
  outline: none;
  border-color: rgba(30, 58, 138, 0.4);
  box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
  transform: translateY(-1px);
}

input[type="number"]:disabled {
  color: #8f9991;
  background: #f3f5f3;
}

.currency {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
}

.toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.actions {
  margin-top: 8px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
}

.button-secondary {
  color: var(--text);
  background: #e8eee7;
}

.button-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), #285db8);
  box-shadow: 0 12px 24px rgba(30, 58, 138, 0.22);
}

.result-brand {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 34px;
  min-height: 72px;
}

.result-brand img {
  display: block;
  width: min(220px, 48%);
  max-width: 220px;
  height: auto;
}

.result-card {
  position: relative;
  z-index: 1;
  padding: 28px;
  border-radius: calc(var(--radius-xl) - 6px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(29, 107, 79, 0.08);
}

.result-grid {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.metric {
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--brand-soft);
}

.metric.neutral {
  background: #eef2f0;
}

.metric.accent {
  background: var(--accent-soft);
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.metric strong {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.explanation {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.explanation h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.explanation p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.result-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
}

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

  .page-shell {
    width: 100%;
    margin: 0;
    display: block;
  }

  .panel-form,
  .actions,
  .result-actions {
    display: none;
  }

  .panel,
  .panel-result,
  .result-card {
    box-shadow: none;
    border: 0;
    background: #ffffff;
    padding: 0;
  }

  .panel-result::before {
    display: none;
  }

  .result-brand {
    margin-bottom: 18px;
  }
}

@media (max-width: 900px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .panel-form,
  .panel-result {
    padding: 22px;
  }

  .result-brand img {
    width: min(150px, 42%);
  }
}

@media (max-width: 540px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    margin: 12px auto 24px;
    gap: 14px;
  }

  .panel-form,
  .panel-result,
  .result-card {
    border-radius: 22px;
  }

  .panel-header h1 {
    max-width: none;
    font-size: 1.9rem;
  }

  .result-brand {
    margin-bottom: 18px;
  }
}
