:root {
  color: #2f2635;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(135deg, #fff3f5 0%, #f4edff 100%);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px;
  color: #fff;
  background: linear-gradient(120deg, #d94868, #7c4dff);
}

h1, h2, h3, p { margin: 0; }
.topbar h1 { font-size: 26px; font-weight: 700; }
.topbar p { margin-top: 6px; opacity: .86; }

.link-button, button {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  color: #fff;
  background: #7c4dff;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

.topbar .link-button { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.4); }
button.secondary { color: #5c4b67; background: #eee7f7; }
button.danger { background: #d94868; }
.hidden { display: none !important; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
#adminIdentity { font-weight: 700; }

.auth-panel {
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  margin: 42px auto;
  padding: 24px;
  background: rgba(255,255,255,.88);
  border: 1px solid #eadff4;
  border-radius: 8px;
}
.auth-panel label { display: grid; gap: 6px; color: #5c4b67; }
.auth-panel input { width: 100%; }
.hint-inline { color: #786783; font-size: 13px; line-height: 1.6; }

.tabs {
  display: flex;
  gap: 10px;
  padding: 18px 40px 0;
}

.tabs button {
  color: #6a5875;
  background: rgba(255,255,255,.72);
  border: 1px solid #eadff4;
}

.tabs button.active {
  color: #fff;
  background: #d94868;
}

main { padding: 22px 40px 40px; }
.panel { display: none; }
.panel.active { display: block; }

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

.toolbar, .import-box {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  background: rgba(255,255,255,.76);
  border: 1px solid #eadff4;
  border-radius: 8px;
}

.import-box { align-items: flex-start; flex-wrap: wrap; }
.import-guide { display: grid; gap: 6px; flex: 1 1 420px; color: #5c4b67; }
.import-guide p { color: #786783; font-size: 13px; line-height: 1.6; }
.import-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.import-result { flex-basis: 100%; display: grid; gap: 10px; }
.result-summary { display: flex; gap: 16px; color: #4d4057; font-weight: 700; }
.result-error { color: #d94868; font-weight: 700; }
.mini-table th, .mini-table td { padding: 8px; font-size: 13px; }

input, select, textarea {
  width: 220px;
  min-height: 38px;
  border: 1px solid #d8cce5;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

textarea { width: 440px; height: 72px; resize: vertical; }

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,.9);
  border: 1px solid #eadff4;
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid #f0e8f6;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th { color: #6a5875; background: #faf7fd; font-weight: 700; }
td code { font-size: 12px; color: #6a5875; word-break: break-all; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.summary-bar {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid #eadde8;
  border-radius: 8px;
  background: #fff7fb;
  color: #58485b;
  font-size: 13px;
}

dialog {
  width: min(920px, calc(100vw - 32px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 22px 80px rgba(50, 28, 68, .24);
}

dialog::backdrop { background: rgba(36, 22, 48, .35); }
#modalForm { padding: 22px; }
#modalBody { display: grid; gap: 12px; margin: 18px 0; }
.form-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.hint { margin: -4px 0 8px 162px; color: #786783; font-size: 13px; }
.detail-grid { display: grid; gap: 8px; color: #4d4057; }
.activity-config { display: block; }
.form-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #eadff4;
  border-radius: 8px;
  background: #fff;
}
.form-section h4 { margin: 0; color: #4d4057; }
.question-editor { display: grid; gap: 10px; }
.question-editor-head, .question-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.question-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #eadff4;
  border-radius: 8px;
  background: #faf7fd;
}
.question-grid {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  gap: 10px;
}
.question-grid label, .question-field {
  display: grid;
  gap: 6px;
  color: #5c4b67;
  font-size: 13px;
}
.question-grid input, .question-grid select, .question-field input, .question-field textarea { width: 100%; }
.question-field { grid-template-columns: 1fr; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  min-width: 220px;
  padding: 12px 18px;
  border-radius: 8px;
  color: #fff;
  background: rgba(47, 38, 53, .92);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
#toast.show { opacity: 1; }

@media (max-width: 760px) {
  .topbar, .section-head, .toolbar, .import-box { flex-direction: column; align-items: stretch; }
  .tabs { overflow-x: auto; padding-inline: 16px; }
  main, .topbar { padding-inline: 16px; }
  input, select, textarea { width: 100%; }
  table { display: block; overflow-x: auto; }
}
