.import-heading {
  margin-bottom: 18px;
}

.profit.loss { color: var(--danger); }

.historical-sale-form input[type="radio"],
.historical-sale-form input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  accent-color: var(--brand);
}
.historical-sale-form [id="id_recipient"],
.historical-sale-form [id="id_sale_channel"],
.historical-sale-form [id="id_expense_recorded"] { display: grid; gap: 12px; }
.historical-sale-form [id="id_recipient"] label,
.historical-sale-form [id="id_sale_channel"] label,
.historical-sale-form [id="id_expense_recorded"] label {
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.historical-sale-form label:has(input:checked) { background: #e5f3ef; outline: 2px solid var(--brand); }

.import-heading .muted {
  margin: 6px 0 0;
}

.import-form {
  display: block;
  max-width: 980px;
  padding: 0;
  overflow: hidden;
}

.form-error-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 24px 0;
  padding: 14px 16px;
  color: #8f2727;
  background: #fceaea;
  border: 1px solid #efc7c7;
  border-radius: 12px;
}

.form-error-summary strong {
  white-space: nowrap;
}

.import-section {
  padding: 26px 28px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.section-title > span {
  display: inline-flex;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #fff;
  font-weight: 800;
  background: var(--brand);
  border-radius: 50%;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
}

.section-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.import-grid {
  display: grid;
  gap: 20px;
}

.import-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field {
  display: grid;
  align-content: start;
  gap: 7px;
}

.form-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 750;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b8c5c8;
  border-radius: 10px;
  font: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px #0b6b571a;
}

.form-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.required-badge,
.optional-badge {
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 750;
  border-radius: 999px;
}

.required-badge {
  color: #9b2d2d;
  background: #fbe5e5;
}

.optional-badge {
  color: #65737a;
  background: #eaf0f1;
}

.money-input {
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid #b8c5c8;
  border-radius: 10px;
}

.money-input:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px #0b6b571a;
}

.money-input > span {
  padding-left: 13px;
  color: var(--muted);
  font-weight: 800;
}

.money-input input {
  border: 0;
  box-shadow: none;
}

.money-input input:focus {
  box-shadow: none;
}

.keys-field textarea {
  min-height: 300px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.65;
}

.keys-feedback {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  color: #425159;
  background: #f0f6f4;
  border-radius: 9px;
  font-size: 12px;
}

.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea,
.form-field.has-error .money-input {
  border-color: #b94747;
}

.form-field .errorlist {
  margin: 0;
  list-style: none;
}

.import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px;
  background: #f8fbfa;
}

@media (max-width: 760px) {
  .import-grid.two-columns {
    grid-template-columns: 1fr;
  }

  .import-section {
    padding: 22px 18px;
  }

  .keys-feedback,
  .form-error-summary,
  .import-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-error-summary {
    margin: 18px 18px 0;
  }

  .import-actions {
    padding: 18px;
  }
}
