/* FNS numeric / THB input group. Presentation only: never changes submitted values. */
input.fns-numeric-right,
input.fns-numeric-right.form-control,
input[type="number"],
input.num-dec,
input.num-only {
  text-align: right !important;
}

/* One outside border and one interior separator: no rounded join or gap. */
.fns-money-group {
  display: flex !important;
  align-items: stretch;
  gap: 0 !important;
  width: 100% !important;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--field-line, #ced4da);
  border-radius: .2rem;
  background: var(--surface, #fff);
}
.fns-money-group > input,
.fns-money-group > input.form-control,
body:not(.app-shell) .fns-money-group > input.form-control,
body:not(.app-shell) .fns-money-group > input.form-control-sm {
  flex: 1 1 auto !important;
  width: 1px !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0;
  text-align: right !important;
  box-sizing: border-box;
}
.fns-money-group > .fns-money-addon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 3px;
  color: var(--brand, #294993);
  background: var(--panel, #eef1f6);
  border: 0 !important;
  border-left: 1px solid var(--field-line, #ced4da) !important;
  border-radius: 0 !important;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: nowrap;
}
.fns-money-group:focus-within {
  border-color: var(--brand, #294993);
  box-shadow: 0 0 0 2px rgba(41,73,147,.15);
}
.fns-money-group > input:disabled + .fns-money-addon,
.fns-money-group > input[readonly] + .fns-money-addon {
  background: var(--panel, #eef1f6);
}

/* Existing loan forms' input-unit component uses a 6px gap.
   Keep its original structure but seal input and unit into one group. */
body:not(.app-shell) .input-unit.input-unit--fill {
  display: flex;
  align-items: stretch;
  gap: 0 !important;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--field-line, #ced4da);
  border-radius: .2rem;
}
body:not(.app-shell) .input-unit.input-unit--fill > input.form-control,
body:not(.app-shell) .input-unit.input-unit--fill > input.form-control-sm {
  flex: 1 1 auto !important;
  width: 1px !important;
  min-width: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-align: right !important;
}
body:not(.app-shell) .input-unit.input-unit--fill > .unit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  margin: 0 !important;
  padding: 0 3px;
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  box-sizing: border-box;
  background: var(--panel, #eef1f6);
  border-left: 1px solid var(--field-line, #ced4da);
  color: var(--brand, #294993);
  font-size: 13.5px;
  line-height: 1.5;
}
body:not(.app-shell) .input-unit.input-unit--fill:focus-within {
  border-color: var(--brand, #294993);
  box-shadow: 0 0 0 2px rgba(41,73,147,.15);
}
/* Retain intact sizing inside existing selector/date compound controls. */
body:not(.app-shell) .fld-rows .fld-row > .fld > .fns-money-group {
  width: 100% !important;
  flex: 1 1 auto;
  min-width: 0;
}
body:not(.app-shell) .input-cal > span.fns-money-group,
body:not(.app-shell) .input-btn > span.fns-money-group {
  display: flex !important;
  flex: 1 1 0;
  min-width: 0;
  width: auto !important;
}
body:not(.app-shell) .input-cal.sel-wide > span.fns-money-group {
  max-width: 36%;
}

/* Daily payment VAT/WHT: preserve numeric typing space alongside the THB suffix.
   Apply only where explicitly opted-in; all other select/amount groups remain unchanged. */
body:not(.app-shell) .input-cal.sel-wide.fns-tax-split > select.form-control {
  flex: 0 0 45% !important;
  width: 45% !important;
  max-width: 45% !important;
  min-width: 0 !important;
  text-overflow: ellipsis;
}
body:not(.app-shell) .input-cal.sel-wide.fns-tax-split > span.fns-money-group {
  flex: 1 1 55% !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
}
