:root {
  --bg: #f4f6f8;
  --card: #fff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --border: #dde3ea;
  --primary: #2d6a4f;
  --primary-hover: #1b4332;
  --danger: #c1121f;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(26, 35, 50, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--primary);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.wrap-wide {
  max-width: 1100px;
}

.header {
  margin-bottom: 24px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  font-weight: 600;
}

.header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}

.field {
  margin-bottom: 20px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label.main {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
}

.field .req {
  color: var(--danger);
}

.field .hint {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.options label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  font-weight: 400;
}

.options input {
  margin-top: 4px;
  flex-shrink: 0;
}

.grade-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.grade-row input[type="number"] {
  width: 80px;
}

.conditional {
  margin-top: 10px;
  padding: 12px;
  background: #f8faf9;
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.checkbox-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.checkbox-input-row input[type="number"],
.checkbox-input-row input[type="text"] {
  width: 72px;
}

.char-count {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}

.char-count.over {
  color: var(--danger);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #f5c2c7;
}

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

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

.success-panel {
  text-align: center;
  padding: 40px 20px;
}

.success-panel h2 {
  color: var(--primary);
}

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

.topbar .links {
  display: flex;
  gap: 12px;
  font-size: 0.9rem;
}

/* Admin */
.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

.q-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.q-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.q-list li:hover,
.q-list li.active {
  background: #e8f5e9;
}

.editor-row {
  margin-bottom: 14px;
}

.editor-row label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.option-editor {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.option-editor .row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.option-editor input {
  flex: 1;
}

.login-box {
  max-width: 360px;
  margin: 80px auto;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

th {
  background: #f8faf9;
}

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 6px;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 24px;
}

/* 提交成功 · 报价预览 */
.baojia-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f8faf9;
  border-radius: 8px;
  margin: 16px 0;
  color: var(--muted);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.baojia-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 8px;
}

.baojia-error {
  background: #fff5f5;
  border-color: #f5c2c7;
  padding: 16px;
  margin: 16px 0;
}

.quote-preview {
  max-height: 65vh;
  overflow: auto;
  padding: 20px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.65;
}

.quote-preview h1,
.quote-preview h2,
.quote-preview h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
}

.quote-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.quote-preview th,
.quote-preview td {
  border: 1px solid var(--border);
  padding: 8px;
}

/* 管理后台 · 标签页 */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.admin-tab {
  padding: 10px 18px;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.admin-tab.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.section-card summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 600;
  background: #f8faf9;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-card summary::-webkit-details-marker {
  display: none;
}

.section-card .section-desc {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}

.section-card .section-body {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.q-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}

.q-item:hover {
  background: #f4f8f6;
}

.q-item.active {
  background: #e8f5e9;
  border-color: #c8e6c9;
}

.q-item .q-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.q-item .q-title {
  font-weight: 500;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f5e9;
  color: var(--primary);
}

.badge.req {
  background: #ffebee;
  color: var(--danger);
}

.editor-panel {
  position: sticky;
  top: 16px;
}

.advanced-toggle {
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  margin-top: 8px;
}

.advanced-fields {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.advanced-fields.show {
  display: block;
}

.response-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
