:root {
  --bg: #f0f5f3;
  --card: #ffffff;
  --text: #16302b;
  --muted: #4a625e;
  --line: #c8d8d2;
  --action: #00795f;
  --action-hover: #006650;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #e8f2ee 0%, #f7fbfa 100%);
}

.layout {
  max-width: 1050px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

h1,
h2 {
  margin: 0 0 12px;
}

h3 {
  margin: 0 0 8px;
}

p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.top-grid {
  margin-bottom: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

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

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

input.readonly {
  background: #f3f7f5;
  color: #48635d;
}

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

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

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

.field {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.field-head {
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.required {
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e3f4ee;
  color: #0f6b57;
  font-size: 0.75rem;
  font-weight: 700;
}

.field-tooltip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #8fb2a7;
  color: #24594d;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  cursor: help;
  user-select: none;
}

.geo-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.relation-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

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

.actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.compact-actions {
  margin-top: 0;
}

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

.recommended-warnings {
  margin-top: 10px;
  border: 1px solid #e6cf9a;
  background: #fff8e8;
  color: #6b4b00;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.recommended-warnings ul {
  margin: 0;
  padding-left: 18px;
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  background: #ecf4f1;
  color: var(--text);
  border: 1px solid var(--line);
}

.tab:hover {
  background: #e0eee8;
}

.tab.active {
  background: var(--action);
  color: #fff;
  border-color: var(--action);
}

button {
  background: var(--action);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--action-hover);
}

.danger-button {
  background: #b32727;
}

.danger-button:hover {
  background: #8f1e1e;
}

pre {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7fbfa;
  overflow: auto;
}

#payloadEditor {
  width: 100%;
  min-height: 280px;
  font-family: "Consolas", "Menlo", "Monaco", monospace;
  background: #f7fbfa;
}

#batchEditor {
  width: 100%;
  min-height: 280px;
  font-family: "Consolas", "Menlo", "Monaco", monospace;
  background: #f7fbfa;
}

#batchExample {
  width: 100%;
  min-height: 220px;
  max-height: 420px;
  margin-top: 8px;
  font-family: "Consolas", "Menlo", "Monaco", monospace;
  white-space: pre;
}

.subhead {
  margin-top: 14px;
}

.entity-list {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 280px;
  overflow: auto;
  background: #f7fbfa;
}

.entity-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
}

.entity-item:last-child {
  border-bottom: none;
}

.entity-item:hover {
  background: #e8f2ee;
}

.hidden {
  display: none;
}

#resultCard {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.result-neutral {
  background: #ffffff;
  border-color: var(--line);
}

.result-success {
  background: #ebf9f4;
  border-color: #90d3bb;
}

.result-error {
  background: #fff2f2;
  border-color: #efb0b0;
}

.result-info {
  background: #eef6ff;
  border-color: #9ec4ea;
}
