/* it-80.3.3 — company-side Encompass settings.

   Field mapping is a form, laid out with flexbox (not a table): a header row + one flex
   row per custom field — the field name/type on the left, the role md-outlined-select on
   the right in a fixed column. Real vertical padding so rows aren't squished against the
   56px control. (The --space-* scale isn't defined as tokens in this app — only ever used
   with fallbacks — so this uses explicit rem values.) */
.enc-map {
  display: flex;
  flex-direction: column;
}

.enc-map__head,
.enc-map__row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.enc-map__head {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  font-size: var(--md-sys-typescale-label-medium-size);
  font-weight: var(--md-sys-typescale-label-medium-weight);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.enc-map__row {
  padding: 1rem 0;
}

/* Left column grows; the role column is a fixed width shared by header + rows. */
.enc-map__field,
.enc-map__head-field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.enc-map__name {
  font-weight: 500;
}

.enc-map__control,
.enc-map__head-role {
  flex: 0 0 20rem;
}
.enc-map__control md-outlined-select {
  width: 100%;
}
.enc-map__control .autocomplete,
.enc-map__control .autocomplete md-outlined-text-field,
.enc-map__field > .autocomplete,
.enc-map__field > .autocomplete md-outlined-text-field,
.field-input > .autocomplete,
.field-input > .autocomplete md-outlined-text-field {
  width: 100%;
}

/* Ordered-milestones editor (it-80.5.2) — reuses the field-mapping row rhythm: the
   milestone-name autocomplete grows (.enc-map__field), then a fixed order column + a remove
   button, with a centered "Add milestone" as the final row that grows the list by one. */
.enc-ms__order,
.enc-ms__head-order {
  flex: 0 0 8rem;
}
.enc-ms__order md-outlined-text-field {
  width: 100%;
}
.enc-ms__remove,
.enc-ms__head-remove {
  flex: 0 0 2.5rem;
  display: flex;
  justify-content: center;
}
.enc-ms__add-row {
  justify-content: center;
}

/* The Custom Object the mapping populates — the section anchor, made prominent. */
.enc-map-object {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.25rem;
}
.enc-map-object__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.enc-map-object__name {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--md-sys-color-on-surface);
}

/* Read-only mapping summary: one flex row per pair. First column = the Encompass field
   (a colored pill) with the human name stacked beneath; second column = the target Custom
   Object field. Rows are vertically centered; no dividers. GUID key is just the first row. */
.enc-maplist {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.enc-maprow {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.25rem;
}
.enc-maprow__target {
  flex: 0 0 14rem;
  font-weight: 500;
}
.enc-maprow__arrow {
  flex: 0 0 1.75rem;
  text-align: center;
  font-size: 20px;
  color: var(--md-sys-color-outline);
}
.enc-maprow__src {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}
.enc-maprow__srcname {
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
}
.enc-maprow--head {
  padding-bottom: 0.5rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.enc-maprow--head .enc-maprow__src {
  display: block;
}
.enc-maprow--head .enc-maprow__target {
  font-weight: 700;
}
.enc-pill {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.enc-pill--guid {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}
/* it-80.4a-borrower: the designated borrower contact_reference field, same treatment
 * as the GUID key pill but its own color so the two designations read distinctly. */
.enc-pill--borrower {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* .enc-chip--pseudo tags a pseudo-milestone in the order picker (base .chip carries no
 * colour of its own — chips.css owns shape/spacing). */
.enc-chip--pseudo {
  margin-left: auto;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* Encompass-field autocomplete item: human name + raw id + a format chip. */
.fieldopt {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.fieldopt__name {
  font-weight: 500;
}
.fieldopt__id {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  color: var(--md-sys-color-on-surface-variant);
}
.fieldopt__fmt {
  margin-left: auto;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}
