:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #eef4f2;
  --text: #17211f;
  --muted: #66716e;
  --line: #d9e1df;
  --primary: #0f6b5f;
  --primary-dark: #0b4f47;
  --green: #16875f;
  --green-soft: #e7f6ef;
  --red: #c43d3d;
  --red-soft: #fdecec;
  --orange: #d67b13;
  --orange-soft: #fff3df;
  --shadow: 0 20px 50px rgba(25, 45, 41, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 107, 95, 0.12), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.subtitle {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 107, 95, 0.22);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 225, 223, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel,
.results-panel {
  padding: 24px;
}

.results-panel {
  position: sticky;
  top: 20px;
}

.section-heading h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
}

.section-heading p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

fieldset {
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

fieldset:last-child {
  margin-bottom: 0;
}

legend {
  padding: 0 8px;
  color: var(--primary-dark);
  font-weight: 900;
}

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

.field-wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #40504d;
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 107, 95, 0.12);
}

input[readonly] {
  background: #f7faf9;
  color: var(--primary-dark);
  font-weight: 900;
}

small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

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

.result-card {
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.result-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.result-card strong {
  align-self: end;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.05;
}

.status-positive {
  background: var(--green-soft);
  border-color: rgba(22, 135, 95, 0.35);
  color: var(--green);
}

.status-negative {
  background: var(--red-soft);
  border-color: rgba(196, 61, 61, 0.35);
  color: var(--red);
}

.status-warning {
  background: var(--orange-soft);
  border-color: rgba(214, 123, 19, 0.36);
  color: var(--orange);
}

.summary {
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  background: #17211f;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.55;
}

.saved-projects {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.saved-projects-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.saved-projects h3 {
  margin: 0;
  font-size: 1rem;
}

#saveStatus {
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: right;
}

.saved-list {
  display: grid;
  gap: 10px;
}

.saved-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.saved-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.saved-item strong,
.saved-item span {
  display: block;
}

.saved-item strong {
  overflow-wrap: anywhere;
}

.saved-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.saved-actions {
  display: flex;
  gap: 8px;
}

.mini-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.mini-button-danger {
  color: var(--red);
}

.details {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.details div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.details div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.details dt {
  color: var(--muted);
  font-weight: 800;
}

.details dd {
  margin: 0;
  text-align: right;
  font-weight: 900;
}

.hidden {
  display: none;
}

@media (max-width: 920px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    display: grid;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .results-panel {
    position: static;
  }
}

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

  .form-panel,
  .results-panel {
    padding: 18px;
  }

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

  fieldset {
    padding: 14px;
  }

  .button {
    width: 100%;
  }

  .saved-item {
    grid-template-columns: 1fr;
  }

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

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

  .app-shell {
    width: 100%;
    padding: 0;
  }

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

  .layout {
    display: block;
  }

  .panel {
    box-shadow: none;
  }
}
