:root {
  --bg: #071528;
  --bg2: #0b2d54;
  --card: rgba(255, 255, 255, 0.96);
  --text: #132238;
  --muted: #607087;
  --line: #dbe6f2;
  --brand: #0f72ff;
  --brand2: #12d6c5;
  --danger: #d93025;
  --success: #0a8f5b;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0, 28, 76, 0.24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(18, 214, 197, 0.28), transparent 26%),
    radial-gradient(circle at 88% 14%, rgba(15, 114, 255, 0.32), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg2));
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 72%);
}

.page-shell { width: min(1060px, calc(100% - 28px)); margin: 0 auto; padding: 34px 0 70px; }
.hero { color: white; padding: 34px 8px 26px; }
.brand-badge {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(255,255,255,0.24); border-radius: 999px; padding: 8px 14px;
  background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); font-size: 14px; letter-spacing: 0.04em;
}
.hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.05; margin: 22px 0 16px; letter-spacing: -0.03em; }
.hero p { max-width: 780px; color: rgba(255,255,255,0.82); font-size: 18px; line-height: 1.8; margin: 0; }
.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero-tags span { border-radius: 999px; padding: 8px 12px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.16); color: rgba(255,255,255,0.86); font-size: 13px; }

.form-card { background: var(--card); border: 1px solid rgba(255,255,255,0.68); box-shadow: var(--shadow); border-radius: 30px; padding: 28px; backdrop-filter: blur(14px); }
.form-section { padding: 30px 0; border-bottom: 1px solid var(--line); }
.form-section:first-of-type { padding-top: 8px; }
.form-section:last-of-type { border-bottom: 0; }
.section-title { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.section-title > span {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 10px 24px rgba(15,114,255,0.25);
}
.section-title h2 { margin: 0 0 6px; font-size: 22px; }
.section-title p { margin: 0; color: var(--muted); line-height: 1.6; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label, .choice-field { font-size: 15px; color: #26384d; }
label b, legend b, .agree b { color: var(--danger); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; font: inherit; outline: none; background: #fff; color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
input:focus, select:focus, textarea:focus { border-color: rgba(15,114,255,0.85); box-shadow: 0 0 0 4px rgba(15,114,255,0.12); }
textarea { resize: vertical; min-height: 110px; }
.full { display: block; margin-top: 16px; }
.choice-field { border: 0; padding: 0; margin: 20px 0 0; }
.choice-field legend { font-weight: 700; margin-bottom: 12px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice-grid label {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff;
  min-height: 48px; padding: 11px 12px; border-radius: 14px; cursor: pointer; transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.choice-grid label:hover { border-color: rgba(15,114,255,0.5); background: #f7fbff; transform: translateY(-1px); }
.choice-grid input { width: 17px; height: 17px; accent-color: var(--brand); flex: 0 0 auto; }
.conditional { display: none; animation: reveal .25s ease; }
.conditional.is-visible { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.upload-box {
  border: 1px dashed rgba(15,114,255,0.45); padding: 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(15,114,255,0.06), rgba(18,214,197,0.05));
}
.upload-box input { display: block; margin-top: 10px; }
.upload-box small { display: block; margin-top: 8px; color: var(--muted); }
.agree { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; line-height: 1.6; }
.agree input { margin-top: 4px; accent-color: var(--brand); }
.submit-btn {
  width: 100%; border: 0; border-radius: 18px; padding: 17px 22px; margin-top: 18px;
  font-size: 18px; font-weight: 800; color: white; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 16px 34px rgba(15,114,255,0.28);
  transition: transform .16s ease, filter .16s ease;
}
.submit-btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.submit-btn[disabled] { opacity: 0.65; cursor: not-allowed; transform: none; }
.form-message { margin-top: 16px; padding: 0; border-radius: 14px; font-weight: 700; }
.form-message.error { padding: 14px 16px; color: var(--danger); background: #fff1f0; border: 1px solid #ffd2cf; }
.form-message.success { padding: 16px; color: var(--success); background: #ecfff8; border: 1px solid #bcebd9; line-height: 1.8; }
.hp-field { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.admin-page { min-height: 100vh; padding: 28px; }
.admin-shell { width: min(1200px, 100%); margin: 0 auto; }
.admin-header { color: white; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.admin-header h1 { margin: 0 0 8px; font-size: 34px; }
.admin-header p { margin: 0; color: rgba(255,255,255,0.78); }
.admin-card { background: rgba(255,255,255,0.96); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.admin-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.admin-toolbar input { flex: 1 1 240px; margin: 0 !important; }
.admin-btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 800; cursor: pointer; color: white; background: var(--brand); }
.admin-btn.secondary { color: var(--brand); background: #eef6ff; }
.admin-btn.danger { background: #d93025; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: #f5f9ff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat strong { display: block; font-size: 24px; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #52677f; font-size: 13px; white-space: nowrap; }
tr:hover td { background: #f9fcff; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-btn { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--brand); font-weight: 700; }
.detail-panel { display: none; position: fixed; inset: 0; background: rgba(2,10,24,0.55); padding: 22px; z-index: 20; }
.detail-panel.is-visible { display: grid; place-items: center; }
.detail-box { width: min(860px, 100%); max-height: 86vh; overflow: auto; background: white; border-radius: 24px; padding: 24px; box-shadow: var(--shadow); }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.detail-head h2 { margin: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-item { border: 1px solid var(--line); background: #fbfdff; border-radius: 14px; padding: 12px; }
.detail-item small { display: block; color: var(--muted); margin-bottom: 4px; }
.attachment-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
pre.payload { white-space: pre-wrap; word-break: break-word; background: #071528; color: #d9f6ff; border-radius: 16px; padding: 14px; overflow: auto; }

@media (max-width: 820px) {
  .page-shell { width: min(100% - 18px, 1060px); padding-top: 18px; }
  .form-card { padding: 18px; border-radius: 22px; }
  .grid.two, .choice-grid, .stats, .detail-grid { grid-template-columns: 1fr; }
  .hero { padding: 24px 2px 18px; }
  .hero p { font-size: 16px; }
  .section-title { gap: 12px; }
  .admin-header { display: block; }
}

/* v2 dynamic form and admin config editor */
.loading-box { padding: 24px; color: var(--muted); text-align: center; }
.field.full, .choice-field.full, .upload-box.full, .agree.full { grid-column: 1 / -1; }
.field.half { min-width: 0; }
.field-help { display: block; margin-top: 8px; color: var(--muted); line-height: 1.6; }
.field-label { display: inline-block; }
.dynamic-grid > .choice-field { margin: 0; }
.dynamic-grid > .upload-box { margin-top: 0; }
.dynamic-grid > .agree { margin-top: 0; }

.admin-tabs { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tab-btn { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-weight: 800; cursor: pointer; color: var(--brand); background: #eef6ff; }
.tab-btn.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.config-head, .config-section-head, .field-edit-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.config-head h2, .config-section-head h3 { margin: 0 0 6px; }
.config-head p, .config-section-head p { margin: 0; color: var(--muted); line-height: 1.6; }
.config-basic-card h3 { margin-top: 0; }
.section-edit-card { border: 1px solid rgba(15,114,255,0.12); }
.config-section-grid { margin-top: 16px; }
.field-editor-list { display: grid; gap: 14px; margin-top: 18px; }
.field-edit-card { border: 1px solid var(--line); background: #f9fcff; border-radius: 18px; padding: 16px; }
.field-edit-head { align-items: center; margin-bottom: 12px; }
.field-edit-head strong { color: #132238; }
.field-edit-card textarea { min-height: 72px; }
.field-edit-card small { color: var(--muted); line-height: 1.5; display: block; margin: 4px 0 8px; }
.check-line { display: flex; gap: 8px; align-items: center; min-height: 50px; padding-top: 20px; }
.check-line input { accent-color: var(--brand); }
.danger-text { color: var(--danger) !important; }
.mini-btn.danger-text { border-color: #ffd2cf; background: #fff7f6; }
.form-message:empty { display: none; }
.config-basic-card input, .config-basic-card textarea, .section-edit-card input, .section-edit-card textarea, .section-edit-card select { margin-top: 8px !important; }

@media (max-width: 820px) {
  .config-head, .config-section-head, .field-edit-head { display: block; }
  .config-head .row-actions, .config-section-head .row-actions, .field-edit-head .row-actions { margin-top: 12px; }
}
