:root {
  color: #202124;
  background: #f6f7f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 32px 16px;
}

.form-page {
  width: min(var(--form-width, 960px), 100%);
  margin: 0 auto;
}

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

.title-group h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.title-group p {
  margin: 6px 0 0;
  color: #667085;
}

.mode-badge {
  padding: 6px 10px;
  border-radius: 6px;
  background: #e8f1ff;
  color: #155eef;
  font-size: 14px;
  white-space: nowrap;
}

.section {
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  background: #ffffff;
}

.section-title {
  margin: 0 0 16px;
  font-size: 18px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #344054;
  font-size: 14px;
}

.required {
  color: #d92d20;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #ccd3de;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: #202124;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.detail-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

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

.detail-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  border-bottom: 1px solid #e6e9ef;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.detail-table th {
  color: #475467;
  font-size: 13px;
  font-weight: 600;
}

.detail-table input,
.detail-table select {
  width: 100%;
  min-width: 96px;
  height: 36px;
  border: 1px solid #ccd3de;
  border-radius: 6px;
  padding: 6px 8px;
}

.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 0 0;
  background: linear-gradient(to top, #f6f7f9 70%, rgba(246, 247, 249, 0));
}

.button {
  min-height: 40px;
  border: 1px solid #ccd3de;
  border-radius: 6px;
  padding: 8px 14px;
  background: #ffffff;
  color: #202124;
  cursor: pointer;
}

.button.primary {
  border-color: #155eef;
  background: #155eef;
  color: #ffffff;
}

.button.danger {
  border-color: #fecdca;
  background: #fff5f4;
  color: #b42318;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.message {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
}

.message.success {
  background: #ecfdf3;
  color: #027a48;
}

.message.error {
  background: #fef3f2;
  color: #b42318;
}

.loading {
  width: min(960px, 100%);
  margin: 80px auto 0;
  color: #667085;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 20px 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .section {
    padding: 16px;
  }
}
