:root {
  color-scheme: light;
  --bg: #f4f6f4;
  --panel: #ffffff;
  --ink: #18201d;
  --muted: #67736e;
  --line: #d8dfdb;
  --accent: #17724f;
  --accent-dark: #10583c;
  --good: #17724f;
}

* {
  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;
}

button {
  font: inherit;
}

.app {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
}

h3 {
  margin-bottom: 10px;
  font-size: 14px;
}

#statusText,
.summary,
.meta,
.collections,
.outcome,
.item-sub,
.empty {
  color: var(--muted);
}

.money-button {
  min-width: 220px;
  min-height: 64px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 800;
}

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

.money-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.progress-panel,
.results,
.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.progress-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

#elapsedText {
  color: var(--muted);
  margin-top: 4px;
}

.progress-percent {
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eae6;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 280ms ease;
}

.activity-log {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.results-head,
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.summary {
  text-align: right;
}

.cards {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.contract-card {
  display: grid;
  grid-template-columns: 54px minmax(150px, 220px) minmax(220px, 1fr);
  gap: 8px 14px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.contract-card:hover {
  border-color: #aebbb5;
  background: #fff;
}

.rank {
  grid-row: span 2;
  color: var(--muted);
  font-weight: 800;
}

.profit {
  color: var(--good);
  font-size: 18px;
  font-weight: 900;
}

.meta {
  font-weight: 700;
}

.collections,
.outcome {
  grid-column: 2 / 4;
}

.empty {
  padding: 28px;
  text-align: center;
}

.hidden {
  display: none;
}

.detail {
  padding-bottom: 16px;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.item-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item-list li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfb;
}

.item-main {
  display: block;
  font-weight: 800;
}

.item-sub {
  display: block;
  margin-top: 3px;
}

@media (max-width: 780px) {
  .app {
    padding: 16px;
  }

  .hero,
  .progress-top,
  .results-head,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .money-button {
    width: 100%;
  }

  .contract-card,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .rank,
  .collections,
  .outcome {
    grid-column: auto;
    grid-row: auto;
  }
}
