:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #5c6a61;
  --line: #d9e2dc;
  --green: #2f6f4e;
  --green-dark: #1e4f36;
  --amber: #9a6115;
  --red: #a13b2b;
  --shadow: 0 18px 45px rgba(31, 53, 40, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 40px min(5vw, 64px);
  background:
    linear-gradient(135deg, rgba(47, 111, 78, 0.95), rgba(23, 33, 27, 0.92)),
    radial-gradient(circle at top right, rgba(246, 226, 173, 0.4), transparent 40%);
  color: #fff;
}

.hero h1 {
  margin: 6px 0 12px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.manual-link {
  display: inline-flex;
  align-items: center;
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
  text-decoration: none;
}

.manual-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-card {
  align-self: end;
  min-width: 260px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.hero-card span,
.hero-card strong {
  display: block;
}

.hero-card span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.85rem;
}

main {
  width: min(1800px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.panel,
.metrics article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px;
}

.manual {
  margin-bottom: 16px;
  overflow: hidden;
}

.manual summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  background: #eef4f0;
  color: var(--green-dark);
  font-weight: 900;
  list-style: none;
}

.manual summary::-webkit-details-marker {
  display: none;
}

.manual summary::after {
  content: "Hide";
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.manual:not([open]) summary::after {
  content: "Show";
}

.manual summary span {
  font-size: 1.15rem;
}

.manual summary small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.manual-body {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding: 20px 22px 22px;
}

.manual-body h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--green-dark);
}

.manual-body ol,
.manual-body ul {
  margin: 0;
  padding-left: 20px;
}

.manual-body li {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

.manual-body dl {
  margin: 0;
}

.manual-body dt {
  margin-top: 10px;
  color: var(--ink);
  font-weight: 900;
}

.manual-body dt:first-child {
  margin-top: 0;
}

.manual-body dd {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}

input,
select {
  min-width: 110px;
  background: #fbfcfb;
  color: var(--ink);
}

button {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  border-color: var(--line);
  background: #eef4f0;
  color: var(--green-dark);
}

button:hover {
  filter: brightness(0.96);
}

#status {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.metrics article {
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 16px 0;
  overflow: hidden;
}

.workflow-strip article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.workflow-strip article:last-child {
  border-right: 0;
}

.workflow-strip strong,
.workflow-strip small {
  grid-column: 2;
}

.workflow-strip strong {
  color: var(--green-dark);
}

.workflow-strip small {
  color: var(--muted);
  line-height: 1.35;
}

.step-number {
  grid-row: 1 / span 2;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  font-size: 0.82rem;
}

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

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-title {
  padding: 18px 18px 0;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.1rem;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.section-title p strong {
  color: var(--ink);
}

.help-note {
  padding: 10px 12px;
  border: 1px solid #f0d9a8;
  border-radius: 12px;
  background: #fff7e8;
}

.grid-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grid-badge.input {
  background: #e8f1ff;
  color: #244f86;
}

.grid-badge.decision {
  background: #fff1dc;
  color: #8a5310;
}

.grid-badge.output {
  background: #eaf5ee;
  color: var(--green-dark);
}

.grid-badge.actuals {
  background: #f5eefe;
  color: #5a3d83;
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
  padding: 14px 18px 18px;
  scrollbar-color: var(--green) #eef4f0;
}

.table-wrap.tall {
  max-height: 680px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4f0;
  color: var(--green-dark);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: #fafcf9;
}

td input,
td select {
  width: 78px;
  min-width: 68px;
  min-height: 32px;
  padding: 5px 7px;
}

.wide-input {
  width: 140px;
}

.money,
.number {
  text-align: right;
}

.ok {
  color: var(--green-dark);
  font-weight: 700;
}

.warn {
  color: var(--amber);
  font-weight: 700;
}

.bad {
  color: var(--red);
  font-weight: 700;
}

.lot-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 18px;
}

.lot-form input,
.lot-form select,
.lot-form button {
  width: 100%;
}

@media (max-width: 1100px) {
  .hero,
  .grid.two,
  .metrics,
  .workflow-strip,
  .manual-body {
    grid-template-columns: 1fr;
  }

  .workflow-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workflow-strip article:last-child {
    border-bottom: 0;
  }

  .hero {
    display: grid;
  }

  .hero-card {
    align-self: stretch;
  }
}

@media (max-width: 700px) {
  main {
    width: calc(100% - 16px);
  }

  .lot-form {
    grid-template-columns: 1fr;
  }
}
