:root {
  --green: #0b5f46;
  --green-2: #08724f;
  --red: #c81e2b;
  --gold: #d8a93b;
  --paper: #fffdf8;
  --cream: #fff8ea;
  --ink: #111827;
  --muted: #667085;
  --line: rgba(17, 24, 39, .12);
  --shadow: 0 16px 42px rgba(17, 24, 39, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f7faf8 0%, #fffdf8 54%, #f1f2ec 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(18px, 4vw, 34px);
  color: #fff;
  background: linear-gradient(135deg, #074d39, var(--green-2) 62%, #9b2632);
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .16);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

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

.hero h1 {
  max-width: 820px;
  margin-bottom: 12px;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1.02;
}

.hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, .9);
  font-size: 17px;
  line-height: 1.45;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .12);
}

.panel {
  padding: 18px;
}

.login-panel,
.admin,
.stats-grid,
.grid {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input[type="password"],
input[type="number"] {
  width: 100%;
  min-height: 43px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input[type="range"] {
  width: 100%;
}

.login-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.login-row input {
  flex: 1 1 220px;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 43px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 950;
}

.button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.button.primary {
  color: #fff;
  background: var(--green);
}

.button.subtle {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.hidden {
  display: none !important;
}

.message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 800;
}

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

.toolbar strong,
.toolbar span {
  display: block;
}

.toolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

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

.metric {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--green);
  font-size: 28px;
  line-height: 1;
}

.grid {
  display: grid;
  gap: 14px;
}

.panel-head h2 {
  margin-bottom: 5px;
  font-size: 24px;
}

.panel-head p {
  color: var(--muted);
  line-height: 1.45;
}

.form-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.stack {
  display: grid;
  gap: 10px;
}

.weight-row,
.manual-row,
.result-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.weight-row,
.manual-row {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.weight-top,
.manual-top,
.result-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.weight-top span,
.manual-top span,
.result-name {
  font-weight: 950;
}

.weight-top output,
.result-percent {
  color: var(--green);
  font-weight: 950;
}

.manual-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

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

.result-row {
  padding: 13px;
}

.result-track {
  overflow: hidden;
  height: 13px;
  margin-top: 8px;
  border-radius: 8px;
  background: rgba(17, 24, 39, .08);
}

.result-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--red));
  transition: width .3s ease;
}

.result-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  padding: 14px 16px;
  border-radius: 8px;
  color: #fff;
  background: rgba(17, 24, 39, .96);
  box-shadow: var(--shadow);
  font-weight: 850;
}

@media (min-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

@media (min-width: 980px) {
  .grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  }
}
