* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6fbfd;
  color: #14243d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  background: linear-gradient(120deg, #12a7e6 0%, #176fc2 72%);
  color: #ffffff;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.topbar p {
  margin: 6px 0 0;
  color: #d4eae8;
}

main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px;
}

.panel {
  margin-bottom: 20px;
  border: 1px solid #d4eae8;
  border-radius: 8px;
  background: #ffffff;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(20, 127, 209, 0.08);
}

.login-panel {
  max-width: 420px;
}

.panel-title,
.inline-form,
.search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

h3 {
  margin: 18px 0 10px;
  font-size: 15px;
}

label {
  display: block;
  margin-bottom: 14px;
  color: #176fc2;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  margin-top: 6px;
  border: 1px solid #bdd8dd;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
}

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

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: #147fd1;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
  white-space: nowrap;
}

button.ghost {
  border: 1px solid #bdd8dd;
  background: #ffffff;
  color: #176fc2;
}

.hidden {
  display: none !important;
}

.hint {
  margin: 0;
  color: #60798f;
  font-size: 13px;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  border: 1px solid #d9edf1;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 24px;
}

.stat span {
  color: #60798f;
  font-size: 13px;
}

.camp-grid,
.warning-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.camp-card,
.warning-card,
.module-button {
  border: 1px solid #d4eae8;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.camp-card {
  cursor: pointer;
}

.camp-card:hover,
.module-button:hover {
  border-color: #147fd1;
}

.camp-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.camp-actions button {
  min-height: 32px;
}

.item-title {
  font-weight: 800;
}

.meta {
  margin-top: 6px;
  color: #60798f;
  font-size: 13px;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  background: #d4eae8;
  color: #147fd1;
  font-size: 12px;
  font-weight: 700;
}

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

.module-button {
  height: auto;
  min-height: 96px;
  color: #14243d;
  text-align: left;
}

.module-button strong {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
}

.module-button span {
  display: block;
  color: #60798f;
  font-weight: 500;
  line-height: 1.5;
}

.back-button {
  margin-bottom: 16px;
}

.task-form {
  display: grid;
  grid-template-columns: 130px 80px 1fr 190px 220px 100px 110px;
  gap: 12px;
  align-items: end;
}

.camp-form {
  display: grid;
  grid-template-columns: 1.4fr 120px 1fr 110px 150px 150px;
  gap: 12px;
  align-items: end;
}

.mock-paper-form {
  display: grid;
  grid-template-columns: 1.5fr 1fr 110px 100px 130px 110px;
  gap: 12px;
  align-items: end;
}

.rule-builder {
  margin: 6px 0 16px;
  border: 1px solid #d4eae8;
  border-radius: 8px;
  background: #f4fbfd;
  padding: 14px;
}

.rule-builder-title {
  margin-bottom: 10px;
  color: #176fc2;
  font-weight: 800;
}

.rule-row {
  display: grid;
  grid-template-columns: 90px 1fr 110px;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.rule-row span {
  color: #60798f;
  font-size: 13px;
  font-weight: 700;
}

.inline-actions {
  display: flex;
  gap: 10px;
}

.mini-table-button {
  min-height: 28px;
  margin-left: 8px;
  padding: 0 10px;
  font-size: 12px;
}

.table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #d9edf1;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f4fbfd;
  color: #274867;
}

.question-stem {
  max-width: 520px;
  line-height: 1.55;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.question-detail {
  display: grid;
  gap: 14px;
}

.detail-meta {
  color: #60798f;
  font-size: 13px;
}

.detail-stem {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.7;
}

.detail-options {
  display: grid;
  gap: 8px;
}

.detail-option {
  border: 1px solid #d9edf1;
  border-radius: 6px;
  padding: 10px;
  line-height: 1.5;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.compact-table {
  margin-top: 12px;
}

.code-box {
  min-height: 60px;
  overflow-x: auto;
  border-radius: 8px;
  background: #14243d;
  color: #d9edf1;
  padding: 14px;
  white-space: pre-wrap;
}

.paper-preview {
  display: grid;
  gap: 14px;
}

.paper-question {
  border: 1px solid #d4eae8;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.paper-question-title {
  color: #14243d;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.65;
}

.paper-question-meta {
  margin-top: 8px;
  color: #60798f;
  font-size: 13px;
}

.paper-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.paper-option {
  border-radius: 6px;
  background: #f6fbfd;
  padding: 9px 10px;
  line-height: 1.5;
}

.paper-answer {
  margin-top: 12px;
  color: #147fd1;
  font-weight: 800;
}

.paper-analysis {
  margin-top: 8px;
  color: #60798f;
  line-height: 1.6;
}

.option-edit-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.muted-action {
  color: #60798f;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 36, 61, 0.28);
  padding: 24px;
}

.modal-card {
  width: min(420px, 100%);
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #bdd8dd;
  box-shadow: 0 18px 50px rgba(20, 127, 209, 0.16);
  padding: 24px;
}

.modal-card h3 {
  margin: 0 0 10px;
  color: #14243d;
  font-size: 18px;
}

.modal-card p {
  margin: 0;
  color: #176fc2;
  line-height: 1.6;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 980px) {
  .stats,
  .camp-grid,
  .module-grid,
  .warning-grid,
  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .task-form,
  .camp-form,
  .mock-paper-form,
  .rule-row,
  .search-row,
  .inline-form,
  .panel-title,
  .option-edit-grid {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}
