/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a2e;
  background: #f4f6f9;
  min-height: 100vh;
  padding: 40px 16px;
}

/* ── Layout ── */
.container {
  max-width: 720px;
  margin: 0 auto;
}

/* ── Page Header ── */
.page-header {
  margin-bottom: 32px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 6px;
}
.page-header p {
  color: #6b7280;
  font-size: 14px;
}

/* ── Section card ── */
.section {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}
.section h2 {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

/* ── Field ── */
.field {
  margin-bottom: 16px;
}
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}
.field label small {
  font-weight: 400;
  color: #9ca3af;
  font-size: 12px;
}

/* ── Text & Number Inputs ── */
input[type="text"],
input[type="number"],
input[type="email"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #1a1a2e;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus,
input[type="number"]:focus {
  border-color: #4f6ef7;
  box-shadow: 0 0 0 3px rgba(79,110,247,.1);
}
input::placeholder { color: #c4c8d0; }

/* hide number spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }

/* ── Range Slider ── */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: #e5e7eb;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  margin-top: 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #4f6ef7;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* ── Checkboxes ── */
.check-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: background .1s, border-color .1s;
}
.check-item:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
.check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  accent-color: #4f6ef7;
  flex-shrink: 0;
  cursor: pointer;
}
.check-item small {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 1px;
}

/* ── Radios ── */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  transition: background .1s, border-color .1s;
}
.radio-item:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
.radio-item input[type="radio"] {
  accent-color: #4f6ef7;
  cursor: pointer;
}

/* ── Grids ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 520px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Tag Input ── */
.tag-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  min-height: 42px;
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.tag-wrap:focus-within {
  border-color: #4f6ef7;
  box-shadow: 0 0 0 3px rgba(79,110,247,.1);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eef2ff;
  color: #4f6ef7;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
}
.tag.negative {
  background: #fef2f2;
  color: #ef4444;
  border-color: #fecaca;
}
.tag-del {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: .6;
}
.tag-del:hover { opacity: 1; }

.tag-input {
  border: none;
  outline: none;
  font-size: 13px;
  color: #374151;
  background: transparent;
  flex: 1;
  min-width: 140px;
}

.hint {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 5px;
}

/* ── Hidden utility ── */
.hidden { display: none !important; }

/* ── Actions ── */
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
}

.btn-primary {
  padding: 10px 24px;
  background: #4f6ef7;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #3b5bdb; }
.btn-primary:active { background: #3451c7; }

.btn-secondary {
  padding: 10px 20px;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-secondary:hover { border-color: #9ca3af; color: #374151; }

/* ── Output Panel ── */
.output {
  margin-top: 24px;
  border: 1px solid #d1fae5;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.output-header {
  background: #ecfdf5;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #059669;
  border-bottom: 1px solid #d1fae5;
}
.output-header span { font-weight: 400; color: #6b7280; margin-left: 4px; }
#output-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}
