:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #17233d;
  --muted: #637083;
  --line: #e7edf4;
  --green: #1f8f5f;
  --green-soft: #e8f6ef;
  --blue-soft: #eef3ff;
  --danger: #c84e4e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

#app {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 92px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 28px; line-height: 1.18; letter-spacing: 0; }
h3 { font-size: 18px; }

.icon-button, .text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
}

.hero {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--green-soft), var(--blue-soft));
}

.hero-copy p:last-child {
  margin-top: 12px;
  color: #4f5f70;
  line-height: 1.65;
}

.hero-panel {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(31, 143, 95, .18);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
}

.hero-panel span, .hero-panel small { color: var(--muted); }
.hero-panel strong { font-size: 20px; }

.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

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

.metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 18px 10px;
  border: 0;
  border-radius: 18px;
  background: var(--card);
  text-align: center;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(23,35,61,.04);
}

.metric span { color: var(--green); font-size: 26px; font-weight: 800; }
.metric small { color: var(--muted); font-size: 12px; }
.metric.static { box-shadow: none; }
.metrics.compact { margin-bottom: 0; grid-template-columns: repeat(2, 1fr); }

.section {
  margin-top: 16px;
  padding: 20px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(23,35,61,.04);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.steps, .list { display: grid; gap: 12px; }
.step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: center;
  color: #4f5f70;
  line-height: 1.5;
}
.step b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 14px;
}

.sample-section .section-head {
  align-items: flex-start;
}

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

.sample-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sample-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfe;
  color: var(--text);
  text-align: left;
}

.sample-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top;
  border-radius: 12px;
  background: #edf1f6;
}

.sample-card strong {
  font-size: 14px;
  line-height: 1.35;
}

.sample-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sample-card em {
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.sample-card:hover,
.sample-card:focus-visible {
  border-color: rgba(31,143,95,.46);
  box-shadow: 0 8px 24px rgba(31,143,95,.1);
  outline: none;
}

.form { display: grid; gap: 14px; }
label {
  display: grid;
  gap: 8px;
  color: #334255;
  font-size: 14px;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #f8fafc;
  color: var(--text);
  outline: none;
}

textarea { min-height: 116px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--green); background: white; }

.preview {
  display: none;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 16px;
  background: #edf1f6;
}
.preview.active { display: block; }

.sample-strip {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(31,143,95,.14);
  border-radius: 16px;
  background: var(--green-soft);
}

.sample-strip strong {
  display: block;
  margin-bottom: 4px;
}

.sample-strip p {
  color: #4f5f70;
  font-size: 13px;
  line-height: 1.55;
}

.primary, .secondary {
  border: 0;
  border-radius: 14px;
  min-height: 46px;
  padding: 0 18px;
  font-weight: 800;
}
.primary { background: var(--green); color: #fff; }
.secondary { background: var(--green-soft); color: var(--green); }
.wide { width: 100%; }

.lead {
  color: #4f5f70;
  line-height: 1.75;
}

.result-card { border: 1px solid rgba(31,143,95,.14); }

.result-image {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  object-position: top;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.item-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfe;
}
.item-card strong { line-height: 1.35; }
.item-card p { color: var(--muted); line-height: 1.6; }
.item-card .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.item-card .mini-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.item-card .mini-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.empty {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-top: 36px;
  padding: 24px;
  border-radius: 20px;
  background: var(--card);
}
.empty p { color: var(--muted); line-height: 1.6; }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 720px);
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(16px);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}

.tabbar button {
  border: 0;
  border-radius: 14px;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.tabbar button.active {
  background: var(--green-soft);
  color: var(--green);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 20;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  max-width: calc(100% - 40px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(23,35,61,.92);
  color: #fff;
  transition: .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 680px) {
  #app { padding-top: 28px; }
  .hero { grid-template-columns: 1.35fr .85fr; align-items: center; }
  .sample-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sample-strip { grid-template-columns: .9fr 1.4fr; align-items: center; }
}
