:root {
  --bg-top: #e8f0ee;
  --bg-bottom: #f7faf8;
  --ink: #10221f;
  --muted: #5a6f68;
  --soft: #8a9b95;
  --line: rgba(16, 34, 31, 0.1);
  --panel: #ffffff;
  --accent: #1f6b5a;
  --warm: #c4783a;
  --danger: #e2553d;
  --radius: 1.25rem;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  line-height: 1.5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(31, 107, 90, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(196, 120, 58, 0.1), transparent 50%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 45%, var(--bg-bottom) 100%);
}

.page {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  font-weight: 700;
  color: rgba(16, 34, 31, 0.45);
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 36rem;
}

.api-note {
  display: inline-block;
  margin: 0.9rem 0 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(196, 120, 58, 0.12);
  color: #8a4d1f;
  font-size: 0.82rem;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem 1.6rem;
  box-shadow: 0 16px 40px rgba(16, 34, 31, 0.07);
  border: 1px solid rgba(16, 34, 31, 0.04);
}

fieldset {
  border: 0;
  margin: 0 0 1.25rem;
  padding: 0;
}

legend {
  margin-bottom: 0.65rem;
  font-size: 0.92rem;
  font-weight: 650;
}

.req {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--soft);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1rem 1rem 2.6rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #f7faf8;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.role-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(31, 107, 90, 0.08);
}

.role-card input {
  position: absolute;
  left: 1rem;
  top: 1.15rem;
  accent-color: var(--accent);
}

.role-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.role-desc {
  font-size: 0.82rem;
  color: var(--soft);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}

.label-row {
  font-size: 0.92rem;
  font-weight: 650;
}

.hint {
  font-size: 0.78rem;
  color: var(--soft);
}

input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: #f7faf8;
  color: var(--ink);
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: 2px solid rgba(31, 107, 90, 0.35);
  border-color: var(--accent);
  background: #fff;
}

.dropzone {
  position: relative;
  border: 1.5px dashed rgba(16, 34, 31, 0.2);
  border-radius: 1rem;
  background: #f7faf8;
  min-height: 7.5rem;
  display: grid;
  place-items: center;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(31, 107, 90, 0.08);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(31, 107, 90, 0.35);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-copy {
  text-align: center;
  pointer-events: none;
  padding: 1rem;
}

.drop-copy strong {
  display: block;
  margin-bottom: 0.25rem;
}

.drop-copy span {
  color: var(--soft);
  font-size: 0.85rem;
}

.preview {
  margin: 0.5rem 0 1.25rem;
  padding: 1rem 1rem 0.35rem;
  border-radius: 1rem;
  background: linear-gradient(160deg, #f4f8f6, #eef4f1);
  border: 1px solid var(--line);
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.preview h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.badge {
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(16, 34, 31, 0.08);
  color: var(--muted);
}

.badge.ready {
  background: rgba(31, 107, 90, 0.14);
  color: var(--accent);
}

.badge.busy {
  background: rgba(196, 120, 58, 0.16);
  color: #8a4d1f;
}

.meta-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1rem;
}

.meta-grid > div {
  padding: 0.55rem 0;
  border-top: 1px solid rgba(16, 34, 31, 0.06);
}

.meta-grid .wide {
  grid-column: 1 / -1;
}

.meta-grid dt {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  color: var(--soft);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.meta-grid dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.82rem !important;
  font-weight: 550 !important;
}

.muted { color: var(--soft); font-weight: 500 !important; }

.error {
  margin: 0 0 1rem;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.35rem;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
}

#submit-btn {
  flex: 1;
  min-width: 12rem;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--warm));
}

#submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost {
  color: var(--ink);
  background: #e8f0ee;
}

.ghost:hover {
  filter: brightness(0.97);
}

.footer-note {
  margin: 1.25rem 0 0;
  text-align: center;
  color: var(--soft);
  font-size: 0.8rem;
}

#toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: #10221f;
  color: #f4f7f5;
  box-shadow: 0 12px 36px rgba(16, 34, 31, 0.28);
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  pointer-events: none;
  font-size: 0.9rem;
}

#toast.visible {
  opacity: 1;
  transform: translateY(0);
}

#toast.warn {
  background: #6b3d16;
}

#toast.ok {
  background: #1e3a34;
}

@media (max-width: 560px) {
  .role-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .meta-grid .wide {
    grid-column: auto;
  }

  .actions {
    flex-direction: column;
  }

  #submit-btn,
  .ghost {
    width: 100%;
  }
}
