:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-strong: #eef3ef;
  --ink: #182026;
  --muted: #5b6770;
  --line: #d8ded8;
  --accent: #47735a;
  --accent-dark: #315840;
  --danger: #a43f3f;
  --shadow: 0 10px 30px rgba(24, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
  padding: 0 18px;
}

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

button:disabled {
  cursor: not-allowed;
  background: #9aa8a0;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  padding: 24px;
}

.workbench {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  max-width: 1480px;
  margin: 0 auto;
}

.sidebar,
.editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 20px;
  align-self: start;
  position: sticky;
  top: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 24px;
}

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

h1 {
  font-size: 20px;
  line-height: 1.25;
}

.brand p,
.toolbar p,
.status-panel p,
.schema-list p,
small {
  color: var(--muted);
}

.upload-zone {
  display: grid;
  gap: 12px;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-zone label {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  border: 1.5px dashed #9eb0a3;
  border-radius: 8px;
  background: var(--surface-strong);
  text-align: center;
  padding: 18px;
  cursor: pointer;
}

.upload-icon {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dce8df;
  color: var(--accent-dark);
  font-size: 0;
  line-height: 0;
}

.upload-icon::before,
.upload-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.upload-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.status-panel {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  margin: 18px 0;
  padding: 10px 12px;
  background: #f7f8f6;
  border: 1px solid var(--line);
  border-radius: 6px;
}

#statusDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #aeb8af;
  flex: 0 0 auto;
}

#statusDot.active {
  background: var(--accent);
}

#statusDot.error {
  background: var(--danger);
}

.schema-list {
  display: grid;
  gap: 8px;
}

.schema-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.schema-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.schema-item p {
  font-size: 12px;
  line-height: 1.45;
}

.editor {
  min-width: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.toolbar h2 {
  font-size: 24px;
  line-height: 1.25;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: #24313a;
}

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

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid #ccd5ce;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input[type="text"] {
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.55;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(71, 115, 90, 0.14);
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .toolbar,
  .editor-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
/* === template picker (added for 第二种模板) === */
.format-actions{display:flex;align-items:center;gap:12px}
.template-pick{display:flex;align-items:center;gap:6px;font-size:13px;color:#64748b}
.template-pick select{padding:6px 10px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;font-size:13px;color:#0f172a;cursor:pointer}
