:root {
  --bg: #e8efe9;
  --bg-deep: #d5e2d8;
  --surface: #f7faf7;
  --ink: #14241c;
  --muted: #4a6356;
  --accent: #1f6b4a;
  --accent-press: #165539;
  --line: #b7c9bc;
  --danger: #8b2e2e;
  --radius: 12px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", "Consolas", monospace;
  --nav-h: 72px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 120% 80% at 10% -20%, #c5dbc9 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 100% 0%, #b9d0c4 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

body {
  min-height: 100dvh;
}

.app {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 16px 16px calc(var(--nav-h) + 16px);
}

.top {
  margin-bottom: 16px;
}

.brand {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step-label {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.progress {
  height: 6px;
  background: rgba(20, 36, 28, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 16%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.panel {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 20px;
  box-shadow: 0 10px 30px rgba(20, 36, 28, 0.06);
}

h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(31, 107, 74, 0.35);
  border-color: var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card strong {
  display: block;
  font-size: 0.98rem;
}

.card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
}

.preview {
  width: 100%;
  min-height: 280px;
  max-height: 50dvh;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0 0 10px;
  min-height: 1.2em;
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(232, 239, 233, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}

.nav .btn {
  flex: 1;
  max-width: 240px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 16px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:not(:disabled):active {
  background: var(--accent-press);
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-block {
  width: 100%;
}

.subhead {
  margin: 18px 0 10px;
  font-size: 1rem;
}

.summary {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.summary h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.io-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.io-table th,
.io-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.io-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.io-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
  width: 5.5rem;
}
